ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
example_cleaned.php
Go to the documentation of this file.
1<?php
2// PSR-2
3namespace Vendor\Package;
4
5use BarClass as Bar;
6use FooInterface;
7use OtherVendor\OtherPackage\BazClass;
8use ZPackage;
9
10class Foo extends Bar implements FooInterface
11{
12 public function sampleMethod($a, $b = null)
13 {
14 if ($a === $b) {
16 } elseif ($a > $b) {
17 $foo->bar($arg1);
18 } else {
19 BazClass::bar($arg2, $arg3);
20 }
21 }
22
23 final public static function bar()
24 {
25 // method body
26 }
27}
28
30// cast_spaces
31$a = 0; $b = 0; $c = 0; $d = 0; $e = 0 ; $f = 0;
32$bar = (string) $a;
33$foo = (int) $b;
34// concat_space
35$foo = 'bar' . 3 . 'baz' . 'qux';
36// binary_operator_spaces
37$a = 1 + $b ^ $d !== $e or $f;
38// unary_operator_spaces
40$sample++;
41//Unused blank lines: begin
42
43//Unused blank lines: end
44--$sample;
45$sample = !!$a;
46$sample = ~$c;
47function &foo()
48{
49}
50// function_typehint_space
51function sample(array $a)
52{
53}
54// return_type_declaration
55function bar(int $a) : string
56{
57};
58// whitespace_after_comma_in_array
59$sample = array(1,'a',$b,);
An exception for terminatinating execution or to throw for unit testing.
sampleMethod($a, $b=null)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples