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
F14397565: D10537.id27579.diff
Sun, Dec 22, 10:46 AM
Unknown Object (File)
Sun, Dec 22, 1:55 AM
Unknown Object (File)
Sat, Dec 21, 4:34 PM
Unknown Object (File)
Tue, Dec 17, 11:31 PM
Unknown Object (File)
Tue, Dec 17, 10:29 AM
Unknown Object (File)
Tue, Dec 17, 7:47 AM
Unknown Object (File)
Tue, Dec 17, 5:31 AM
Unknown Object (File)
Sun, Dec 15, 5:12 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
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 3990
Build 4003: [Placeholder Plan] Wait for 30 Seconds

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.