Page MenuHomePhabricator

Add a linter rule for extending Phobject
ClosedPublic

Authored by joshuaspence on Jun 13 2015, 11:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 12:43 AM
Unknown Object (File)
Fri, Apr 5, 12:40 AM
Unknown Object (File)
Feb 20 2024, 7:37 PM
Unknown Object (File)
Jan 27 2024, 8:59 AM
Unknown Object (File)
Jan 5 2024, 1:20 PM
Unknown Object (File)
Dec 26 2023, 9:28 PM
Unknown Object (File)
Dec 26 2023, 3:12 PM
Unknown Object (File)
Dec 25 2023, 11:06 AM
Subscribers

Details

Summary

If I understand correctly, all classes should extend from Phobject?

Test Plan

This needs some further work

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Add a linter rule for extending Phobject.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

Seems reasonable. Couple of inlines.

src/lint/linter/ArcanistPhutilXHPASTLinter.php
317–318

Do we need a check for Phobject itself here? I'd guess this might raise a silly "phobject must extend phobject" warning.

322

Maybe more clear as "...extend from Phobject or some other object.", to make it clear that "class B extends A {" is fine, just not "class B {".

This revision now requires changes to proceed.Jun 13 2015, 3:44 PM
joshuaspence edited edge metadata.

Add a check for Phobject

epriestley edited edge metadata.
epriestley added inline comments.
src/lint/linter/ArcanistPhutilXHPASTLinter.php
327

Maybe "...from some other class.", vs "other object."

This revision is now accepted and ready to land.Jun 14 2015, 1:55 PM
src/lint/linter/ArcanistPhutilXHPASTLinter.php
315

This isn't quite sufficient in the general case, see T8534.

This revision was automatically updated to reflect the committed changes.