mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-14 12:32:00 +02:00
Updated Rector to commit 2ec55701f292770fc7be3ca6e434d437e59c333b
2ec55701f2
[Performance] Fix filter cache on SkippedClassResolver (#5460)
This commit is contained in:
parent
bebd959a24
commit
8b20f236c0
@ -81,8 +81,8 @@ CODE_SAMPLE
|
||||
// only default → basically unwrap
|
||||
if (!$onlyCase->cond instanceof Expr) {
|
||||
// remove default clause because it cause syntax error
|
||||
return \array_filter($onlyCase->stmts, function (Stmt $statement) {
|
||||
return !$statement instanceof Break_;
|
||||
return \array_filter($onlyCase->stmts, static function (Stmt $stmt) : bool {
|
||||
return !$stmt instanceof Break_;
|
||||
});
|
||||
}
|
||||
$if = new If_(new Identical($node->cond, $onlyCase->cond));
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'ac072bc8af186b2c86256aa7d29e52bb608ece27';
|
||||
public const PACKAGE_VERSION = '2ec55701f292770fc7be3ca6e434d437e59c333b';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-01-12 00:00:19';
|
||||
public const RELEASE_DATE = '2024-01-13 08:42:30';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -9,23 +9,25 @@ use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
final class SkippedClassResolver
|
||||
{
|
||||
/**
|
||||
* @var array<string, string[]|null>
|
||||
* @var null|array<string, string[]|null>
|
||||
*/
|
||||
private $skippedClasses = [];
|
||||
private $skippedClasses = null;
|
||||
/**
|
||||
* @return array<string, string[]|null>
|
||||
*/
|
||||
public function resolve() : array
|
||||
{
|
||||
// disable cache in tests
|
||||
if (StaticPHPUnitEnvironment::isPHPUnitRun()) {
|
||||
// disable cache in tests
|
||||
$this->skippedClasses = [];
|
||||
$this->skippedClasses = null;
|
||||
}
|
||||
// skip cache in tests
|
||||
if ($this->skippedClasses !== []) {
|
||||
// already cached, even only empty array
|
||||
if ($this->skippedClasses !== null) {
|
||||
return $this->skippedClasses;
|
||||
}
|
||||
$skip = SimpleParameterProvider::provideArrayParameter(Option::SKIP);
|
||||
$this->skippedClasses = [];
|
||||
foreach ($skip as $key => $value) {
|
||||
// e.g. [SomeClass::class] → shift values to [SomeClass::class => null]
|
||||
if (\is_int($key)) {
|
||||
|
@ -34,7 +34,7 @@ final class SkippedPathsResolver
|
||||
if (StaticPHPUnitEnvironment::isPHPUnitRun()) {
|
||||
$this->skippedPaths = null;
|
||||
}
|
||||
// already filled, even empty array
|
||||
// already cached, even only empty array
|
||||
if ($this->skippedPaths !== null) {
|
||||
return $this->skippedPaths;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user