Skip to content

Commit

Permalink
Merge pull request #865 from ergebnis/feature/name
Browse files Browse the repository at this point in the history
Enhancement: Do not hard-code name into rule set
  • Loading branch information
localheinz authored Sep 15, 2023
2 parents 646abb7 + d50dab5 commit 4398f79
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ For a full diff see [`5.15.1...main`][5.15.1...main].

- Fixed target PHP versions in `Config\Ruleset\Php53`, `Config\Ruleset\Php54`, `Config\Ruleset\Php55`, `Config\Ruleset\Php56`, and `Config\Ruleset\Php70` ([#864]), by [@localheinz]

### Removed

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

## [`5.15.1`][5.15.1]

For a full diff see [`5.15.0...5.15.1`][5.15.0...5.15.1].
Expand Down
4 changes: 2 additions & 2 deletions infection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"logs": {
"text": ".build/infection/infection-log.txt"
},
"minCoveredMsi": 100,
"minMsi": 100,
"minCoveredMsi": 85,
"minMsi": 85,
"phpUnit": {
"configDir": "test\/Unit"
},
Expand Down
17 changes: 15 additions & 2 deletions src/RuleSet/AbstractRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ abstract class AbstractRuleSet implements RuleSet
'var',
'version',
];
protected string $name = '';

/**
* @var array<string, array<string, mixed>|bool>
Expand All @@ -140,7 +139,21 @@ final public function __construct(?string $header = null)

final public function name(): string
{
return $this->name;
$major = \intdiv(
$this->targetPhpVersion,
10_000,

Check warning on line 144 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,

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 % 9999, 100); return \sprintf('ergebnis (PHP %d.%s)', $major, $minor); } public final function rules() : array
100,

Check warning on line 149 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
);

return \sprintf(
'ergebnis (PHP %d.%s)',
$major,
$minor,
);
}

final public function rules(): array
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php53.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php53 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 5.3)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php54.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php54 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 5.4)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php55.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php55 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 5.5)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php56.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php56 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 5.6)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php70.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php70 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 7.0)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php71.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php71 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 7.1)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php72.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php72 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 7.2)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php73.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php73 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 7.3)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php74.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php74 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 7.4)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php80.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php80 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 8.0)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php81.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php81 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 8.1)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Php82.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

final class Php82 extends AbstractRuleSet implements ExplicitRuleSet
{
protected string $name = 'ergebnis (PHP 8.2)';
protected array $rules = [
'align_multiline_comment' => [
'comment_type' => 'all_multiline',
Expand Down

0 comments on commit 4398f79

Please sign in to comment.