rector/vendor/rector/rector-doctrine/rules/CodeQuality/Helper/NodeValueNormalizer.php
Tomas Votruba 055cd31f66 Updated Rector to commit 2ff0f08bd7f7f6c848821bcabf0872f81a9c440b
2ff0f08bd7 [PHP 8.0] Add always class to AnnotationToAttribute to include string to ::class reference conversion (#5619)
2024-02-14 19:28:57 +00:00

24 lines
485 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Doctrine\CodeQuality\Helper;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
final class NodeValueNormalizer
{
/**
* @param mixed $value
* @return mixed
*/
public static function normalize($value)
{
if (\is_bool($value)) {
return $value ? 'true' : 'false';
}
if (\is_numeric($value)) {
return $value;
}
return new StringNode($value);
}
}