@PER-CS2.0.test-in.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?
  2. namespace Vendor\Package;
  3. use const BAR;
  4. use function foo;
  5. use \FooInterfaceA, FooInterfaceB;
  6. use \BarClass as Bar;
  7. use OtherVendor\OtherPackage\BazClass;
  8. class Foo extends Bar implements FooInterfaceA{
  9. var $aaa = 1, $bbb = 2;
  10. public function sampleFunction($a, $arg1, $arg2, $arg3, $foo, $b = null)
  11. {
  12. if ($a === $b) {
  13. bar();
  14. } else if ($a > $b) {
  15. $foo->bar($arg1);
  16. } else {
  17. BazClass::bar($arg2, $arg3);
  18. }
  19. $combined = $a.$b;
  20. STATIC::baz();
  21. }
  22. use FooTrait, BarTrait;
  23. static public final function bar() {
  24. // method body
  25. }
  26. }
  27. class Aaa implements
  28. Bbb, Ccc,
  29. Ddd
  30. {
  31. }
  32. $a = new Foo;
  33. $b = ( boolean ) 1;
  34. $c = true ? (INT) '1' : 2;
  35. $anonymousClass = new class () {
  36. public function test() {
  37. // method body
  38. }
  39. };
  40. $fn = fn ($a) => $a;
  41. $arrayNotMultiline = ['foo' => 'bar', 'foo2' => 'bar'];
  42. $arrayMultiline = [
  43. 'foo' => 'bar',
  44. 'foo2' => 'bar',
  45. ];
  46. $arrayMultilineWithoutComma = [
  47. 'foo' => 'bar',
  48. 'foo2' => 'bar'
  49. ];
  50. $heredocMultilineWithoutComma = [
  51. 'foo',
  52. <<<EOD
  53. bar
  54. EOD
  55. ];
  56. argumentsMultilineWithoutComma(
  57. 1,
  58. 2
  59. );
  60. ?>