mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-03-28 20:18:12 +01:00
Summary: Add a linter rule to advise against the use of hardcoded class names. Hardcoded class names make the code harder to refactor and it is generally preferable to use the `__CLASS__` magic constant instead. Test Plan: This works, but needs some polish. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12605
29 lines
472 B
Text
29 lines
472 B
Text
<?php
|
|
class MyClass {
|
|
public function someMethod() {
|
|
return 'MyClass';
|
|
}
|
|
|
|
public function someOtherMethod() {
|
|
$x = 'MyClass is awesome';
|
|
$y = 'MyClassIsAwesome';
|
|
return __CLASS__;
|
|
}
|
|
}
|
|
~~~~~~~~~~
|
|
error:2:7
|
|
advice:4:12
|
|
advice:8:10
|
|
~~~~~~~~~~
|
|
<?php
|
|
class MyClass {
|
|
public function someMethod() {
|
|
return __CLASS__;
|
|
}
|
|
|
|
public function someOtherMethod() {
|
|
$x = 'MyClass is awesome';
|
|
$y = 'MyClassIsAwesome';
|
|
return __CLASS__;
|
|
}
|
|
}
|