Closed MocioF closed 8 months ago
Please provide source code you've analyzed ! I can't find any issue, if I can't reproduce it with contextual data.
It's the code in my repo No-unsafe-inline/. I analyzed the code including the vendor dir (built with dev dependencies) and excluding node_modules. I will check if the issue is present while installing composer dependencies with --no-dev (In this second scenario I didn't see the error using the previous version). I will update this issue with more info in next days. Thanks for your work and your attention.
Checked an see your problem.
You've not analyzed your source code, but all code (source + vendors). And in your situation (squizlabs/php_codesniffer 3.9.0
is installed) with a test file that have declare
(strict_types) with case sensitive declaration.
See https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.3.inc#L3
I don't consider it's a major issue for CompatInfo, even if we may fix it easily, because I don't think that PHP developers will use in real condition this standard code format !
ok @llaville , thanks for your help. I think you are right because PHPCS is a dev tool, but I even think that it's normal to use your tool including vendor dir (even if in a build with --no-dev) because vendor dir is part of the deployed package and we need to analyze it to see what extensions and PHP versions are needed to run the software under analysis.
With PHP 8.1.26 while analyzing a codebase sent a warning:
74%PHP Warning: Undefined array key "Strict_Types" in [...]vendor/bartlett/php-compatinfo/src/Application/Sniffs/ControlStructures/DeclareSniff.php on line 66 And then it ended with error: [ERROR] Cannot analyse data source "[...]" for following reason(s)
str_replace(): Argument #3 ($subject) must be of type array|string, null given from file "[...]vendor/bartlett/php-compatinfo/src/Application/Sniffs/ControlStructures/DeclareSniff.php" at line 66
! [NOTE] Issue found by phpCompatInfo version 7.1.3@7a74bd0 with DB version
! 6.4.2@82c3db7