mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-02 01:10:53 +00:00
Caching (#4237)
Co-authored-by: Marek Šimeček <marek.simecek@footshop.cz>
This commit is contained in:
parent
869441eb98
commit
3442308bba
|
@ -4861,7 +4861,7 @@ Remove null coalescing operator ??=
|
|||
### `DowngradeTypedPropertyRector`
|
||||
|
||||
- class: [`Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector`](/rules/downgrade-php74/src/Rector/Property/DowngradeTypedPropertyRector.php)
|
||||
- [test fixtures](/rules/downgrade-php74/tests/Rector/Property/DowngradeTypedPropertyRector/Fixture)
|
||||
- [test fixtures](/rules/downgrade-php74/tests/Rector/Property/NoDocBlockDowngradeTypedPropertyRector/Fixture)
|
||||
|
||||
Changes property type definition from type definitions to `@var` annotations.
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use PHPStan\File\FileHelper;
|
|||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use Rector\Caching\Cache\Adapter\FilesystemAdapterFactory;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
|
||||
|
@ -18,7 +19,7 @@ use function Symfony\Component\DependencyInjection\Loader\Configurator\ref;
|
|||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set('is_cache_enabled', false);
|
||||
$parameters->set(Option::ENABLE_CACHE, false);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
|
|
|
@ -142,10 +142,12 @@ final class PHPStanNodeScopeResolver
|
|||
} else {
|
||||
$node->setAttribute(AttributeKey::SCOPE, $scope);
|
||||
}
|
||||
|
||||
$this->resolveDependentFiles($node, $scope);
|
||||
};
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
$this->resolveDependentFiles($node, $scope);
|
||||
}
|
||||
|
||||
/** @var MutatingScope $scope */
|
||||
$this->nodeScopeResolver->processNodes($nodes, $scope, $nodeCallback);
|
||||
|
||||
|
|
|
@ -61,4 +61,5 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
# so Rector code is still PHP 7.2 compatible
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, '7.2');
|
||||
$parameters->set(Option::ENABLE_CACHE, true);
|
||||
};
|
||||
|
|
|
@ -108,14 +108,14 @@ final class Configuration
|
|||
*/
|
||||
public function __construct(
|
||||
CiDetector $ciDetector,
|
||||
bool $isCacheEnabled,
|
||||
bool $enableCache,
|
||||
array $fileExtensions,
|
||||
array $paths,
|
||||
OnlyRuleResolver $onlyRuleResolver,
|
||||
ParameterProvider $parameterProvider
|
||||
) {
|
||||
$this->ciDetector = $ciDetector;
|
||||
$this->isCacheEnabled = $isCacheEnabled;
|
||||
$this->isCacheEnabled = $enableCache;
|
||||
$this->fileExtensions = $fileExtensions;
|
||||
$this->paths = $paths;
|
||||
$this->onlyRuleResolver = $onlyRuleResolver;
|
||||
|
|
|
@ -81,6 +81,16 @@ final class Option
|
|||
*/
|
||||
public const OPTION_CLEAR_CACHE = 'clear-cache';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ENABLE_CACHE = 'enable_cache';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CACHE_DEBUG = 'cache-debug';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -101,11 +111,6 @@ final class Option
|
|||
*/
|
||||
public const PROJECT_TYPE_OPEN_SOURCE_UNDESCORED = 'open_source';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const CACHE_DEBUG = 'cache-debug';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
|
@ -293,9 +293,14 @@ final class ProcessCommand extends AbstractCommand
|
|||
return;
|
||||
}
|
||||
|
||||
if ($this->configuration->shouldClearCache()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->rectorNodeTraverser->hasZeroCacheRectors()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = sprintf(
|
||||
'Ruleset contains %d rules that need "--clear-cache" option to analyse full project',
|
||||
$this->rectorNodeTraverser->getZeroCacheRectorCount()
|
||||
|
|
Loading…
Reference in New Issue
Block a user