This isn't available on all systems, e.g. Fedora just uses "php". People
with multiple versions of PHP installed can use an alternatives system
or something to make sure PHP 7 is used.
Change-Id: I03ef7c2d4223ade32f7a89c3a88706ae8c6e8156
When running tests with:
PHAN=/path/to/phan/phan /path/to/mediawiki-core/tests/phan/bin/phan
the script changes to the home dir (does "cd" with no param),
which results in git error message (unless the home dir happens
to be a git repository).
Change-Id: Ib11e419fb5cca51ceaed0e9c7c86ae9c5c4ae0f2
Rather than duplicating the phan and postprocess-phan.php scripts
into extensions, this allows passing the path to the extension
(or skin, or whichever) to the phan script and it will run the analysis
for that project.
Individual projects will need a tests/phan/config.php file that defines
how the analysis will run in their project.
Bug: T153040
Change-Id: I58ad44f6a8769088e87d5d6cf1079e633c082f88
Adds the functionality of per-line @suppress annotations. Phan already
supports per-class or per-method annotations, but does not have any
per-line support due to the PHP AST only returning comments that are
class/property/method level docblocks.
This is a bit of a hack, but get's the job done. Removes the
PhanTypeInvalidLeftOperand issue from blacklist and suppresses it
to demonstrate the supression works as expected.
Change-Id: I5066b3b431fb69175a711ee366e95f31c7c47639
Running against mediawiki core phan needs around 1GB of memory
per process. >4GB is too excessive for a default setting. Instead
set the default to 1 process and add the ability for users to
select more processes on the command line.
Bug: T132636
Change-Id: I3d9fa462916fba519fe6d7f1916f881eefb6a942
Adds the necessary configuration and stubs for phan static analysis to
run against mediawiki core. A variety of fixes have been applied to core
recently such with this current configuration we are completely passing,
except for one issue with a bug in Phan (https://github.com/etsy/phan/issues/286)
In it's current configuration Phan will detect fatal errors trying to
access non existant classes, undefined method calls, and other errors.
The analysis can be expanded as we cleanup more of the codebase. This
is in preparation for working on getting the CI to run phan as part of
the review process. I have found phan to be usefull in CirrusSearch
(although with stricter config) for catching bugs and I think it could
help in core as well.
We arn't too far from being able to disable `null_casts_as_any_type`,
there are only a few classes that need adjusting. Lots more work needs
to be done to reduce `minimum_severity` from 10 to 5 (normal) or
0 (low).
Change-Id: Iafd55b1380f37d7b0d195eed081f8042166690e8