Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 27, 2024
1 parent 9a00924 commit b1e555a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Configuration/Levels/LevelRulesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function resolve(int $level, array $availableRules, string $method

if ($availableRules === []) {
throw new ShouldNotHappenException(sprintf(
'There is no available rules in %s, define the available rules first',
'There are no available rules in "%s()", define the available rules first',
$methodName
));
}
Expand Down
23 changes: 5 additions & 18 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public function withPreparedSets(
bool $twig = false,
bool $phpunit = false,
): self {
Notifier::notifyNotSuitableMethodForPHP74(__METHOD__);
Notifier::notifyNotSuitableMethodForPHP74(__METHOD__ . '()');

if ($deadCode) {
$this->sets[] = SetList::DEAD_CODE;
Expand Down Expand Up @@ -892,11 +892,7 @@ public function withDeadCodeLevel(int $level): self
{
$this->isDeadCodeLevelUsed = true;

$levelRules = LevelRulesResolver::resolve(
$level,
DeadCodeLevel::RULES,
'RectorConfig::' . __METHOD__ . '()'
);
$levelRules = LevelRulesResolver::resolve($level, DeadCodeLevel::RULES, __METHOD__);

$this->rules = array_merge($this->rules, $levelRules);

Expand All @@ -911,11 +907,7 @@ public function withTypeCoverageLevel(int $level): self
{
$this->isTypeCoverageLevelUsed = true;

$levelRules = LevelRulesResolver::resolve(
$level,
TypeDeclarationLevel::RULES,
'RectorConfig::' . __METHOD__ . '()'
);
$levelRules = LevelRulesResolver::resolve($level, TypeDeclarationLevel::RULES, __METHOD__);

$this->rules = array_merge($this->rules, $levelRules);

Expand All @@ -934,9 +926,8 @@ public function withPhpLevel(int $level): self
$setRectorsResolver = new SetRectorsResolver();
$phpRectorRules = $setRectorsResolver->resolveFromFilePathForPhpLevel($phpLevelSetFilePath);

$levelRules = LevelRulesResolver::resolve($level, $phpRectorRules, 'RectorConfig::' . __METHOD__);
$levelRules = LevelRulesResolver::resolve($level, $phpRectorRules, __METHOD__);

// @todo this method conflicts with withPhpSets(), withPhpX(...)
$this->rules = array_merge($this->rules, $levelRules);

return $this;
Expand All @@ -950,11 +941,7 @@ public function withCodeQualityLevel(int $level): self
{
$this->isCodeQualityLevelUsed = true;

$levelRules = LevelRulesResolver::resolve(
$level,
CodeQualityLevel::RULES,
'RectorConfig::' . __METHOD__ . '()'
);
$levelRules = LevelRulesResolver::resolve($level, CodeQualityLevel::RULES, __METHOD__);

$this->rules = array_merge($this->rules, $levelRules);

Expand Down

0 comments on commit b1e555a

Please sign in to comment.