Tomas Votruba 9ec874fb89 Updated Rector to commit 15d93fa8158bdbfdbb1965e4e749e7cd68f79bbf
15d93fa815 [DeadCode] Handle combine RemoveAlwaysTrueIfConditionRector + RemoveDeadConstructorRector (#2324)
2022-05-17 09:51:50 +00:00

48 lines
1.4 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RectorPrefix20220517\Symfony\Component\Config\Definition;
use RectorPrefix20220517\Symfony\Component\Config\Definition\Exception\InvalidTypeException;
/**
* This node represents a float value in the config tree.
*
* @author Jeanmonod David <david.jeanmonod@gmail.com>
*/
class FloatNode extends \RectorPrefix20220517\Symfony\Component\Config\Definition\NumericNode
{
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
{
// Integers are also accepted, we just cast them
if (\is_int($value)) {
$value = (float) $value;
}
if (!\is_float($value)) {
$ex = new \RectorPrefix20220517\Symfony\Component\Config\Definition\Exception\InvalidTypeException(\sprintf('Invalid type for path "%s". Expected "float", but got "%s".', $this->getPath(), \get_debug_type($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
$ex->setPath($this->getPath());
throw $ex;
}
}
/**
* {@inheritdoc}
*/
protected function getValidPlaceholderTypes() : array
{
return ['float'];
}
}