mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-05 10:50:48 +00:00
055cd31f66
2ff0f08bd7
[PHP 8.0] Add always class to AnnotationToAttribute to include string to ::class reference conversion (#5619)
24 lines
485 B
PHP
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);
|
|
}
|
|
}
|