Page MenuHomePhabricator

D13840.diff
No OneTemporary

D13840.diff

diff --git a/src/lint/linter/__tests__/xhpast/useless-overriding-method.lint-test b/src/lint/linter/__tests__/xhpast/useless-overriding-method.lint-test
--- a/src/lint/linter/__tests__/xhpast/useless-overriding-method.lint-test
+++ b/src/lint/linter/__tests__/xhpast/useless-overriding-method.lint-test
@@ -16,6 +16,10 @@
public function anotherMethod($x, &$y) {
return parent::anotherMethod($x, $y);
}
+
+ public function usefulMethodWithDefaultValue($x = null) {
+ return parent::usefulMethodWithDefaultValue($x);
+ }
}
~~~~~~~~~~
error:3:13
diff --git a/src/lint/linter/xhpast/rules/ArcanistUselessOverridingMethodXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistUselessOverridingMethodXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistUselessOverridingMethodXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistUselessOverridingMethodXHPASTLinterRule.php
@@ -26,12 +26,17 @@
$parameters = array();
foreach ($parameter_list->getChildren() as $parameter) {
+ $default = $parameter->getChildByIndex(2);
$parameter = $parameter->getChildByIndex(1);
if ($parameter->getTypeName() == 'n_VARIABLE_REFERENCE') {
$parameter = $parameter->getChildOfType(0, 'n_VARIABLE');
}
+ if ($default->getTypeName() != 'n_EMPTY') {
+ continue 2;
+ }
+
$parameters[] = $parameter->getConcreteString();
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 7:02 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7712737
Default Alt Text
D13840.diff (1 KB)

Event Timeline