diff --git a/.gitignore b/.gitignore index ff72e2d..d7d7822 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /composer.lock +/phpstan.neon /vendor diff --git a/composer.json b/composer.json index 4f53e3f..ba8b545 100644 --- a/composer.json +++ b/composer.json @@ -37,9 +37,11 @@ "composer/composer": "^2.9", "phpunit/phpunit": "^9.5", "symfony/process": "^6", - "dms/phpunit-arraysubset-asserts": "^0.5.0" + "dms/phpunit-arraysubset-asserts": "^0.5.0", + "phpstan/phpstan": "^2.1" }, "scripts": { + "phpstan": "phpstan", "test": [ "phpunit ./tests --debug" ] diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..b4d5053 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,7 @@ +parameters: + ignoreErrors: + - + message: '#^Instantiated class Tuf\\Tests\\FixtureBuilder\\Fixture not found\.$#' + identifier: class.notFound + count: 1 + path: tests/FunctionalTestBase.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..caa21c1 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,8 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 0 + paths: + - src + - tests diff --git a/src/ComposerFileStorage.php b/src/ComposerFileStorage.php index eab2171..ac89494 100644 --- a/src/ComposerFileStorage.php +++ b/src/ComposerFileStorage.php @@ -14,7 +14,7 @@ class ComposerFileStorage extends FileStorage /** * {@inheritDoc} */ - public function __construct(string $basePath) + final public function __construct(string $basePath) { (new Filesystem())->ensureDirectoryExists($basePath); parent::__construct($basePath); diff --git a/tests/FunctionalTestBase.php b/tests/FunctionalTestBase.php index eb8358e..1c0d54e 100644 --- a/tests/FunctionalTestBase.php +++ b/tests/FunctionalTestBase.php @@ -40,6 +40,8 @@ protected function setUp(): void mkdir($this->workingDir . '/tuf', recursive: true); // Make PHP-TUF's fixture builder available. + // @TODO: Consider moving the fixture builder to its own library that + // both php-tuf and composer-integration can pull in via require-dev. $loaders = ClassLoader::getRegisteredLoaders(); reset($loaders)->addPsr4('Tuf\\Tests\\', key($loaders) . '/php-tuf/php-tuf/tests');