Updated Rector to commit 0d55791128825909273d0cdd9743470236748d75

0d55791128 Fix downgrade build: exclude vendor/symplify/easy-parallel/ecs.php on parallel lint (#5584)
This commit is contained in:
Tomas Votruba 2024-02-08 04:24:11 +00:00
parent dfd0ac8201
commit e79510ae2b
24 changed files with 256 additions and 224 deletions

View File

@ -3,91 +3,8 @@
declare (strict_types=1);
namespace RectorPrefix202402;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\Config\Level\DeadCodeLevel;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector;
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
use Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnExprInConstructRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector;
use Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
use Rector\DeadCode\Rector\Expression\SimplifyMirrorAssignRector;
use Rector\DeadCode\Rector\For_\RemoveDeadContinueRector;
use Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector;
use Rector\DeadCode\Rector\For_\RemoveDeadLoopRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
use Rector\DeadCode\Rector\FunctionLike\RemoveDeadReturnRector;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector;
use Rector\DeadCode\Rector\If_\RemoveTypedPropertyDeadInstanceOfRector;
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
use Rector\DeadCode\Rector\If_\SimplifyIfElseWithSameContentRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
use Rector\DeadCode\Rector\Plus\RemoveDeadZeroAndOneOperationRector;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
use Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
use Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([
UnwrapFutureCompatibleIfPhpVersionRector::class,
RecastingRemovalRector::class,
RemoveDeadStmtRector::class,
RemoveDuplicatedArrayKeyRector::class,
RemoveUnusedForeachKeyRector::class,
RemoveParentCallWithoutParentRector::class,
RemoveEmptyClassMethodRector::class,
RemoveDoubleAssignRector::class,
SimplifyMirrorAssignRector::class,
RemoveUnusedPrivatePropertyRector::class,
RemoveUnusedPrivateClassConstantRector::class,
RemoveUnusedPrivateMethodRector::class,
RemoveDeadReturnRector::class,
RemoveDeadContinueRector::class,
RemoveDeadIfForeachForRector::class,
RemoveAndTrueRector::class,
RemoveConcatAutocastRector::class,
SimplifyUselessVariableRector::class,
RemoveDuplicatedCaseInSwitchRector::class,
RemoveNullPropertyInitializationRector::class,
RemoveUnreachableStatementRector::class,
SimplifyIfElseWithSameContentRector::class,
TernaryToBooleanOrFalseToBooleanAndRector::class,
RemoveDeadTryCatchRector::class,
RemoveUnusedVariableAssignRector::class,
RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
RemoveDeadConditionAboveReturnRector::class,
RemoveUnusedConstructorParamRector::class,
RemoveDeadInstanceOfRector::class,
RemoveTypedPropertyDeadInstanceOfRector::class,
RemoveDeadLoopRector::class,
RemoveUnusedPrivateMethodParameterRector::class,
// docblock
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveNonExistingVarAnnotationRector::class,
RemoveUselessVarTagRector::class,
RemoveUnusedPromotedPropertyRector::class,
RemoveAlwaysTrueIfConditionRector::class,
RemoveDeadZeroAndOneOperationRector::class,
RemovePhpVersionIdCheckRector::class,
RemoveUselessReturnExprInConstructRector::class,
]);
$rectorConfig->rules(DeadCodeLevel::RULES);
};

View File

@ -3,43 +3,10 @@
declare (strict_types=1);
namespace RectorPrefix202402;
use Rector\Config\Level\TypeDeclarationLevel;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\Class_\MergeDateTimePropertyTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Class_\PropertyTypeFromStrictSetterGetterRector;
use Rector\TypeDeclaration\Rector\Class_\ReturnTypeFromStrictTernaryRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationBasedOnParentClassMethodRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rules([AddArrowFunctionReturnTypeRector::class, ParamTypeByMethodCallTypeRector::class, TypedPropertyFromAssignsRector::class, AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, ReturnTypeFromStrictTypedPropertyRector::class, TypedPropertyFromStrictConstructorRector::class, AddClosureVoidReturnTypeWhereNoReturnRector::class, AddFunctionVoidReturnTypeWhereNoReturnRector::class, AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromStrictFluentReturnRector::class, ReturnTypeFromReturnNewRector::class, AddMethodCallBasedStrictParamTypeRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class, ReturnTypeFromStrictScalarReturnExprRector::class, ReturnTypeFromStrictParamRector::class, TypedPropertyFromStrictSetUpRector::class, ParamTypeByParentCallTypeRector::class, AddParamTypeSplFixedArrayRector::class, AddParamTypeBasedOnPHPUnitDataProviderRector::class, AddParamTypeFromPropertyTypeRector::class, AddReturnTypeDeclarationFromYieldsRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictTypedCallRector::class, ReturnNeverTypeRector::class, EmptyOnNullableObjectToInstanceOfRector::class, PropertyTypeFromStrictSetterGetterRector::class, ReturnTypeFromStrictTernaryRector::class, BoolReturnTypeFromStrictScalarReturnsRector::class, NumericReturnTypeFromStrictScalarReturnsRector::class, StrictArrayParamDimFetchRector::class, ReturnUnionTypeRector::class, StrictStringParamConcatRector::class, MergeDateTimePropertyTypeDeclarationRector::class]);
// the rule order matters, as its used in withTypeCoverageLevel() method
// place the safest rules first, follow by more complex ones
$rectorConfig->rules(TypeDeclarationLevel::RULES);
};

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '1a3ddfb9a41b2b7230a9fb8f26eb075d3a1c6c38';
public const PACKAGE_VERSION = '0d55791128825909273d0cdd9743470236748d75';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-02-07 23:04:51';
public const RELEASE_DATE = '2024-02-08 04:22:04';
/**
* @var int
*/

View File

@ -1,7 +1,7 @@
<?php
declare (strict_types=1);
namespace Rector\Configuration\Levels;
namespace Rector\Config\Level;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\Contract\Rector\RectorInterface;
@ -64,7 +64,7 @@ final class DeadCodeLevel
*
* @var array<class-string<RectorInterface>>
*/
public const RULE_LIST = [
public const RULES = [
// easy picks
RemoveUnusedForeachKeyRector::class,
RemoveDuplicatedArrayKeyRector::class,

View File

@ -1,8 +1,9 @@
<?php
declare (strict_types=1);
namespace Rector\Configuration\Levels;
namespace Rector\Config\Level;
use Rector\Contract\Rector\RectorInterface;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\Class_\MergeDateTimePropertyTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\Class_\PropertyTypeFromStrictSetterGetterRector;
@ -10,19 +11,24 @@ use Rector\TypeDeclaration\Rector\Class_\ReturnTypeFromStrictTernaryRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeBasedOnPHPUnitDataProviderRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationBasedOnParentClassMethodRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictParamRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
@ -31,27 +37,18 @@ use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
/**
* Key 0 = level 0
* Key 50 = level 50
*
* Start at 0, go slowly higher, one level per PR, and improve your type coverage
*
* From the safest rules to more changing ones.
* @experimental Since 0.19.7 This list can change in time, based on community feedback,
* what rules are safer than other. The safest rules will be always in the top.
*/
final class TypeCoverageLevel
final class TypeDeclarationLevel
{
/**
* Mind that return type declarations are the safest to add,
* followed by property, then params
* The rule order matters, as its used in withTypeCoverageLevel() method
* Place the safest rules first, follow by more complex ones
*
* @var array<class-string>
* @var array<class-string<RectorInterface>>
*/
public const RULE_LIST = [
public const RULES = [
// php 7.0
// start with closure first, as safest
AddClosureVoidReturnTypeWhereNoReturnRector::class,
@ -69,6 +66,7 @@ final class TypeCoverageLevel
// php 7.4
TypedPropertyFromStrictConstructorRector::class,
ReturnTypeFromReturnDirectArrayRector::class,
ReturnTypeFromStrictTypedPropertyRector::class,
AddParamTypeSplFixedArrayRector::class,
AddReturnTypeDeclarationFromYieldsRector::class,
AddParamTypeBasedOnPHPUnitDataProviderRector::class,
@ -89,5 +87,10 @@ final class TypeCoverageLevel
PropertyTypeFromStrictSetterGetterRector::class,
StrictArrayParamDimFetchRector::class,
StrictStringParamConcatRector::class,
ParamTypeByMethodCallTypeRector::class,
TypedPropertyFromAssignsRector::class,
AddReturnTypeDeclarationBasedOnParentClassMethodRector::class,
ReturnTypeFromStrictFluentReturnRector::class,
ReturnNeverTypeRector::class,
];
}

View File

@ -4,10 +4,10 @@ declare (strict_types=1);
namespace Rector\Configuration;
use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface;
use Rector\Config\Level\DeadCodeLevel;
use Rector\Config\Level\TypeDeclarationLevel;
use Rector\Config\RectorConfig;
use Rector\Configuration\Levels\DeadCodeLevel;
use Rector\Configuration\Levels\LevelRulesResolver;
use Rector\Configuration\Levels\TypeCoverageLevel;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Contract\Rector\RectorInterface;
use Rector\Doctrine\Set\DoctrineSetList;
@ -494,7 +494,7 @@ final class RectorConfigBuilder
public function withDeadCodeLevel(int $level) : self
{
$this->isDeadCodeLevelUsed = \true;
$levelRules = LevelRulesResolver::resolve($level, DeadCodeLevel::RULE_LIST, 'RectorConfig::withDeadCodeLevel()');
$levelRules = LevelRulesResolver::resolve($level, DeadCodeLevel::RULES, 'RectorConfig::withDeadCodeLevel()');
$this->rules = \array_merge($this->rules, $levelRules);
return $this;
}
@ -505,7 +505,7 @@ final class RectorConfigBuilder
public function withTypeCoverageLevel(int $level) : self
{
$this->isTypeCoverageLevelUsed = \true;
$levelRules = LevelRulesResolver::resolve($level, TypeCoverageLevel::RULE_LIST, 'RectorConfig::withTypeCoverageLevel()');
$levelRules = LevelRulesResolver::resolve($level, TypeDeclarationLevel::RULES, 'RectorConfig::withTypeCoverageLevel()');
$this->rules = \array_merge($this->rules, $levelRules);
return $this;
}

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232::getLoader();
return ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478::getLoader();

View File

@ -417,6 +417,8 @@ return array(
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Diagnoser' => $vendorDir . '/fidry/cpu-core-counter/src/Diagnoser.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Executor\\ProcOpenExecutor' => $vendorDir . '/fidry/cpu-core-counter/src/Executor/ProcOpenExecutor.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Executor\\ProcessExecutor' => $vendorDir . '/fidry/cpu-core-counter/src/Executor/ProcessExecutor.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CmiCmdletLogicalFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/CmiCmdletLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CmiCmdletPhysicalFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/CmiCmdletPhysicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CpuCoreFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/CpuCoreFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CpuInfoFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/CpuInfoFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\DummyCpuCoreFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/DummyCpuCoreFinder.php',
@ -428,9 +430,11 @@ return array(
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NProcFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/NProcFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NProcessorFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/NProcessorFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NullCpuCoreFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/NullCpuCoreFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\OnlyInPowerShellFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/OnlyInPowerShellFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\OnlyOnOSFamilyFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/OnlyOnOSFamilyFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\ProcOpenBasedFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/ProcOpenBasedFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\SkipOnOSFamilyFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/SkipOnOSFamilyFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WindowsRegistryLogicalFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/WindowsRegistryLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WmicLogicalFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/WmicLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WmicPhysicalFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/WmicPhysicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\_NProcessorFinder' => $vendorDir . '/fidry/cpu-core-counter/src/Finder/_NProcessorFinder.php',
@ -1170,12 +1174,12 @@ return array(
'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => $baseDir . '/src/Comments/NodeDocBlock/DocBlockUpdater.php',
'Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser' => $baseDir . '/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php',
'Rector\\Comments\\NodeVisitor\\CommentRemovingNodeVisitor' => $baseDir . '/src/Comments/NodeVisitor/CommentRemovingNodeVisitor.php',
'Rector\\Config\\Level\\DeadCodeLevel' => $baseDir . '/src/Config/Level/DeadCodeLevel.php',
'Rector\\Config\\Level\\TypeDeclarationLevel' => $baseDir . '/src/Config/Level/TypeDeclarationLevel.php',
'Rector\\Config\\RectorConfig' => $baseDir . '/src/Config/RectorConfig.php',
'Rector\\Configuration\\ConfigInitializer' => $baseDir . '/src/Configuration/ConfigInitializer.php',
'Rector\\Configuration\\ConfigurationFactory' => $baseDir . '/src/Configuration/ConfigurationFactory.php',
'Rector\\Configuration\\Levels\\DeadCodeLevel' => $baseDir . '/src/Configuration/Levels/DeadCodeLevel.php',
'Rector\\Configuration\\Levels\\LevelRulesResolver' => $baseDir . '/src/Configuration/Levels/LevelRulesResolver.php',
'Rector\\Configuration\\Levels\\TypeCoverageLevel' => $baseDir . '/src/Configuration/Levels/TypeCoverageLevel.php',
'Rector\\Configuration\\Option' => $baseDir . '/src/Configuration/Option.php',
'Rector\\Configuration\\Parameter\\SimpleParameterProvider' => $baseDir . '/src/Configuration/Parameter/SimpleParameterProvider.php',
'Rector\\Configuration\\PhpLevelSetResolver' => $baseDir . '/src/Configuration/PhpLevelSetResolver.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232
class ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitc583cd9db12694da4a6881390cc7f232::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitc583cd9db12694da4a6881390cc7f232::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitc583cd9db12694da4a6881390cc7f232
class ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -631,6 +631,8 @@ class ComposerStaticInitc583cd9db12694da4a6881390cc7f232
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Diagnoser' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Diagnoser.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Executor\\ProcOpenExecutor' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Executor/ProcOpenExecutor.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Executor\\ProcessExecutor' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Executor/ProcessExecutor.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CmiCmdletLogicalFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/CmiCmdletLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CmiCmdletPhysicalFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/CmiCmdletPhysicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CpuCoreFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/CpuCoreFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\CpuInfoFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/CpuInfoFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\DummyCpuCoreFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/DummyCpuCoreFinder.php',
@ -642,9 +644,11 @@ class ComposerStaticInitc583cd9db12694da4a6881390cc7f232
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NProcFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/NProcFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NProcessorFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/NProcessorFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\NullCpuCoreFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/NullCpuCoreFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\OnlyInPowerShellFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/OnlyInPowerShellFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\OnlyOnOSFamilyFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/OnlyOnOSFamilyFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\ProcOpenBasedFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/ProcOpenBasedFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\SkipOnOSFamilyFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/SkipOnOSFamilyFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WindowsRegistryLogicalFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/WindowsRegistryLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WmicLogicalFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/WmicLogicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\WmicPhysicalFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/WmicPhysicalFinder.php',
'RectorPrefix202402\\Fidry\\CpuCoreCounter\\Finder\\_NProcessorFinder' => __DIR__ . '/..' . '/fidry/cpu-core-counter/src/Finder/_NProcessorFinder.php',
@ -1384,12 +1388,12 @@ class ComposerStaticInitc583cd9db12694da4a6881390cc7f232
'Rector\\Comments\\NodeDocBlock\\DocBlockUpdater' => __DIR__ . '/../..' . '/src/Comments/NodeDocBlock/DocBlockUpdater.php',
'Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser' => __DIR__ . '/../..' . '/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php',
'Rector\\Comments\\NodeVisitor\\CommentRemovingNodeVisitor' => __DIR__ . '/../..' . '/src/Comments/NodeVisitor/CommentRemovingNodeVisitor.php',
'Rector\\Config\\Level\\DeadCodeLevel' => __DIR__ . '/../..' . '/src/Config/Level/DeadCodeLevel.php',
'Rector\\Config\\Level\\TypeDeclarationLevel' => __DIR__ . '/../..' . '/src/Config/Level/TypeDeclarationLevel.php',
'Rector\\Config\\RectorConfig' => __DIR__ . '/../..' . '/src/Config/RectorConfig.php',
'Rector\\Configuration\\ConfigInitializer' => __DIR__ . '/../..' . '/src/Configuration/ConfigInitializer.php',
'Rector\\Configuration\\ConfigurationFactory' => __DIR__ . '/../..' . '/src/Configuration/ConfigurationFactory.php',
'Rector\\Configuration\\Levels\\DeadCodeLevel' => __DIR__ . '/../..' . '/src/Configuration/Levels/DeadCodeLevel.php',
'Rector\\Configuration\\Levels\\LevelRulesResolver' => __DIR__ . '/../..' . '/src/Configuration/Levels/LevelRulesResolver.php',
'Rector\\Configuration\\Levels\\TypeCoverageLevel' => __DIR__ . '/../..' . '/src/Configuration/Levels/TypeCoverageLevel.php',
'Rector\\Configuration\\Option' => __DIR__ . '/../..' . '/src/Configuration/Option.php',
'Rector\\Configuration\\Parameter\\SimpleParameterProvider' => __DIR__ . '/../..' . '/src/Configuration/Parameter/SimpleParameterProvider.php',
'Rector\\Configuration\\PhpLevelSetResolver' => __DIR__ . '/../..' . '/src/Configuration/PhpLevelSetResolver.php',
@ -2662,9 +2666,9 @@ class ComposerStaticInitc583cd9db12694da4a6881390cc7f232
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitc583cd9db12694da4a6881390cc7f232::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc583cd9db12694da4a6881390cc7f232::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc583cd9db12694da4a6881390cc7f232::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1b339dc0499cd68a8f6303eceabc7478::$classMap;
}, null, ClassLoader::class);
}

View File

@ -440,17 +440,17 @@
},
{
"name": "fidry\/cpu-core-counter",
"version": "0.5.1",
"version_normalized": "0.5.1.0",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/theofidry\/cpu-core-counter.git",
"reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623"
"reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/theofidry\/cpu-core-counter\/zipball\/b58e5a3933e541dc286cc91fc4f3898bbc6f1623",
"reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623",
"url": "https:\/\/api.github.com\/repos\/theofidry\/cpu-core-counter\/zipball\/f92996c4d5c1a696a6a970e20f7c4216200fcc42",
"reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42",
"shasum": ""
},
"require": {
@ -458,16 +458,16 @@
},
"require-dev": {
"fidry\/makefile": "^0.2.0",
"fidry\/php-cs-fixer-config": "^1.1.2",
"phpstan\/extension-installer": "^1.2.0",
"phpstan\/phpstan": "^1.9.2",
"phpstan\/phpstan-deprecation-rules": "^1.0.0",
"phpstan\/phpstan-phpunit": "^1.2.2",
"phpstan\/phpstan-strict-rules": "^1.4.4",
"phpunit\/phpunit": "^9.5.26 || ^8.5.31",
"theofidry\/php-cs-fixer-config": "^1.0",
"phpunit\/phpunit": "^8.5.31 || ^9.5.26",
"webmozarts\/strict-phpunit": "^7.5"
},
"time": "2022-12-24T12:35:10+00:00",
"time": "2024-02-07T09:43:46+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -492,7 +492,7 @@
],
"support": {
"issues": "https:\/\/github.com\/theofidry\/cpu-core-counter\/issues",
"source": "https:\/\/github.com\/theofidry\/cpu-core-counter\/tree\/0.5.1"
"source": "https:\/\/github.com\/theofidry\/cpu-core-counter\/tree\/1.1.0"
},
"funding": [
{
@ -2535,38 +2535,36 @@
},
{
"name": "symplify\/easy-parallel",
"version": "11.2.0",
"version_normalized": "11.2.0.0",
"version": "11.2.1",
"version_normalized": "11.2.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/easy-parallel.git",
"reference": "472a324ea02fd7b8769452cef5f56cc9808798ea"
"reference": "ebc9ec259500af0147178f97720ea67a6c81cbd9"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/easy-parallel\/zipball\/472a324ea02fd7b8769452cef5f56cc9808798ea",
"reference": "472a324ea02fd7b8769452cef5f56cc9808798ea",
"url": "https:\/\/api.github.com\/repos\/symplify\/easy-parallel\/zipball\/ebc9ec259500af0147178f97720ea67a6c81cbd9",
"reference": "ebc9ec259500af0147178f97720ea67a6c81cbd9",
"shasum": ""
},
"require": {
"clue\/ndjson-react": "^1.3",
"fidry\/cpu-core-counter": "^0.4.0 || ^0.5.1",
"fidry\/cpu-core-counter": "^0.5.1|^1.1",
"nette\/utils": "^3.2|^4.0",
"php": ">=8.1",
"react\/child-process": "^0.6.5",
"react\/event-loop": "^1.3",
"react\/socket": "^1.12",
"react\/event-loop": "^1.5",
"react\/socket": "^1.15",
"symfony\/console": "^6.2|^7.0"
},
"require-dev": {
"phpstan\/extension-installer": "^1.3",
"phpunit\/phpunit": "^10.5",
"rector\/rector": "^0.18.13",
"symplify\/easy-coding-standard": "^12.0",
"symplify\/phpstan-extensions": "^11.4",
"rector\/rector": "^1.0",
"symplify\/easy-coding-standard": "^12.1",
"tomasvotruba\/class-leak": "^0.2.6"
},
"time": "2024-01-01T22:10:11+00:00",
"time": "2024-02-07T23:35:00+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2581,7 +2579,7 @@
"description": "Helper package for easier CLI project parallelization",
"support": {
"issues": "https:\/\/github.com\/symplify\/easy-parallel\/issues",
"source": "https:\/\/github.com\/symplify\/easy-parallel\/tree\/11.2.0"
"source": "https:\/\/github.com\/symplify\/easy-parallel\/tree\/11.2.1"
},
"funding": [
{

File diff suppressed because one or more lines are too long

View File

@ -83,7 +83,7 @@ You have two commands available that provides insight about what the finders
can find:
```
$ make diagnosis # From this repository
$ make diagnose # From this repository
$ ./vendor/fidry/cpu-core-counter/bin/diagnose.php # From the library
```

View File

@ -16,3 +16,7 @@ use RectorPrefix202402\Fidry\CpuCoreCounter\Finder\FinderRegistry;
require_once __DIR__ . '/../vendor/autoload.php';
echo 'Running diagnosis...' . \PHP_EOL . \PHP_EOL;
echo Diagnoser::diagnose(FinderRegistry::getAllVariants()) . \PHP_EOL;
echo 'Logical CPU cores finders...' . \PHP_EOL . \PHP_EOL;
echo Diagnoser::diagnose(FinderRegistry::getDefaultLogicalFinders()) . \PHP_EOL;
echo 'Physical CPU cores finders...' . \PHP_EOL . \PHP_EOL;
echo Diagnoser::diagnose(FinderRegistry::getDefaultPhysicalFinders()) . \PHP_EOL;

View File

@ -18,13 +18,13 @@
},
"require-dev": {
"fidry\/makefile": "^0.2.0",
"fidry\/php-cs-fixer-config": "^1.1.2",
"phpstan\/extension-installer": "^1.2.0",
"phpstan\/phpstan": "^1.9.2",
"phpstan\/phpstan-deprecation-rules": "^1.0.0",
"phpstan\/phpstan-phpunit": "^1.2.2",
"phpstan\/phpstan-strict-rules": "^1.4.4",
"phpunit\/phpunit": "^9.5.26 || ^8.5.31",
"theofidry\/php-cs-fixer-config": "^1.0",
"phpunit\/phpunit": "^8.5.31 || ^9.5.26",
"webmozarts\/strict-phpunit": "^7.5"
},
"autoload": {

View File

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Fidry CPUCounter Config package.
*
* (c) Théo FIDRY <theo.fidry@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare (strict_types=1);
namespace RectorPrefix202402\Fidry\CpuCoreCounter\Finder;
use function preg_match;
/**
* Find the number of logical CPU cores for Windows leveraging the Get-CimInstance
* cmdlet, which is a newer version that is recommended over Get-WmiObject.
*/
final class CmiCmdletLogicalFinder extends ProcOpenBasedFinder
{
private const CPU_CORE_COUNT_REGEX = '/NumberOfLogicalProcessors[\\s\\n]-+[\\s\\n]+(?<count>\\d+)/';
protected function getCommand() : string
{
return 'Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -Property NumberOfLogicalProcessors';
}
public function toString() : string
{
return 'CmiCmdletLogicalFinder';
}
protected function countCpuCores(string $process) : ?int
{
if (0 === preg_match(self::CPU_CORE_COUNT_REGEX, $process, $matches)) {
return parent::countCpuCores($process);
}
$count = $matches['count'];
return parent::countCpuCores($count);
}
}

View File

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Fidry CPUCounter Config package.
*
* (c) Théo FIDRY <theo.fidry@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare (strict_types=1);
namespace RectorPrefix202402\Fidry\CpuCoreCounter\Finder;
use function preg_match;
/**
* Find the number of physical CPU cores for Windows.
*
* @see https://github.com/paratestphp/paratest/blob/c163539818fd96308ca8dc60f46088461e366ed4/src/Runners/PHPUnit/Options.php#L912-L916
*/
final class CmiCmdletPhysicalFinder extends ProcOpenBasedFinder
{
private const CPU_CORE_COUNT_REGEX = '/NumberOfCores[\\s\\n]-+[\\s\\n]+(?<count>\\d+)/';
protected function getCommand() : string
{
return 'Get-CimInstance -ClassName Win32_Processor | Select-Object -Property NumberOfCores';
}
public function toString() : string
{
return 'CmiCmdletPhysicalFinder';
}
protected function countCpuCores(string $process) : ?int
{
if (0 === preg_match(self::CPU_CORE_COUNT_REGEX, $process, $matches)) {
return parent::countCpuCores($process);
}
$count = $matches['count'];
return parent::countCpuCores($count);
}
}

View File

@ -18,21 +18,21 @@ final class FinderRegistry
*/
public static function getAllVariants() : array
{
return [new CpuInfoFinder(), new DummyCpuCoreFinder(1), new HwLogicalFinder(), new HwPhysicalFinder(), new LscpuLogicalFinder(), new LscpuPhysicalFinder(), new _NProcessorFinder(), new NProcessorFinder(), new NProcFinder(\true), new NProcFinder(\false), new NullCpuCoreFinder(), SkipOnOSFamilyFinder::forWindows(new DummyCpuCoreFinder(1)), OnlyOnOSFamilyFinder::forWindows(new DummyCpuCoreFinder(1)), new WmicPhysicalFinder(), new WmicLogicalFinder()];
return [new CpuInfoFinder(), new DummyCpuCoreFinder(1), new HwLogicalFinder(), new HwPhysicalFinder(), new LscpuLogicalFinder(), new LscpuPhysicalFinder(), new _NProcessorFinder(), new NProcessorFinder(), new NProcFinder(\true), new NProcFinder(\false), new NullCpuCoreFinder(), SkipOnOSFamilyFinder::forWindows(new DummyCpuCoreFinder(1)), OnlyOnOSFamilyFinder::forWindows(new DummyCpuCoreFinder(1)), new OnlyInPowerShellFinder(new CmiCmdletLogicalFinder()), new OnlyInPowerShellFinder(new CmiCmdletPhysicalFinder()), new WindowsRegistryLogicalFinder(), new WmicPhysicalFinder(), new WmicLogicalFinder()];
}
/**
* @return list<CpuCoreFinder>
*/
public static function getDefaultLogicalFinders() : array
{
return [OnlyOnOSFamilyFinder::forWindows(new WmicLogicalFinder()), new NProcFinder(), new HwLogicalFinder(), new _NProcessorFinder(), new NProcessorFinder(), new LscpuLogicalFinder(), new CpuInfoFinder()];
return [OnlyOnOSFamilyFinder::forWindows(new OnlyInPowerShellFinder(new CmiCmdletLogicalFinder())), OnlyOnOSFamilyFinder::forWindows(new WindowsRegistryLogicalFinder()), OnlyOnOSFamilyFinder::forWindows(new WmicLogicalFinder()), new NProcFinder(), new HwLogicalFinder(), new _NProcessorFinder(), new NProcessorFinder(), new LscpuLogicalFinder(), new CpuInfoFinder()];
}
/**
* @return list<CpuCoreFinder>
*/
public static function getDefaultPhysicalFinders() : array
{
return [OnlyOnOSFamilyFinder::forWindows(new WmicPhysicalFinder()), new HwPhysicalFinder(), new LscpuPhysicalFinder()];
return [OnlyOnOSFamilyFinder::forWindows(new OnlyInPowerShellFinder(new CmiCmdletPhysicalFinder())), OnlyOnOSFamilyFinder::forWindows(new WmicPhysicalFinder()), new HwPhysicalFinder(), new LscpuPhysicalFinder()];
}
private function __construct()
{

View File

@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Fidry CPUCounter Config package.
*
* (c) Théo FIDRY <theo.fidry@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare (strict_types=1);
namespace RectorPrefix202402\Fidry\CpuCoreCounter\Finder;
use function getenv;
use function sprintf;
final class OnlyInPowerShellFinder implements CpuCoreFinder
{
/**
* @var CpuCoreFinder
*/
private $decoratedFinder;
public function __construct(CpuCoreFinder $decoratedFinder)
{
$this->decoratedFinder = $decoratedFinder;
}
public function diagnose() : string
{
$powerShellModulePath = getenv('PSModulePath');
return $this->skip() ? sprintf('Skipped; no power shell module path detected ("%s").', $powerShellModulePath) : $this->decoratedFinder->diagnose();
}
public function find() : ?int
{
return $this->skip() ? null : $this->decoratedFinder->find();
}
public function toString() : string
{
return sprintf('OnlyInPowerShellFinder(%s)', $this->decoratedFinder->toString());
}
private function skip() : bool
{
return \false === getenv('PSModulePath');
}
}

View File

@ -0,0 +1,40 @@
<?php
/*
* This file is part of the Fidry CPUCounter Config package.
*
* (c) Théo FIDRY <theo.fidry@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare (strict_types=1);
namespace RectorPrefix202402\Fidry\CpuCoreCounter\Finder;
use function array_filter;
use function count;
use function explode;
use const PHP_EOL;
/**
* Find the number of logical CPU cores for Windows.
*
* @see https://knowledge.informatica.com/s/article/151521
*/
final class WindowsRegistryLogicalFinder extends ProcOpenBasedFinder
{
protected function getCommand() : string
{
return 'reg query HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor';
}
public function toString() : string
{
return 'WindowsRegistryLogicalFinder';
}
protected function countCpuCores(string $process) : ?int
{
$count = count(array_filter(explode(PHP_EOL, $process), static function (string $line) : bool {
return '' !== \trim($line);
}));
return $count > 0 ? $count : null;
}
}

View File

@ -30,7 +30,7 @@ if (!function_exists('humbug_phpscoper_expose_class')) {
}
}
humbug_phpscoper_expose_class('AutoloadIncluder', 'RectorPrefix202402\AutoloadIncluder');
humbug_phpscoper_expose_class('ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232', 'RectorPrefix202402\ComposerAutoloaderInitc583cd9db12694da4a6881390cc7f232');
humbug_phpscoper_expose_class('ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478', 'RectorPrefix202402\ComposerAutoloaderInit1b339dc0499cd68a8f6303eceabc7478');
humbug_phpscoper_expose_class('Product', 'RectorPrefix202402\Product');
// Function aliases. For more information see:

View File

@ -5,19 +5,17 @@
"require": {
"php": ">=8.1",
"clue\/ndjson-react": "^1.3",
"fidry\/cpu-core-counter": "^0.4.0 || ^0.5.1",
"fidry\/cpu-core-counter": "^0.5.1|^1.1",
"nette\/utils": "^3.2|^4.0",
"react\/child-process": "^0.6.5",
"react\/event-loop": "^1.3",
"react\/socket": "^1.12",
"react\/event-loop": "^1.5",
"react\/socket": "^1.15",
"symfony\/console": "^6.2|^7.0"
},
"require-dev": {
"phpstan\/extension-installer": "^1.3",
"phpunit\/phpunit": "^10.5",
"rector\/rector": "^0.18.13",
"symplify\/easy-coding-standard": "^12.0",
"symplify\/phpstan-extensions": "^11.4",
"rector\/rector": "^1.0",
"symplify\/easy-coding-standard": "^12.1",
"tomasvotruba\/class-leak": "^0.2.6"
},
"autoload": {
@ -33,7 +31,7 @@
"scripts": {
"check-cs": "vendor\/bin\/ecs check --ansi",
"fix-cs": "vendor\/bin\/ecs check --fix --ansi",
"phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify",
"phpstan": "vendor\/bin\/phpstan analyse --ansi",
"rector": "vendor\/bin\/rector process --dry-run --ansi"
},
"config": {

View File

@ -4,8 +4,4 @@ declare (strict_types=1);
namespace RectorPrefix202402;
use RectorPrefix202402\Symplify\EasyCodingStandard\Config\ECSConfig;
use RectorPrefix202402\Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $ecsConfig) : void {
$ecsConfig->paths([__DIR__ . '/config', __DIR__ . '/ecs.php', __DIR__ . '/rector.php', __DIR__ . '/src', __DIR__ . '/tests']);
$ecsConfig->sets([SetList::COMMON, SetList::PSR_12]);
};
return ECSConfig::configure()->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/tests'])->withRootFiles()->withPreparedSets(common: \true, psr12: \true);

View File

@ -4,23 +4,4 @@ declare (strict_types=1);
namespace RectorPrefix202402;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
// @todo bump to PHP 8.1
LevelSetList::UP_TO_PHP_80,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::EARLY_RETURN,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);
$rectorConfig->paths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/tests']);
$rectorConfig->importNames();
$rectorConfig->skip(['*/Source/*', '*/Fixture/*']);
};
return RectorConfig::configure()->withPreparedSets(\true, \true, \true, \false, \true, \true, \false, \true)->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/tests'])->withImportNames(\true, \true, \true, \true)->withPhpSets()->withSkip(['*/Source/*']);