mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-13 12:33:52 +01:00
misc (#5805)
This commit is contained in:
parent
4d694008f6
commit
7f8d0d5af8
@ -152,7 +152,12 @@ final class TypeFactory
|
||||
$flattenItemTypes = TypeUtils::flattenTypes($constantArrayType->getItemType());
|
||||
|
||||
foreach ($flattenItemTypes as $position => $nestedFlattenItemType) {
|
||||
/** @var Type|null $nestedFlattenKeyType */
|
||||
$nestedFlattenKeyType = $flattenKeyTypes[$position];
|
||||
if ($nestedFlattenKeyType === null) {
|
||||
$nestedFlattenKeyType = new MixedType();
|
||||
}
|
||||
|
||||
$unwrappedTypes[] = new ArrayType($nestedFlattenKeyType, $nestedFlattenItemType);
|
||||
}
|
||||
|
||||
|
@ -636,3 +636,8 @@ parameters:
|
||||
- packages/static-type-mapper/src/ValueObject/Type/FullyQualifiedGenericObjectType.php
|
||||
|
||||
- '#(.*?) class\-string, string given#'
|
||||
|
||||
-
|
||||
message: '#Strict comparison using \=\=\= between PHPStan\\Type\\Type and null will always evaluate to false#'
|
||||
paths:
|
||||
- packages/node-type-resolver/src/PHPStan/Type/TypeFactory.php
|
||||
|
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\StaticCall;
|
||||
use PHPStan\Type\FloatType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Util\StaticInstanceOf;
|
||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
||||
@ -34,7 +35,7 @@ final class AssertEqualsToSameRector extends AbstractRector
|
||||
* - bool because this is taken care of AssertEqualsParameterToSpecificMethodsTypeRector
|
||||
* - null because this is taken care of AssertEqualsParameterToSpecificMethodsTypeRector
|
||||
*
|
||||
* @var array<class-string<\PHPStan\Type\Type>>
|
||||
* @var array<class-string<Type>>
|
||||
*/
|
||||
private const SCALAR_TYPES = [FloatType::class, IntegerType::class, StringType::class];
|
||||
|
||||
|
@ -89,7 +89,7 @@ final class AssertTrueFalseToSpecificMethodRector extends AbstractRector
|
||||
}
|
||||
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if ($firstArgumentValue instanceof StaticCall || $firstArgumentValue instanceof MethodCall) {
|
||||
if (! $firstArgumentValue instanceof FuncCall && ! $firstArgumentValue instanceof Empty_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -110,10 +110,11 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $onlyStmt->expr instanceof PropertyFetch) {
|
||||
$returnedExpr = $onlyStmt->expr;
|
||||
if (! $returnedExpr instanceof PropertyFetch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $onlyStmt->expr;
|
||||
return $returnedExpr;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user