I'm not sure whether this is in any coding standards, but it seems to be an unspoken rule that methods should have a visiblity modifier (public, protected or private) explicitly specified. According to the PHP documentation, methods declared without any explicit visibility keyword are defined as public.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARC4f5203375e0b: Add a linter rule to detect implict method visibility
Added a test case.
Diff Detail
Diff Detail
- Repository
- rARC Arcanist
- Branch
- master
- Lint
Lint Passed - Unit
Test Failures - Build Status
Buildable 2809 Build 2813: [Placeholder Plan] Wait for 30 Seconds
Time | Test | |
---|---|---|
0 ms | testXHPASTLint | |
0 ms | testXMLLint | |
0 ms | testCSSLintLinter | |
0 ms | testClosureLinter | |
0 ms | testCoffeeLintLinter | |
View Full Test Results (2 Failed · 20 Passed · 5 Skipped) |
Event Timeline
Comment Actions
I think the unit test is not working as expected because of a bug in XHPAST. See https://secure.phabricator.com/xhpast/view/621/ for an example. It seems that in public function bar() {}, T_FUNCTION belongs to n_METHOD_DECLARATION but in function baz() {} this is not the case.
src/lint/linter/ArcanistXHPASTLinter.php | ||
---|---|---|
2856 | Shouldn't abstract or static methods have an explicit visibility? |