Skip to content

Commit f109ac8

Browse files
committed
Updated Rector to commit 2415d9d1c79bf7c6d1e7124ff14e725b9c214ca2
rectorphp/rector-src@2415d9d fallback to var float (#7601)
1 parent 214ed0a commit f109ac8

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

rules/TypeDeclaration/Rector/Class_/TypedPropertyFromJMSSerializerAttributeTypeRector.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
use PhpParser\Node\Stmt\Class_;
1313
use PhpParser\Node\Stmt\Property;
1414
use PHPStan\Reflection\ClassReflection;
15+
use PHPStan\Type\FloatType;
1516
use PHPStan\Type\MixedType;
1617
use PHPStan\Type\ObjectType;
1718
use PHPStan\Type\StringType;
18-
use PHPStan\Type\Type;
1919
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
2020
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
2121
use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover;
@@ -122,14 +122,14 @@ public function provideMinPhpVersion(): int
122122
*/
123123
public function refactor(Node $node): ?Node
124124
{
125-
$hasChanged = \false;
126125
if (!$this->hasAtLeastOneUntypedPropertyUsingJmsAttribute($node)) {
127126
return null;
128127
}
129128
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
130129
if (!$classReflection instanceof ClassReflection) {
131130
return null;
132131
}
132+
$hasChanged = \false;
133133
foreach ($node->getProperties() as $property) {
134134
if ($this->shouldSkipProperty($property, $classReflection)) {
135135
continue;
@@ -187,12 +187,18 @@ private function createTypeNode(string $typeValue, Property $property): ?Node
187187
{
188188
if ($typeValue === 'float') {
189189
$propertyPhpDocInfo = $this->phpDocInfoFactory->createFromNode($property);
190-
if ($propertyPhpDocInfo instanceof PhpDocInfo) {
191-
// fallback to string, as most likely string representation of float
192-
if ($propertyPhpDocInfo->getVarType() instanceof StringType) {
193-
$this->varTagRemover->removeVarTag($property);
194-
return new Identifier('string');
195-
}
190+
// fallback to string, as most likely string representation of float
191+
if ($propertyPhpDocInfo instanceof PhpDocInfo && $propertyPhpDocInfo->getVarType() instanceof StringType) {
192+
$this->varTagRemover->removeVarTag($property);
193+
return new Identifier('string');
194+
}
195+
}
196+
if ($typeValue === 'string') {
197+
$propertyPhpDocInfo = $this->phpDocInfoFactory->createFromNode($property);
198+
// fallback to string, as most likely string representation of float
199+
if ($propertyPhpDocInfo instanceof PhpDocInfo && $propertyPhpDocInfo->getVarType() instanceof FloatType) {
200+
$this->varTagRemover->removeVarTag($property);
201+
return new Identifier('float');
196202
}
197203
}
198204
$type = $this->scalarStringToTypeMapper->mapScalarStringToType($typeValue);

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '31f46dd2fd98fe1c4f371419dde0e6c7ab105e40';
22+
public const PACKAGE_VERSION = '2415d9d1c79bf7c6d1e7124ff14e725b9c214ca2';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-10-28 20:12:05';
27+
public const RELEASE_DATE = '2025-10-28 20:28:59';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)