diff --git a/.travis.yml b/.travis.yml index b76a0a95..c2bbce32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,6 +66,12 @@ install: script: - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi + - | + if [[ $(phpenv version-name) == '7.3' ]]; then + composer require --dev "phpstan/phpstan:^0.12.7" + wget -qO- https://github.com/squizlabs/PHP_CodeSniffer/commit/2ecd8dc15364cdd6e5089e82ffef2b205c98c412.patch | patch -d vendor/squizlabs/php_codesniffer/ -p 1 + vendor/bin/phpstan analyze + fi after_script: - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..e8459bc3 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,18 @@ +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon +parameters: + level: 2 +# TODO Reach level MAX! +# level: 4 +# level: max + inferPrivatePropertyTypeFromConstructor: true + paths: + - src/ +# TODO Test tests! +# - test/ + autoload_files: + - vendor/squizlabs/php_codesniffer/autoload.php + ignoreErrors: + # TODO These are way too easy to fix! + - '#^Access to an undefined property WebimpressCodingStandard\\\S+\.$#' + - '#^Variable \$\S+ might not be defined\.$#' diff --git a/src/WebimpressCodingStandard/Sniffs/Functions/ReturnTypeSniff.php b/src/WebimpressCodingStandard/Sniffs/Functions/ReturnTypeSniff.php index c556b6ca..5ac1191d 100644 --- a/src/WebimpressCodingStandard/Sniffs/Functions/ReturnTypeSniff.php +++ b/src/WebimpressCodingStandard/Sniffs/Functions/ReturnTypeSniff.php @@ -96,7 +96,7 @@ class ReturnTypeSniff implements Sniff use MethodsTrait; /** - * @var string + * @var int|null */ private $returnDoc; diff --git a/src/WebimpressCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php b/src/WebimpressCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php index 340caf8c..266ce46c 100644 --- a/src/WebimpressCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php +++ b/src/WebimpressCodingStandard/Sniffs/Namespaces/AlphabeticallySortedUsesSniff.php @@ -147,7 +147,7 @@ public function process(File $phpcsFile, $stackPtr) } /** - * @return string[][] + * @return array */ private function getUseStatements(File $phpcsFile, int $scopePtr) : array { @@ -231,7 +231,7 @@ private function clearName(string $name) : string } /** - * @param string[][] $uses + * @param array $uses */ private function fixAlphabeticalOrder(File $phpcsFile, array $uses) : void { diff --git a/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php b/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php index 4997588c..21e9cc02 100644 --- a/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php +++ b/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php @@ -594,7 +594,7 @@ private function import(string $type, string $fqn, string $alias) : array } /** - * @param string[][] $references + * @param array $references */ private function importReferences(File $phpcsFile, int $namespacePtr, array $references) : void {