PATH:
opt
/
cpanel
/
ea-wappspector
/
vendor
/
squizlabs
/
php_codesniffer
/
tests
/
Core
/
Tokenizers
/
PHP
<?php /* * Square brackets. */ /* testArrayAccess1 */ $var = $array[10]; $var = $array[++$y]/* testArrayAccess2 */[$x]; /* testArrayAssignment */ $array[] = $var; /* testFunctionCallDereferencing */ $var = function_call()[$x]; /* testMethodCallDereferencing */ $var = $obj->function_call()[$x]; /* testStaticMethodCallDereferencing */ $var = ClassName::function_call()[$x]; /* testPropertyDereferencing */ $var = $obj->property[2]; /* testPropertyDereferencingWithInaccessibleName */ $var = $ref->{'ref-type'}[1]; /* testStaticPropertyDereferencing */ $var ClassName::$property[2]; /* testStringDereferencing */ $var = 'PHP'[1]; /* testStringDereferencingDoubleQuoted */ $var = "PHP"[$y]; /* testConstantDereferencing */ $var = MY_CONSTANT[1]; /* testClassConstantDereferencing */ $var ClassName::CONSTANT_NAME[2]; /* testMagicConstantDereferencing */ $var = __FILE__[0]; /* testArrayAccessCurlyBraces */ $var = $array{'key'}['key']; /* testArrayLiteralDereferencing */ echo array(1, 2, 3)[0]; echo [1, 2, 3]/* testShortArrayLiteralDereferencing */[0]; /* testClassMemberDereferencingOnInstantiation1 */ (new foo)[0]; /* testClassMemberDereferencingOnInstantiation2 */ $a = (new Foo( array(1, array(4, 5), 3) ))[1][0]; /* testClassMemberDereferencingOnClone */ echo (clone $iterable)[20]; /* testNullsafeMethodCallDereferencing */ $var = $obj?->function_call()[$x]; /* testInterpolatedStringDereferencing */ $var = "PHP{$rocks}"[1]; /* testNewAnonClassNoParenthesesExpressionDereferencing */ $a = new class {}[0]; $a = new class (['value']) /* testNewAnonClassParenthesesExpressionDereferencing */ {}[0]; /* testNewAnonClassExtendsExpressionDereferencing */ $a = new readonly class extends ArrayObject {}[0]; /* testNewAnonClassImplementsExpressionDereferencing */ $a = new class implements ArrayAccess {}[0]; /* * Short array brackets. */ /* testShortArrayDeclarationEmpty */ $array = []; /* testShortArrayDeclarationWithOneValue */ $array = [1]; /* testShortArrayDeclarationWithMultipleValues */ $array = [1, 2, 3]; /* testShortArrayDeclarationWithDereferencing */ echo [1, 2, 3][0]; /* testShortListDeclaration */ [ $a, $b ] = $array; [ $a, $b, /* testNestedListDeclaration */, [$c, $d]] = $array; /* testArrayWithinFunctionCall */ $var = functionCall([$x, $y]); if ( true ) { /* testShortListDeclarationAfterBracedControlStructure */ [ $a ] = [ 'hi' ]; } if ( true ) /* testShortListDeclarationAfterNonBracedControlStructure */ [ $a ] = [ 'hi' ]; if ( true ) : /* testShortListDeclarationAfterAlternativeControlStructure */ [ $a ] = [ 'hi' ]; endif; class Foo extends ArrayObject {} /* testShortListDeclarationAfterClassDeclaration */ [$a] = ['hi']; /* testLiveCoding */ // Intentional parse error. This has to be the last test in the file. $array = [
[-] BackfillExplicitOctalNotationTest.php
[edit]
[-] PHPOpenTagEOF2Test.inc
[edit]
[-] BackfillEnumTest.inc
[edit]
[-] PHPOpenTagEOF1Test.php
[edit]
[-] BackfillAsymmetricVisibilityTest.php
[edit]
[-] EnumCaseTest.php
[edit]
[-] StableCommentWhitespaceTest.inc
[edit]
[-] HeredocNowdocTest.inc
[edit]
[-] TypeIntersectionTest.php
[edit]
[-] DNFTypesParseError2Test.php
[edit]
[-] TypeIntersectionTest.inc
[edit]
[-] NamedFunctionCallArgumentsTest.inc
[edit]
[-] TypedConstantsTest.inc
[edit]
[-] UndoNamespacedNameSingleTokenTest.php
[edit]
[-] BackfillFnTokenParseErrorTest.inc
[edit]
[+]
..
[-] StableCommentWhitespaceWinTest.php
[edit]
[-] DNFTypesTest.inc
[edit]
[-] DNFTypesParseError1Test.inc
[edit]
[-] BitwiseOrTest.php
[edit]
[-] BackfillFnTokenParseErrorTest.php
[edit]
[-] DoubleQuotedStringTest.php
[edit]
[-] BackfillReadonlyTest.inc
[edit]
[-] PHPOpenTagEOF1Test.inc
[edit]
[-] PHPOpenTagEOF2Test.php
[edit]
[-] BackfillNumericSeparatorTest.inc
[edit]
[-] ArrayKeywordTest.inc
[edit]
[-] BackfillMatchTokenTest.php
[edit]
[-] DoubleArrowTest.inc
[edit]
[-] HeredocStringTest.inc
[edit]
[-] GotoLabelTest.inc
[edit]
[-] OtherContextSensitiveKeywordsTest.php
[edit]
[-] StableCommentWhitespaceTest.php
[edit]
[-] NullsafeObjectOperatorTest.php
[edit]
[-] DNFTypesParseError1Test.php
[edit]
[-] AttributesTest.php
[edit]
[-] ExitKeywordTest.inc
[edit]
[-] HeredocParseErrorTest.php
[edit]
[-] AnonClassParenthesisOwnerTest.php
[edit]
[-] NullableVsInlineThenTest.inc
[edit]
[-] ArrayKeywordTest.php
[edit]
[-] NullsafeObjectOperatorTest.inc
[edit]
[-] BackfillExplicitOctalNotationTest.inc
[edit]
[-] ResolveSimpleTokenTest.inc
[edit]
[-] DNFTypesParseError2Test.inc
[edit]
[-] BackfillEnumTest.php
[edit]
[-] YieldTest.inc
[edit]
[-] BackfillReadonlyTest.php
[edit]
[-] HeredocNowdocTest.php
[edit]
[-] ShortArrayTest.inc
[edit]
[-] DefaultKeywordTest.php
[edit]
[-] StableCommentWhitespaceWinTest.inc
[edit]
[-] BitwiseOrTest.inc
[edit]
[-] DNFTypesTest.php
[edit]
[-] DoubleArrowTest.php
[edit]
[-] EnumCaseTest.inc
[edit]
[-] TypedConstantsTest.php
[edit]
[-] BackfillNumericSeparatorTest.php
[edit]
[-] BackfillFnTokenTest.php
[edit]
[-] FinallyTest.inc
[edit]
[-] HeredocStringTest.php
[edit]
[-] ShortArrayTest.php
[edit]
[-] BackfillMatchTokenTest.inc
[edit]
[-] NullableVsInlineThenTest.php
[edit]
[-] DoubleQuotedStringTest.inc
[edit]
[-] GotoLabelTest.php
[edit]
[-] ExitKeywordTest.php
[edit]
[-] HeredocParseErrorTest.inc
[edit]
[-] ResolveSimpleTokenTest.php
[edit]
[-] UndoNamespacedNameSingleTokenTest.inc
[edit]
[-] OtherContextSensitiveKeywordsTest.inc
[edit]
[-] NamedFunctionCallArgumentsTest.php
[edit]
[-] AnonClassParenthesisOwnerTest.inc
[edit]
[-] PHPOpenTagEOF3Test.inc
[edit]
[-] BackfillFnTokenTest.inc
[edit]
[-] BackfillAsymmetricVisibilityTest.inc
[edit]
[-] AttributesTest.inc
[edit]
[-] ContextSensitiveKeywordsTest.inc
[edit]
[-] FinallyTest.php
[edit]
[-] PHPOpenTagEOF3Test.php
[edit]
[-] YieldTest.php
[edit]
[-] DefaultKeywordTest.inc
[edit]
[-] ContextSensitiveKeywordsTest.php
[edit]