wapmorgan/PhpCodeAnalyzer

False positive

skyzyx opened this issue · 1 comments

I ran:

php www/bin/phpca www/src/ --since-version=7.2 | tee reports/phpca-src.txt

I got the following response, which identified this class: Pool

Scanning www/src/ ...
[pthreads] Class "Pool" used in file www/src/path/to/file[84]

Used non-built-in extensions in your code:
- pthreads. Extension is available in pecl: pthreads.

However, this is a snippet of my actual code, which is clearly not from the pthreads extension.

use GuzzleHttp\Pool;

$pool = new Pool($client, $requests(), [
    'concurrency' => 10,
    'fulfilled'   => static function ($response, $index): void { … },
    'rejected'    => static function ($reason, $index): void { … },
]);

Here is the version information:

$ composer info wapmorgan/php-code-analyzer -d www
name     : wapmorgan/php-code-analyzer
descrip. : A program that finds usage of different non-built-in extensions in your php code.
keywords : code analysis, command-line utility
versions : * dev-master
type     : package
license  : BSD 3-Clause "New" or "Revised" License (BSD-3-Clause) (OSI approved) https://spdx.org/licenses/BSD-3-Clause.html#licenseText
source   : [git] https://github.com/wapmorgan/PhpCodeAnalyzer.git b778f61ee24b9e97b92422d853a37a350bde69a5
dist     : [zip] https://api.github.com/repos/wapmorgan/PhpCodeAnalyzer/zipball/b778f61ee24b9e97b92422d853a37a350bde69a5 b778f61ee24b9e97b92422d853a37a350bde69a5
names    : wapmorgan/php-code-analyzer

autoload
psr-4
wapmorgan\PhpCodeAnalyzer\ => src/

requires
docopt/docopt ~1.0

Perhaps resolving the namespace aliases first could reduce the false positives?

Yes, but this require a lot of work and restructuring. I don't have time for this now.