Skip to content

Commit

Permalink
Fix: Remove $targetPhpVersion field
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Sep 15, 2023
1 parent 4398f79 commit d8f5b5f
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ For a full diff see [`5.15.1...main`][5.15.1...main].
### Removed

- Removed `$name` field from `Config\Ruleset\AbstractRuleSet` ([#865]), by [@localheinz]
- Removed `$targetPhpVersion` field from `Config\Ruleset\AbstractRuleSet` ([#865]), by [@localheinz]

## [`5.15.1`][5.15.1]

Expand Down
10 changes: 2 additions & 8 deletions src/RuleSet/AbstractRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ abstract class AbstractRuleSet implements RuleSet
* @var array<string, array<string, mixed>|bool>
*/
protected array $rules = [];
protected int $targetPhpVersion = 0;

final public function __construct(?string $header = null)
{
Expand All @@ -140,12 +139,12 @@ final public function __construct(?string $header = null)
final public function name(): string
{
$major = \intdiv(
$this->targetPhpVersion,
$this->targetPhpVersion(),
10_000,

Check warning on line 143 in src/RuleSet/AbstractRuleSet.php

View workflow job for this annotation

GitHub Actions / Mutation Tests (8.1, locked)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ } public final function name() : string { - $major = \intdiv($this->targetPhpVersion(), 10000); + $major = \intdiv($this->targetPhpVersion(), 9999); $minor = \intdiv($this->targetPhpVersion() % 10000, 100); return \sprintf('ergebnis (PHP %d.%s)', $major, $minor); }
);

$minor = \intdiv(
$this->targetPhpVersion % 10_000,
$this->targetPhpVersion() % 10_000,

Check warning on line 147 in src/RuleSet/AbstractRuleSet.php

View workflow job for this annotation

GitHub Actions / Mutation Tests (8.1, locked)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ public final function name() : string { $major = \intdiv($this->targetPhpVersion(), 10000); - $minor = \intdiv($this->targetPhpVersion() % 10000, 100); + $minor = \intdiv($this->targetPhpVersion() % 9999, 100); return \sprintf('ergebnis (PHP %d.%s)', $major, $minor); } public final function rules() : array
100,

Check warning on line 148 in src/RuleSet/AbstractRuleSet.php

View workflow job for this annotation

GitHub Actions / Mutation Tests (8.1, locked)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ public final function name() : string { $major = \intdiv($this->targetPhpVersion(), 10000); - $minor = \intdiv($this->targetPhpVersion() % 10000, 100); + $minor = \intdiv($this->targetPhpVersion() % 10000, 99); return \sprintf('ergebnis (PHP %d.%s)', $major, $minor); } public final function rules() : array
);

Expand All @@ -160,9 +159,4 @@ final public function rules(): array
{
return $this->rules;
}

final public function targetPhpVersion(): int
{
return $this->targetPhpVersion;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php53.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,5 +809,9 @@ final class Php53 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 50300;

public function targetPhpVersion(): int
{
return 50300;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php54.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,5 +811,9 @@ final class Php54 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 50400;

public function targetPhpVersion(): int
{
return 50400;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php55.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,9 @@ final class Php55 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 50500;

public function targetPhpVersion(): int
{
return 50500;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php56.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,9 @@ final class Php56 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 50600;

public function targetPhpVersion(): int
{
return 50600;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php70.php
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,9 @@ final class Php70 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 70000;

public function targetPhpVersion(): int
{
return 70000;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php71.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,5 +823,9 @@ final class Php71 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 70100;

public function targetPhpVersion(): int
{
return 70100;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php72.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,5 +823,9 @@ final class Php72 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 70200;

public function targetPhpVersion(): int
{
return 70200;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php73.php
Original file line number Diff line number Diff line change
Expand Up @@ -824,5 +824,9 @@ final class Php73 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 70300;

public function targetPhpVersion(): int
{
return 70300;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php74.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,5 +827,9 @@ final class Php74 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 70400;

public function targetPhpVersion(): int
{
return 70400;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php80.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,5 +836,9 @@ final class Php80 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 80000;

public function targetPhpVersion(): int
{
return 80000;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php81.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,5 +838,9 @@ final class Php81 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 80100;

public function targetPhpVersion(): int
{
return 80100;
}
}
6 changes: 5 additions & 1 deletion src/RuleSet/Php82.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,5 +838,9 @@ final class Php82 extends AbstractRuleSet implements ExplicitRuleSet
'less_and_greater' => true,
],
];
protected int $targetPhpVersion = 80200;

public function targetPhpVersion(): int

Check warning on line 842 in src/RuleSet/Php82.php

View check run for this annotation

Codecov / codecov/patch

src/RuleSet/Php82.php#L842

Added line #L842 was not covered by tests
{
return 80200;

Check warning on line 844 in src/RuleSet/Php82.php

View check run for this annotation

Codecov / codecov/patch

src/RuleSet/Php82.php#L844

Added line #L844 was not covered by tests
}
}

0 comments on commit d8f5b5f

Please sign in to comment.