Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -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\.$#'
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ReturnTypeSniff implements Sniff
use MethodsTrait;

/**
* @var string
* @var null|int
*/
private $returnDoc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function process(File $phpcsFile, $stackPtr)
}

/**
* @return string[][]
* @phpstan-return array<int, array{ptrUse:int, name:string, ptrEnd:int, string:string, type:string}>
*/
private function getUseStatements(File $phpcsFile, int $scopePtr) : array
{
Expand Down Expand Up @@ -231,7 +231,7 @@ private function clearName(string $name) : string
}

/**
* @param string[][] $uses
* @phpstan-param array<int, array{ptrUse:int, name:string, ptrEnd:int, string:string, type:string}> $uses
*/
private function fixAlphabeticalOrder(File $phpcsFile, array $uses) : void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ private function import(string $type, string $fqn, string $alias) : array
}

/**
* @param string[][] $references
* @phpstan-param array<string, string> $references
*/
private function importReferences(File $phpcsFile, int $namespacePtr, array $references) : void
{
Expand Down