diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ee7ecabd..777f8d3d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -113,5 +113,8 @@ Please also check the code structure using PHPMD: vendor/bin/phpmd Classes/ text Configuration/PHPMD/rules.xml +And also please run the static code analysis: + + vendor/bin/phpstan analyse -l 5 Classes/ Tests/ Please make your code clean, well-readable and easy to understand. diff --git a/.travis.yml b/.travis.yml index 27d587a8..fe09d0ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,11 @@ script: echo "Running the integration tests"; vendor/bin/phpunit Tests/Integration/; + - > + echo; + echo "Running the static analysis"; + vendor/bin/phpstan analyse -l 5 Classes/ Tests/; + - > echo; echo "Running PHPMD"; diff --git a/Classes/Core/Bootstrap.php b/Classes/Core/Bootstrap.php index 8e20816c..7b962060 100644 --- a/Classes/Core/Bootstrap.php +++ b/Classes/Core/Bootstrap.php @@ -20,7 +20,7 @@ class Bootstrap { /** - * @var Bootstrap + * @var Bootstrap|null */ private static $instance = null; diff --git a/Tests/Integration/Domain/Repository/Identity/AdministratorTokenRepositoryTest.php b/Tests/Integration/Domain/Repository/Identity/AdministratorTokenRepositoryTest.php index c3e05691..f91578b6 100644 --- a/Tests/Integration/Domain/Repository/Identity/AdministratorTokenRepositoryTest.php +++ b/Tests/Integration/Domain/Repository/Identity/AdministratorTokenRepositoryTest.php @@ -3,6 +3,7 @@ namespace PhpList\PhpList4\Tests\Integration\Domain\Repository\Identity; +use Doctrine\Common\Persistence\ObjectRepository; use PhpList\PhpList4\Core\Bootstrap; use PhpList\PhpList4\Domain\Model\Identity\AdministratorToken; use PhpList\PhpList4\Domain\Repository\Identity\AdministratorTokenRepository; @@ -41,7 +42,7 @@ class AdministratorTokenRepositoryTest extends TestCase private $dataSet = null; /** - * @var AdministratorTokenRepository + * @var AdministratorTokenRepository|ObjectRepository */ private $subject = null; diff --git a/composer.json b/composer.json index 70b2607d..ff88f49c 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "phpunit/phpunit": "^6.2.2", "phpunit/dbunit": "^3.0.0", "squizlabs/php_codesniffer": "^3.0.1", + "phpstan/phpstan": "^0.7.0", "phpmd/phpmd": "^2.6.0" }, "suggest": { @@ -57,6 +58,11 @@ "core/helper/Shortcuts.php" ] }, + "autoload-dev": { + "psr-4": { + "PhpList\\PhpList4\\Tests\\": "Tests/" + } + }, "extra": { "branch-alias": { "dev-master": "4.0.0-dev"