rector/rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php
Tomas Votruba 12c115e6f6 Updated Rector to commit 5193d43b644f9d059d9964ebcc6820181a7bca18
5193d43b64 [NodeTypeResolver] Remove unnecessary loop SourceLocator collection on DynamicSourceLocatorProvider (#5852)
2024-05-02 02:21:56 +00:00

35 lines
988 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Strict\Rector;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Rector\AbstractScopeAwareRector;
use RectorPrefix202405\Webmozart\Assert\Assert;
/**
* @see \Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector\BooleanInBooleanNotRuleFixerRectorTest
*
* @internal
*/
abstract class AbstractFalsyScalarRuleFixerRector extends AbstractScopeAwareRector implements ConfigurableRectorInterface
{
/**
* @api
* @var string
*/
public const TREAT_AS_NON_EMPTY = 'treat_as_non_empty';
/**
* @var bool
*/
protected $treatAsNonEmpty = \false;
/**
* @param mixed[] $configuration
*/
public function configure(array $configuration) : void
{
$treatAsNonEmpty = $configuration[self::TREAT_AS_NON_EMPTY] ?? (bool) \current($configuration);
Assert::boolean($treatAsNonEmpty);
$this->treatAsNonEmpty = $treatAsNonEmpty;
}
}