mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
5ec4cff203
[Php56] Handle jump not Expression stmt next initialized on AddDefaultValueForUndefinedVariableRector (#2725)
33 lines
962 B
PHP
33 lines
962 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Strict\Rector;
|
|
|
|
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
|
use Rector\Core\Rector\AbstractRector;
|
|
use RectorPrefix202208\Webmozart\Assert\Assert;
|
|
/**
|
|
* @see \Rector\Tests\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector\BooleanInBooleanNotRuleFixerRectorTest
|
|
*/
|
|
abstract class AbstractFalsyScalarRuleFixerRector extends AbstractRector 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;
|
|
}
|
|
}
|