Co-authored-by: Marek Šimeček <marek.simecek@footshop.cz>
This commit is contained in:
Marek Šimeček 2020-09-16 20:11:35 +02:00 committed by GitHub
parent 869441eb98
commit 3442308bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 11 deletions

View File

@ -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.

View File

@ -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();

View File

@ -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);

View File

@ -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);
};

View File

@ -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;

View File

@ -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
*/

View File

@ -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()