Skip to content

Commit

Permalink
Update compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
endroid committed Oct 19, 2024
1 parent b845fd5 commit 8e0344e
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.github/workflows/ export-ignore
/.github/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
14 changes: 7 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.3', '8.4']
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
Expand All @@ -26,7 +26,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -58,13 +58,13 @@ jobs:
- name: Archive logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: logs
name: logs-php-${{ matrix.php-versions }}
path: vendor/endroid/quality/application/var/log

- name: Archive code coverage results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage
name: coverage-php-${{ matrix.php-versions }}
path: tests/coverage
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 (c) Jeroen van den Enden
Copyright 2024 (c) Jeroen van den Enden

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": "^8.1"
"php": "^8.2"
},
"require-dev": {
"endroid/quality": "dev-main"
Expand Down
6 changes: 3 additions & 3 deletions src/Model/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Endroid\Calendar\Model;

final class Calendar
final readonly class Calendar
{
public function __construct(
private readonly string $title,
private string $title,
/** @var array<CalendarItem> */
private readonly array $calendarItems = []
private array $calendarItems = [],
) {
}

Expand Down
20 changes: 10 additions & 10 deletions src/Model/CalendarItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public function __construct(
/** @var array<\DateTimeImmutable> */
private array $repeatExceptions = [],
private int $repeatCount = 0,
private \DateInterval|null $repeatInterval = null,
private \DateTimeImmutable|null $repeatEndDate = null,
private \DateTimeImmutable|null $originalDate = null,
private string $rawSourceData = ''
private ?\DateInterval $repeatInterval = null,
private ?\DateTimeImmutable $repeatEndDate = null,
private ?\DateTimeImmutable $originalDate = null,
private string $rawSourceData = '',
) {
}

Expand All @@ -34,7 +34,7 @@ public function getTitle(): string
return $this->title;
}

public function getDescription(): string|null
public function getDescription(): ?string
{
return $this->description;
}
Expand Down Expand Up @@ -104,27 +104,27 @@ public function setRepeatInterval(?\DateInterval $repeatInterval): void
$this->repeatInterval = $repeatInterval;
}

public function getRepeatInterval(): \DateInterval|null
public function getRepeatInterval(): ?\DateInterval
{
return $this->repeatInterval;
}

public function setRepeatEndDate(\DateTimeImmutable|null $repeatEndDate): void
public function setRepeatEndDate(?\DateTimeImmutable $repeatEndDate): void
{
$this->repeatEndDate = $repeatEndDate;
}

public function getRepeatEndDate(): \DateTimeImmutable|null
public function getRepeatEndDate(): ?\DateTimeImmutable
{
return $this->repeatEndDate;
}

public function setOriginalDate(\DateTimeImmutable|null $originalDate): void
public function setOriginalDate(?\DateTimeImmutable $originalDate): void
{
$this->originalDate = $originalDate;
}

public function getOriginalDate(): \DateTimeImmutable|null
public function getOriginalDate(): ?\DateTimeImmutable
{
return $this->originalDate;
}
Expand Down
14 changes: 7 additions & 7 deletions src/Model/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Endroid\Calendar\Model;

final class Event
final readonly class Event
{
public function __construct(
private readonly string $title,
private readonly string $description,
private readonly \DateTimeImmutable $dateStart,
private readonly \DateTimeImmutable $dateEnd
private string $title,
private string $description,
private \DateTimeImmutable $dateStart,
private \DateTimeImmutable $dateEnd,
) {
}

Expand All @@ -29,7 +29,7 @@ public function getDescription(): ?string
return $this->description;
}

public function getDateStart(\DateTimeZone $timeZone = null): \DateTimeImmutable
public function getDateStart(?\DateTimeZone $timeZone = null): \DateTimeImmutable
{
if (null == $timeZone) {
$timeZone = new \DateTimeZone(date_default_timezone_get());
Expand All @@ -38,7 +38,7 @@ public function getDateStart(\DateTimeZone $timeZone = null): \DateTimeImmutable
return $this->dateStart->setTimeZone($timeZone);
}

public function getDateEnd(\DateTimeZone $timeZone = null): \DateTimeImmutable
public function getDateEnd(?\DateTimeZone $timeZone = null): \DateTimeImmutable
{
if (null == $timeZone) {
$timeZone = new \DateTimeZone(date_default_timezone_get());
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/IcalReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Endroid\Calendar\Model\Calendar;
use Endroid\Calendar\Model\CalendarItem;

final class IcalReader
final readonly class IcalReader
{
/** @var array<string, int> */
private const WEEK_DAYS = [
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/IcalWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Endroid\Calendar\Model\Calendar;

final class IcalWriter
final readonly class IcalWriter
{
public function writeToString(Calendar $calendar, \DateTimeImmutable $dateStart, \DateTimeImmutable $dateEnd): string
{
Expand Down
5 changes: 2 additions & 3 deletions tests/Reader/IcalReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
namespace Endroid\Calendar\Tests\Reader\CalendarReaderTest;

use Endroid\Calendar\Reader\IcalReader;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;

final class IcalReaderTest extends TestCase
{
/**
* @testdox Recurring events count is correct
*/
#[TestDox('Recurring events count is correct')]
public function testRecurringEventsCount()
{
$reader = new IcalReader();
Expand Down

0 comments on commit 8e0344e

Please sign in to comment.