Merge pull request #91 from psalm/psalm-v4

Get ready for Psalm v4
This commit is contained in:
Matthew Brown 2020-10-13 00:55:52 -04:00 committed by GitHub
commit 562a1812ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -14,12 +14,12 @@
"sort-packages": true "sort-packages": true
}, },
"require": { "require": {
"php": "^7.1.3 || ^8.0", "php": "^7.3 || ^8.0",
"ext-simplexml": "*", "ext-simplexml": "*",
"composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/package-versions-deprecated": "^1.10", "composer/package-versions-deprecated": "^1.10",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0", "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0",
"vimeo/psalm": "^3.6.2 || dev-master || dev-4.x" "vimeo/psalm": "dev-master || dev-4.x"
}, },
"require-dev": { "require-dev": {
"codeception/codeception": "^4.0.3", "codeception/codeception": "^4.0.3",

View File

@ -343,7 +343,7 @@ class TestCaseHandler implements
} }
}; };
/** @var Type\Atomic\TArray|Type\Atomic\ObjectLike|Type\Atomic\TList $dataset_type */ /** @var Type\Atomic\TArray|Type\Atomic\TKeyedArray|Type\Atomic\TList $dataset_type */
$dataset_type = self::getAtomics($provider_return_type->type_params[1])['array']; $dataset_type = self::getAtomics($provider_return_type->type_params[1])['array'];
if ($dataset_type instanceof Type\Atomic\TArray) { if ($dataset_type instanceof Type\Atomic\TArray) {
@ -363,7 +363,7 @@ class TestCaseHandler implements
} }
$checkParam($potential_argument_type, $param->type, $param->is_optional, $param_offset); $checkParam($potential_argument_type, $param->type, $param->is_optional, $param_offset);
} }
} else { // ObjectLike } else { // TKeyedArray
// iterate over all params checking if corresponding value type is acceptable // iterate over all params checking if corresponding value type is acceptable
// let's hope properties are sorted in array order // let's hope properties are sorted in array order
$potential_argument_types = array_values($dataset_type->properties); $potential_argument_types = array_values($dataset_type->properties);
@ -449,7 +449,7 @@ class TestCaseHandler implements
if ($type instanceof Type\Atomic\TArray) { if ($type instanceof Type\Atomic\TArray) {
$key_types[] = $type->type_params[0] ?? Type::getMixed(); $key_types[] = $type->type_params[0] ?? Type::getMixed();
$value_types[] = $type->type_params[1] ?? Type::getMixed(); $value_types[] = $type->type_params[1] ?? Type::getMixed();
} elseif ($type instanceof Type\Atomic\ObjectLike) { } elseif ($type instanceof Type\Atomic\TKeyedArray) {
$key_types[] = $type->getGenericKeyType(); $key_types[] = $type->getGenericKeyType();
$value_types[] = $type->getGenericValueType(); $value_types[] = $type->getGenericValueType();
} elseif ($type instanceof Type\Atomic\TNamedObject || $type instanceof Type\Atomic\TIterable) { } elseif ($type instanceof Type\Atomic\TNamedObject || $type instanceof Type\Atomic\TIterable) {