Differential D21032 Diff 50113 src/lint/linter/xhpast/rules/__tests__/class-name-literal/class-name-literal.lint-test
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/__tests__/class-name-literal/class-name-literal.lint-test
| <?php | <?php | ||||
| class MyClass { | class MyClass { | ||||
| public function someMethod() { | public function someMethod() { | ||||
| return 'MyClass'; | return 'MyClass'; | ||||
| } | } | ||||
| public function someOtherMethod() { | public function someOtherMethod() { | ||||
| $x = 'MyClass is awesome'; | $x = 'MyClass'; | ||||
| $y = 'MyClassIsAwesome'; | $y = 'MyClassIsAwesome'; | ||||
| $z = 'MyClass is awesome'; | |||||
| return __CLASS__; | return __CLASS__; | ||||
| } | } | ||||
| public function throwAnException() { | |||||
| throw new Exception('MyClass is throwing an exception!'); | |||||
| } | |||||
| } | } | ||||
| $c = new class { | $c = new class { | ||||
| public function someMethod() { | public function someMethod() { | ||||
| return __CLASS__; | return __CLASS__; | ||||
| } | } | ||||
| }; | }; | ||||
| ~~~~~~~~~~ | ~~~~~~~~~~ | ||||
| advice:5:12:XHP62:Class Name Literal | advice:5:12:XHP62:Class Name Literal | ||||
| advice:9:10:XHP62:Class Name Literal | advice:9:10:XHP62:Class Name Literal | ||||
| ~~~~~~~~~~ | ~~~~~~~~~~ | ||||
| <?php | <?php | ||||
| class MyClass { | class MyClass { | ||||
| public function someMethod() { | public function someMethod() { | ||||
| return __CLASS__; | return __CLASS__; | ||||
| } | } | ||||
| public function someOtherMethod() { | public function someOtherMethod() { | ||||
| $x = 'MyClass is awesome'; | $x = __CLASS__; | ||||
| $y = 'MyClassIsAwesome'; | $y = 'MyClassIsAwesome'; | ||||
| $z = 'MyClass is awesome'; | |||||
| return __CLASS__; | return __CLASS__; | ||||
| } | } | ||||
| public function throwAnException() { | |||||
| throw new Exception('MyClass is throwing an exception!'); | |||||
| } | |||||
| } | } | ||||
| $c = new class { | $c = new class { | ||||
| public function someMethod() { | public function someMethod() { | ||||
| return __CLASS__; | return __CLASS__; | ||||
| } | } | ||||
| }; | }; | ||||