Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
Add PHP 8.1 readonly properties where relevant
  • Loading branch information
natitech committed Jul 6, 2023
1 parent 25f958b commit bf644cc
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/BusinessCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

final class BusinessCalendar
{
private HolidaysCalendar $holidaysCalendar;
private readonly HolidaysCalendar $holidaysCalendar;

/** @var \Nati\Businesscal\Holidays\Holiday[][] */
private array $holidays = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Holidays/Calendar/CHNationalHolidaysCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class CHNationalHolidaysCalendar implements HolidaysCalendar
{
private ChristianCalendar $christian;
private readonly ChristianCalendar $christian;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Holidays/Calendar/FRHolidaysCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class FRHolidaysCalendar implements HolidaysCalendar
{
private ChristianCalendar $christian;
private readonly ChristianCalendar $christian;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Holidays/Calendar/HolidayApiCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

final class HolidayApiCalendar implements HolidaysCalendar
{
private Client $api;
private readonly Client $api;

private array $holidays;

Expand Down
4 changes: 2 additions & 2 deletions src/Holidays/Calendar/PFHolidaysCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
final class PFHolidaysCalendar implements HolidaysCalendar
{
private FRHolidaysCalendar $fr;
private readonly FRHolidaysCalendar $fr;

private ChristianCalendar $christian;
private readonly ChristianCalendar $christian;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Holidays/Calendar/SolidarityFRHolidaysCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
final class SolidarityFRHolidaysCalendar implements HolidaysCalendar
{
private FRHolidaysCalendar $fr;
private readonly FRHolidaysCalendar $fr;

private ChristianCalendar $christian;
private readonly ChristianCalendar $christian;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Holidays/Holiday.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

final class Holiday
{
public \DateTimeImmutable $date;
public readonly \DateTimeImmutable $date;

public ?string $label;
public readonly ?string $label;

public static function create(\DateTimeImmutable $date, $label = null): self
{
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/BusinessCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class BusinessCalendarTest extends TestCase
{
private HolidaysCalendarMock $holidays;
private readonly HolidaysCalendarMock $holidays;

private BusinessCalendar $adder;
private readonly BusinessCalendar $adder;

protected function setUp(): void
{
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Holidays/Calendar/HolidayApiCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class HolidayApiCalendarTest extends TestCase
{
private HolidayApiCalendar $calendar;
private readonly HolidayApiCalendar $calendar;

private HolidayApiWrapperMock $api;
private readonly HolidayApiWrapperMock $api;

protected function setUp(): void
{
Expand Down

0 comments on commit bf644cc

Please sign in to comment.