2021-10-05 15:59:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare (strict_types=1);
|
|
|
|
namespace Rector\Strict\Rector;
|
|
|
|
|
|
|
|
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
|
|
|
use Rector\Core\Rector\AbstractRector;
|
2021-12-10 00:25:09 +00:00
|
|
|
use RectorPrefix20211210\Webmozart\Assert\Assert;
|
2021-10-05 15:59:39 +00:00
|
|
|
/**
|
|
|
|
* @see \Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector\BooleanInBooleanNotRuleFixerRectorTest
|
|
|
|
*/
|
|
|
|
abstract class AbstractFalsyScalarRuleFixerRector extends \Rector\Core\Rector\AbstractRector implements \Rector\Core\Contract\Rector\ConfigurableRectorInterface
|
|
|
|
{
|
|
|
|
/**
|
2021-12-10 00:25:09 +00:00
|
|
|
* @deprecated
|
2021-10-05 15:59:39 +00:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public const TREAT_AS_NON_EMPTY = 'treat_as_non_empty';
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $treatAsNonEmpty = \false;
|
|
|
|
/**
|
2021-11-28 17:01:20 +00:00
|
|
|
* @param mixed[] $configuration
|
2021-10-05 15:59:39 +00:00
|
|
|
*/
|
2021-12-10 09:57:54 +00:00
|
|
|
public function configure($configuration) : void
|
2021-10-05 15:59:39 +00:00
|
|
|
{
|
|
|
|
$treatAsNonEmpty = $configuration[self::TREAT_AS_NON_EMPTY] ?? \false;
|
2021-12-10 00:25:09 +00:00
|
|
|
\RectorPrefix20211210\Webmozart\Assert\Assert::boolean($treatAsNonEmpty);
|
2021-10-05 15:59:39 +00:00
|
|
|
$this->treatAsNonEmpty = $treatAsNonEmpty;
|
|
|
|
}
|
|
|
|
}
|