From c336c33fa9b4e58db1f93fa6ca908f873046b93f Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 24 Nov 2020 05:53:07 +0200 Subject: [PATCH 1/4] Disable Travis Travis CI seems to be continuosly lowering it's OSS jobs cap, so the feedback loop is getting slower and slower. Github CI appears to be working just fine, so I propose to complete the switch. --- .travis.yml | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .travis.yml 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" From aa35347b260c7b4f7351d0670b406ac81ded0ab9 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 25 Nov 2020 05:34:33 +0200 Subject: [PATCH 2/4] Dropped travis.yml from .gitattributes And added .github --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 66ee3852cd6e25fee2bcb53743de05f4ae360a61 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 5 Dec 2020 07:49:50 +0200 Subject: [PATCH 3/4] Suppressed more redundant casts The issue name keeps changing --- src/Hooks/TestCaseHandler.php | 22 ++++++++++++++++++---- src/VersionUtils.php | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Hooks/TestCaseHandler.php b/src/Hooks/TestCaseHandler.php index 7d49980..5395dc3 100644 --- a/src/Hooks/TestCaseHandler.php +++ b/src/Hooks/TestCaseHandler.php @@ -183,6 +183,10 @@ class TestCaseHandler implements } $apparent_provider_method_name = $fq_class_name . '::' . $method_id; } else { + /** + * @psalm-suppress RedundantConditionGivenDocblockType + * @psalm-suppress RedundantCastGivenDocblockType + */ $apparent_provider_method_name = $class_storage->name . '::' . (string) $provider; } @@ -427,10 +431,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,6 +594,10 @@ class TestCaseHandler implements { if (method_exists($docblock, 'getStartLine')) { //typecasting is done on purpose, compatability with psalm old versions + /** + * @psalm-suppress RedundantCondition + * @psalm-suppress RedundantCast + */ return (int) $docblock->getStartLine(); } /** @psalm-suppress DeprecatedMethod */ diff --git a/src/VersionUtils.php b/src/VersionUtils.php index 8a37b45..1ec2e6e 100644 --- a/src/VersionUtils.php +++ b/src/VersionUtils.php @@ -13,6 +13,8 @@ abstract class VersionUtils /** * @psalm-suppress DeprecatedClass * @psalm-suppress ArgumentTypeCoercion + * @psalm-suppress RedundantCast + * @psalm-suppress RedundantCondition */ $currentVersion = (string) explode('@', Versions::getVersion($package))[0]; From 9ac6bdbe3470293d4850a56b7391ac76340e5f4d Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 1 Dec 2020 14:30:59 +0100 Subject: [PATCH 4/4] Move phpunit to devRequirement --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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"