mirror of
https://github.com/danog/psalm-plugin.git
synced 2024-11-30 04:39:05 +01:00
chore: add compatibility with psalm 5
Signed-off-by: azjezz <azjezz@protonmail.com>
This commit is contained in:
parent
51f37a1c07
commit
dff80efbbf
@ -11,7 +11,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"vimeo/psalm": "^4.6"
|
"vimeo/psalm": "^4.20 || ^5.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"azjezz/psl": "<2.0"
|
"azjezz/psl": "<2.0"
|
||||||
@ -47,12 +47,15 @@
|
|||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"process-timeout": 1200,
|
"process-timeout": 1200,
|
||||||
"sort-packages": true
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"composer/package-versions-deprecated": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"psalm": {
|
"psalm": {
|
||||||
"pluginClass": "Psl\\Psalm\\Plugin"
|
"pluginClass": "Psl\\Psalm\\Plugin"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev"
|
"minimum-stability": "alpha"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<psalm totallyTyped="true" resolveFromConfigFile="true" forbidEcho="true" strictBinaryOperands="true" phpVersion="8.1" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" skipChecksOnUnresolvableIncludes="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
|
<psalm totallyTyped="true" resolveFromConfigFile="true" strictBinaryOperands="true" phpVersion="8.1" allowStringToStandInForClass="true" rememberPropertyAssignmentsAfterCall="false" skipChecksOnUnresolvableIncludes="false" checkForThrowsDocblock="true" checkForThrowsInGlobalScope="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
<ignoreFiles>
|
<ignoreFiles>
|
||||||
|
@ -39,7 +39,7 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
|||||||
if ($array_argument_type instanceof Type\Atomic\TNonEmptyList) {
|
if ($array_argument_type instanceof Type\Atomic\TNonEmptyList) {
|
||||||
$count = $array_argument_type->count;
|
$count = $array_argument_type->count;
|
||||||
if (null === $count) {
|
if (null === $count) {
|
||||||
return Type::getPositiveInt();
|
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type::getInt(false, $count);
|
return Type::getInt(false, $count);
|
||||||
@ -48,7 +48,7 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
|||||||
if ($array_argument_type instanceof Type\Atomic\TNonEmptyArray) {
|
if ($array_argument_type instanceof Type\Atomic\TNonEmptyArray) {
|
||||||
$count = $array_argument_type->count;
|
$count = $array_argument_type->count;
|
||||||
if (null === $count) {
|
if (null === $count) {
|
||||||
return Type::getPositiveInt();
|
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type::getInt(false, $count);
|
return Type::getInt(false, $count);
|
||||||
@ -62,17 +62,15 @@ final class FunctionReturnTypeProvider implements FunctionReturnTypeProviderInte
|
|||||||
// return Type::getInt(false, count($array_argument_type->properties));
|
// return Type::getInt(false, count($array_argument_type->properties));
|
||||||
|
|
||||||
if (count($array_argument_type->properties) >= 1) {
|
if (count($array_argument_type->properties) >= 1) {
|
||||||
return Type::getPositiveInt();
|
return new Type\Union([new Type\Atomic\TIntRange(1, null)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type::getInt();
|
return Type::getInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($array_argument_type instanceof Type\Atomic\TArray) {
|
if (($array_argument_type instanceof Type\Atomic\TArray) && $array_argument_type->type_params[0]->isNever() && $array_argument_type->type_params[1]->isNever()) {
|
||||||
if ($array_argument_type->type_params[0]->isEmpty() && $array_argument_type->type_params[1]->isEmpty()) {
|
|
||||||
return Type::getInt(false, 0);
|
return Type::getInt(false, 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Type::getInt();
|
return Type::getInt();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user