diff --git a/.gitattributes b/.gitattributes index 6346d59..cfe9c38 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,6 @@ /.gitignore export-ignore /phpcs.xml.dist export-ignore /psalm.xml.dist export-ignore -/.travis.yml export-ignore /README.md export-ignore /codeception.yml export-ignore +/.github export-ignore diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5df36b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -language: php -php: - - 7.3 - - 7.4 - - nightly -before_install: - - phpenv config-rm xdebug.ini || true - -install: - - composer config --global discard-changes true - - travis_retry composer install - - if [[ "$DEPS" = 'high' || "$DEPS" = 'dev' ]]; then travis_retry composer $DEFAULT_COMPOSER_FLAGS update; fi - - if [[ "$DEPS" = 'high' ]]; then composer require $DEFAULT_COMPOSER_FLAGS --prefer-stable --update-with-dependencies vimeo/psalm; fi - - if [[ "$DEPS" = 'low' ]]; then travis_retry composer $DEFAULT_COMPOSER_FLAGS --prefer-lowest --prefer-stable update; fi - - if [[ "$DEPS" = 'stable' ]]; then travis_retry composer $DEFAULT_COMPOSER_FLAGS --prefer-stable update; fi - - ./vendor/bin/psalm --version - -script: composer check - -env: - global: - - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-suggest" - jobs: - - DEPS="low" - - DEPS="high" - - DEPS="stable" - - DEPS="dev" - -cache: - directories: - - $HOME/.composer/cache/files - - $HOME/.composer/cache/vcs - -jobs: - allow_failures: - - php: 7.1 - env: DEPS="dev" - - php: 7.2 - env: DEPS="dev" - - php: 7.3 - env: DEPS="dev" - - php: 7.4 - env: DEPS="dev" - - php: nightly - env: DEPS="low" - - php: nightly - env: DEPS="high" - - php: nightly - env: DEPS="stable" - - php: nightly - env: DEPS="dev" diff --git a/composer.json b/composer.json index 38a60c7..f4a9dda 100755 --- a/composer.json +++ b/composer.json @@ -18,12 +18,15 @@ "ext-simplexml": "*", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/package-versions-deprecated": "^1.10", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0", "vimeo/psalm": "dev-master || dev-4.x || ^4.0" }, + "conflict": { + "phpunit/phpunit": "<7.5" + }, "require-dev": { "php": "^7.3 || ^8.0", "codeception/codeception": "^4.0.3", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0", "squizlabs/php_codesniffer": "^3.3.1", "weirdan/codeception-psalm-module": "^0.11.0", "weirdan/prophecy-shim": "^1.0 || ^2.0" diff --git a/src/Hooks/TestCaseHandler.php b/src/Hooks/TestCaseHandler.php index 7220ff7..892c8e2 100644 --- a/src/Hooks/TestCaseHandler.php +++ b/src/Hooks/TestCaseHandler.php @@ -427,10 +427,16 @@ class TestCaseHandler implements return $union->getAtomicTypes(); } - /** @psalm-suppress DeprecatedMethod annotated for newer versions that deprecated the method */ - $types = $union->getTypes(); - assert(!empty($types)); - return $types; + if (method_exists($union, 'getTypes')) { + /** + * @psalm-suppress DeprecatedMethod annotated for newer versions that deprecated the method + * @var non-empty-array annotated for versions missing the method + */ + $types = $union->getTypes(); + return $types; + } + + throw new RuntimeException('Unexpected: union has no way to get it constituent types'); } private static function unionizeIterables(Codebase $codebase, Type\Union $iterables): Type\Atomic\TIterable @@ -584,8 +590,7 @@ class TestCaseHandler implements { if (method_exists($docblock, 'getStartLine')) { //typecasting is done on purpose, compatability with psalm old versions - /** @psalm-suppress RedundantCondition */ - return (int) $docblock->getStartLine(); + return $docblock->getStartLine(); } /** @psalm-suppress DeprecatedMethod */ return $docblock->getLine(); diff --git a/src/VersionUtils.php b/src/VersionUtils.php index 9ffa048..5cab8f0 100644 --- a/src/VersionUtils.php +++ b/src/VersionUtils.php @@ -14,6 +14,8 @@ abstract class VersionUtils * @psalm-suppress RedundantCondition * @psalm-suppress DeprecatedClass * @psalm-suppress ArgumentTypeCoercion + * @psalm-suppress RedundantCast + * @psalm-suppress RedundantCondition */ $currentVersion = (string) explode('@', Versions::getVersion($package))[0];