Merge branch 'master' into suppress-redundant-casts

This commit is contained in:
Matthew Brown 2020-12-08 17:25:18 -05:00 committed by GitHub
commit 3029751dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 59 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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<string, Type\Atomic> 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();

View File

@ -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];