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 c37672d
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 20 deletions.
2 changes: 2 additions & 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` ([#866]), by [@localheinz]

## [`5.15.1`][5.15.1]

Expand Down Expand Up @@ -1152,6 +1153,7 @@ For a full diff see [`d899e77...1.0.0`][d899e77...1.0.0].
[#856]: https://github.com/ergebnis/php-cs-fixer-config/pull/856
[#857]: https://github.com/ergebnis/php-cs-fixer-config/pull/857
[#864]: https://github.com/ergebnis/php-cs-fixer-config/pull/864
[#866]: https://github.com/ergebnis/php-cs-fixer-config/pull/866

[@dependabot]: https://github.com/apps/dependabot
[@linuxjuggler]: https://github.com/linuxjuggler
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,
);

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

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
{
return 80200;
}
}

0 comments on commit c37672d

Please sign in to comment.