Differential D16357 Diff 39341 src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
Show First 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | foreach ($indexes as $index) { | ||||
'codebase targets an earlier version of PHP. You can rewrite '. | 'codebase targets an earlier version of PHP. You can rewrite '. | ||||
'this expression using `%s`.', | 'this expression using `%s`.', | ||||
'f()[...]', | 'f()[...]', | ||||
'idx()')); | 'idx()')); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
$literals = $root->selectDescendantsOftype('n_ARRAY_LITERAL'); | |||||
foreach ($literals as $literal) { | |||||
$open_token = head($literal->getTokens())->getValue(); | |||||
if ($open_token == '[') { | |||||
$this->raiseLintAtNode( | |||||
$literal, | |||||
pht( | |||||
'The short array syntax ("[...]") was not introduced until '. | |||||
'PHP 5.4, but this codebase targets an earlier version of PHP. '. | |||||
'You can rewrite this expression using `array(...)` instead.')); | |||||
} | |||||
} | |||||
$closures = $this->getAnonymousClosures($root); | $closures = $this->getAnonymousClosures($root); | ||||
foreach ($closures as $closure) { | foreach ($closures as $closure) { | ||||
$static_accesses = $closure | $static_accesses = $closure | ||||
->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); | ->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); | ||||
foreach ($static_accesses as $static_access) { | foreach ($static_accesses as $static_access) { | ||||
$class = $static_access->getChildByIndex(0); | $class = $static_access->getChildByIndex(0); | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |