Skip to content

Commit 6711777

Browse files
committed
generalize non empty string
1 parent 1e75414 commit 6711777

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
codeQuality: true,
1414
codingStyle: true,
1515
typeDeclarations: true,
16+
typeDeclarationDocblocks: true,
1617
privatization: true,
1718
naming: true,
1819
instanceOf: true,

rules/Privatization/TypeManipulator/TypeNormalizer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Rector\Privatization\TypeManipulator;
66

77
use PHPStan\Type\Accessory\AccessoryLiteralStringType;
8+
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
89
use PHPStan\Type\Accessory\AccessoryNonFalsyStringType;
910
use PHPStan\Type\ArrayType;
1011
use PHPStan\Type\BooleanType;
@@ -57,7 +58,7 @@ public function generalizeConstantBoolTypes(Type $type): Type
5758
public function generalizeConstantTypes(Type $type): Type
5859
{
5960
return TypeTraverser::map($type, function (Type $type, callable $traverseCallback): Type {
60-
if ($type instanceof AccessoryNonFalsyStringType || $type instanceof AccessoryLiteralStringType) {
61+
if ($type instanceof AccessoryNonFalsyStringType || $type instanceof AccessoryLiteralStringType || $type instanceof AccessoryNonEmptyStringType) {
6162
return new StringType();
6263
}
6364

0 commit comments

Comments
 (0)