Page MenuHomePhabricator

Add a linter rule to detect call-time pass-by-reference
ClosedPublic

Authored by joshuaspence on Sep 22 2014, 1:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 3:31 AM
Unknown Object (File)
Fri, Apr 5, 3:38 PM
Unknown Object (File)
Thu, Apr 4, 1:10 PM
Unknown Object (File)
Mar 21 2024, 10:25 AM
Unknown Object (File)
Mar 21 2024, 12:53 AM
Unknown Object (File)
Feb 16 2024, 4:50 AM
Unknown Object (File)
Feb 16 2024, 4:50 AM
Unknown Object (File)
Feb 16 2024, 4:50 AM
Subscribers

Details

Summary

Call-time pass-by-reference is an awful "feature" of PHP that is deprecated and removed in PHP 5.4 (see http://us1.php.net/manual/en/migration54.incompatible.php). Add a linter rule to ArcanistXHPASTLinter to detect the use of this feature and raise an error.

Test Plan

Added a test case for arc unit.

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 to detect call-time pass-by-refernce.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

I'm not quite sure why this isn't working as is, possibly an issue with XHPAST?

Assertion failed, expected values to be equal (at ArcanistLinterTestCase.php:130): Some linters failed:
    - ArcanistXHPASTLinter: Exception: No type name for node type ID '0' in 'XHP' AAST.

#0 /home/joshua/workspace/github.com/phacility/arcanist/src/lint/linter/__tests__/ArcanistLinterTestCase.php(100): ArcanistLintEngine->run()
#1 /home/joshua/workspace/github.com/phacility/arcanist/src/lint/linter/__tests__/ArcanistLinterTestCase.php(16): ArcanistLinterTestCase->lintFile('/home/joshua/wo...', Object(ArcanistXHPASTLinter))
#2 /home/joshua/workspace/github.com/phacility/arcanist/src/lint/linter/__tests__/ArcanistXHPASTLinterTestCase.php(9): ArcanistLinterTestCase->executeTestsInDirectory('/home/joshua/wo...', Object(ArcanistXHPASTLinter))
#3 [internal function]: ArcanistXHPASTLinterTestCase->testXHPASTLint()
#4 /home/joshua/workspace/github.com/phacility/arcanist/src/unit/engine/phutil/ArcanistPhutilTestCase.php(484): call_user_func_array(Array, Array)
#5 /home/joshua/workspace/github.com/phacility/arcanist/src/unit/engine/PhutilUnitTestEngine.php(58): ArcanistPhutilTestCase->run()
#6 /home/joshua/workspace/github.com/phacility/arcanist/src/workflow/ArcanistUnitWorkflow.php(171): PhutilUnitTestEngine->run()
#7 /home/joshua/workspace/github.com/phacility/arcanist/scripts/arcanist.php(338): ArcanistUnitWorkflow->run()
#8 {main}
Expected: false
  Actual: true
joshuaspence retitled this revision from Add a linter rule to detect call-time pass-by-refernce to Add a linter rule to detect call-time pass-by-reference.Sep 22 2014, 1:53 PM
joshuaspence updated this object.
joshuaspence edited edge metadata.

Rebase (still not working though)

epriestley edited edge metadata.
This revision is now accepted and ready to land.Jan 22 2015, 8:56 PM
This revision was automatically updated to reflect the committed changes.