mirror of https://github.com/rectorphp/rector.git
[PHPStan] Update PHPStan to 0.12.95 (#724)
* [PHPStan] Update PHPStan to 0.12.95
* ignore new error message on explode and str_split
* Fixed 🎉
* phpstan
This commit is contained in:
parent
a1395e5841
commit
ea9cddd31b
|
@ -26,7 +26,7 @@ jobs:
|
|||
|
||||
-
|
||||
name: 'Along PHPStan'
|
||||
install: composer require phpstan/phpstan:^0.12.94 --dev --ansi
|
||||
install: composer require phpstan/phpstan:^0.12.95 --dev --ansi
|
||||
|
||||
name: "PHP ${{ matrix.php_version }}"
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": "^7.1|^8.0",
|
||||
"phpstan/phpstan": "0.12.94"
|
||||
"phpstan/phpstan": "0.12.95"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"nette/utils": "^3.2",
|
||||
"nikic/php-parser": "4.12.0",
|
||||
"phpstan/phpdoc-parser": "^0.5.5",
|
||||
"phpstan/phpstan": "0.12.94",
|
||||
"phpstan/phpstan": "0.12.95",
|
||||
"phpstan/phpstan-phpunit": "^0.12.21",
|
||||
"rector/extension-installer": "^0.11.0",
|
||||
"rector/rector-cakephp": "^0.11.3",
|
||||
|
|
12
phpstan.neon
12
phpstan.neon
|
@ -538,3 +538,15 @@ parameters:
|
|||
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
|
||||
- src/Application/FileProcessor.php
|
||||
- src/PhpParser/Node/BetterNodeFinder.php
|
||||
|
||||
-
|
||||
message: '#Parameter \#1 \$separator of function explode expects non\-empty\-string, string given#'
|
||||
paths:
|
||||
- rules/PSR4/FileRelocationResolver.php
|
||||
- rules/Privatization/Rector/Class_/RepeatedLiteralToClassConstantRector.php
|
||||
- rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
|
||||
|
||||
-
|
||||
message: '#Parameter \#2 \$length of function str_split expects int<1, max\>, int given#'
|
||||
paths:
|
||||
- rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
|
||||
|
|
|
@ -5,7 +5,9 @@ declare(strict_types=1);
|
|||
namespace Rector\Privatization\TypeManipulator;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PHPStan\Type\Accessory\NonEmptyArrayType;
|
||||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\IntersectionType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
|
@ -36,9 +38,30 @@ final class NormalizeTypeToRespectArrayScalarType
|
|||
return new ArrayType($type, $type);
|
||||
}
|
||||
|
||||
if ($type instanceof ArrayType) {
|
||||
return $this->resolveArrayType($type);
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
private function resolveArrayType(ArrayType $arrayType): ArrayType
|
||||
{
|
||||
$itemType = $arrayType->getItemType();
|
||||
if (! $itemType instanceof IntersectionType) {
|
||||
return $arrayType;
|
||||
}
|
||||
|
||||
$types = $itemType->getTypes();
|
||||
foreach ($types as $key => $itemTypeType) {
|
||||
if ($itemTypeType instanceof NonEmptyArrayType) {
|
||||
unset($types[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayType($arrayType->getKeyType(), new IntersectionType($types));
|
||||
}
|
||||
|
||||
private function normalizeUnionType(UnionType $unionType): UnionType
|
||||
{
|
||||
$normalizedTypes = [];
|
||||
|
|
Loading…
Reference in New Issue