Skip to content

Commit

Permalink
composer-dependency-analyser: prepend PHPStan's PharAutoloader to avo…
Browse files Browse the repository at this point in the history
…id false reports
  • Loading branch information
janedbal committed Mar 4, 2024
1 parent 71f40d3 commit 7ee58d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
9 changes: 5 additions & 4 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php declare(strict_types = 1);

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

$config = new Configuration();
$pharFile = __DIR__ . '/vendor/phpstan/phpstan/phpstan.phar';
Phar::loadPhar($pharFile, 'phpstan.phar');

return $config
->ignoreErrorsOnPackage('phpstan/phpdoc-parser', [ErrorType::SHADOW_DEPENDENCY]); // it gets autoloaded from within the PHPStan.phar when running PHPStan
require_once('phar://phpstan.phar/preload.php'); // prepends PHPStan's PharAutolaoder to composer's autoloader

return new Configuration();
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"phpstan/phpstan-phpunit": "^1.1.1",
"phpstan/phpstan-strict-rules": "^1.2.3",
"phpunit/phpunit": "^9.5.20",
"shipmonk/composer-dependency-analyser": "^1.2.0",
"shipmonk/composer-dependency-analyser": "dev-support-more-loaders",
"shipmonk/name-collision-detector": "^2.0.0",
"slevomat/coding-standard": "^8.0.1"
},
Expand Down
18 changes: 10 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ee58d4

Please sign in to comment.