1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
<?php
/* testInvalidTokenPassed */
echo MY_CONSTANT;
/* testClosure */
$closure = function() {};
/* testAnonClassWithParens */
$anonClass = new class() {};
/* testAnonClassWithParens2 */
$class = new class() {
private $property = 'test';
public function test() {}
};
/* testAnonClassWithoutParens */
$anonClass = new class {};
/* testAnonClassExtendsWithoutParens */
$class = new class extends SomeClass {
private $property = 'test';
public function test() {}
};
/* testFunction */
function functionName() {}
/* testFunctionReturnByRef */
function & functionNameByRef() {}
/* testClass */
abstract class ClassName {
/* testMethod */
public function methodName() {}
/* testAbstractMethod */
abstract protected function abstractMethodName();
/* testMethodReturnByRef */
private function &MethodNameByRef();
}
/* testExtendedClass */
class ExtendedClass extends Foo {}
/* testInterface */
interface InterfaceName {}
/* testTrait */
trait TraitName {
/* testFunctionEndingWithNumber */
function ValidNameEndingWithNumber5(){}
}
/* testClassWithNumber */
class ClassWith1Number implements SomeInterface {}
/* testInterfaceWithNumbers */
interface InterfaceWith12345Numbers extends AnotherInterface {}
/* testClassWithCommentsAndNewLines */
class /* comment */
// phpcs:ignore Standard.Cat.SniffName -- for reasons
ClassWithCommentsAndNewLines {}
/* testFunctionFn */
function fn() {}
/* testPureEnum */
enum Foo
{
case SOME_CASE;
}
/* testBackedEnumSpaceBetweenNameAndColon */
enum Hoo : string
{
case ONE = 'one';
case TWO = 'two';
}
/* testBackedEnumNoSpaceBetweenNameAndColon */
enum Suit: int implements Colorful, CardGame {}
/* testFunctionReturnByRefWithReservedKeywordEach */
function &each() {}
/* testFunctionReturnByRefWithReservedKeywordParent */
function &parent() {}
/* testFunctionReturnByRefWithReservedKeywordSelf */
function &self() {}
/* testFunctionReturnByRefWithReservedKeywordStatic */
function &static() {}
/* testLiveCoding */
// Intentional parse error. This has to be the last test in the file.
function // Comment.
|