Updated Rector to commit 72c537af546dae8970b6db5f79f2a1e617db7f61

72c537af54 [Php80] Keep numeric string as is on StringAnnotationToAttributeMapper (#6608)
This commit is contained in:
Tomas Votruba 2024-12-18 11:25:16 +00:00
parent 6d48540b47
commit 480c133a14
2 changed files with 2 additions and 7 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '5e0f1ce34354497a5163bbd51dddf91cb5c82207'; public const PACKAGE_VERSION = '72c537af546dae8970b6db5f79f2a1e617db7f61';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-12-18 16:53:02'; public const RELEASE_DATE = '2024-12-18 18:22:50';
/** /**
* @var int * @var int
*/ */

View File

@ -6,7 +6,6 @@ namespace Rector\PhpAttribute\AnnotationToAttributeMapper;
use PhpParser\Node\Expr; use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Name; use PhpParser\Node\Name;
use PhpParser\Node\Scalar\Int_;
use PhpParser\Node\Scalar\String_; use PhpParser\Node\Scalar\String_;
use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface; use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
@ -36,10 +35,6 @@ final class StringAnnotationToAttributeMapper implements AnnotationToAttributeMa
if (\strtolower($value) === 'null') { if (\strtolower($value) === 'null') {
return new ConstFetch(new Name('null')); return new ConstFetch(new Name('null'));
} }
// number as string to number
if (\is_numeric($value) && \strlen((string) (int) $value) === \strlen($value)) {
return Int_::fromString($value);
}
if (\strpos($value, "'") !== \false && \strpos($value, "\n") === \false) { if (\strpos($value, "'") !== \false && \strpos($value, "\n") === \false) {
$kind = String_::KIND_DOUBLE_QUOTED; $kind = String_::KIND_DOUBLE_QUOTED;
} else { } else {