Skip to content

Commit

Permalink
CI: Fix phpstan analysis with decomposer
Browse files Browse the repository at this point in the history
PHPUnit doesn't use PSR-0 or PSR-4, but a classmap autoloader,
and decomposer doesn't support those. Therefore we have to load
the dependencies manually when using decomposer :(
  • Loading branch information
pprkut committed Feb 8, 2025
1 parent b72b76b commit b7d8673
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 2 additions & 3 deletions decomposer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
"PHPUnit": {
"url": "https://github.com/sebastianbergmann/phpunit.git",
"version": "10.5.38",
"psr4": {
"prefix": "PHPUnit",
"search-path": "/src/"
"psr0": {
"path": "/src/"
}
}
}
13 changes: 12 additions & 1 deletion tests/phpstan.autoload.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,23 @@
}
else
{
// Load decomposer autoloade.
// Load decomposer autoloader.
$autoload_file = $base . '/decomposer.autoload.inc.php';
}

require_once $autoload_file;

if (file_exists($base . '/vendor/autoload.php') == FALSE)
{
include_once 'Framework/MockObject/Runtime/Interface/Stub.php';
include_once 'Framework/MockObject/Runtime/Interface/MockObject.php';
include_once 'Framework/Assert.php';
include_once 'Framework/Reorderable.php';
include_once 'Framework/SelfDescribing.php';
include_once 'Framework/Test.php';
include_once 'Framework/TestCase.php';
}

// Define application config lookup path
$paths = [
get_include_path(),
Expand Down

0 comments on commit b7d8673

Please sign in to comment.