Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14081017
D12853.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12853.diff
View Options
diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php
--- a/src/lint/linter/ArcanistXHPASTLinter.php
+++ b/src/lint/linter/ArcanistXHPASTLinter.php
@@ -3872,7 +3872,11 @@
->selectDescendantsOfType('n_CLASS_STATIC_ACCESS');
foreach ($static_accesses as $static_access) {
- $called_class = $static_access->getChildOfType(0, 'n_CLASS_NAME');
+ $called_class = $static_access->getChildByIndex(0);
+
+ if ($called_class->getTypeName() != 'n_CLASS_NAME') {
+ continue;
+ }
if ($called_class->getConcreteString() == 'parent') {
$this->raiseLintAtNode(
diff --git a/src/lint/linter/__tests__/xhpast/no-parent-scope.lint-test b/src/lint/linter/__tests__/xhpast/no-parent-scope.lint-test
--- a/src/lint/linter/__tests__/xhpast/no-parent-scope.lint-test
+++ b/src/lint/linter/__tests__/xhpast/no-parent-scope.lint-test
@@ -10,6 +10,10 @@
public function __construct() {
parent::__construct(null);
}
+
+ public function someMethod($x) {
+ echo $x::SOME_CONSTANT;
+ }
}
~~~~~~~~~~
error:11:5
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 6:09 PM (18 h, 57 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6778400
Default Alt Text
D12853.diff (1 KB)
Attached To
Mode
D12853: Improve the "invalid parent scope" linter rule
Attached
Detach File
Event Timeline
Log In to Comment