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
Tests Passed - Build Status
Buildable 3580 Build 3588: [Placeholder Plan] Wait for 30 Seconds
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 | ||
---|---|---|
3014 | Shouldn't abstract or static methods have an explicit visibility? |