Skip to content

Commit 612dcfa

Browse files
authored
Merge pull request #214 from spatie/update-dependencies
Update composer dependencies, require PHP 8.3+
2 parents 6c6f331 + b47246a commit 612dcfa

17 files changed

Lines changed: 78 additions & 51 deletions

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: true
2525
matrix:
2626
os: [ubuntu-latest]
27-
php: [8.1, 8.2, 8.3]
27+
php: [8.3, 8.4, 8.5]
2828
dependency-version: [prefer-lowest, prefer-stable]
2929

3030
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
],
1717
"homepage": "https://github.com/spatie/calendar-links",
1818
"require": {
19-
"php": "^8.1"
19+
"php": "^8.3"
2020
},
2121
"require-dev": {
22-
"friendsofphp/php-cs-fixer": "^3.49",
23-
"phpunit/phpunit": "^10.5",
24-
"spatie/phpunit-snapshot-assertions": "^5.1",
25-
"vimeo/psalm": "^5.22"
22+
"friendsofphp/php-cs-fixer": "^3.93",
23+
"phpunit/phpunit": "^12.5 || ^13.0",
24+
"spatie/phpunit-snapshot-assertions": "^5.3",
25+
"vimeo/psalm": "^6.15"
2626
},
2727
"autoload": {
2828
"psr-4": {

src/Exceptions/InvalidLink.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
use DateTimeInterface;
88
use InvalidArgumentException;
99

10+
/** @api */
1011
class InvalidLink extends InvalidArgumentException
1112
{
12-
private const DATETIME_FORMAT = 'Y-m-d H:i:s';
13+
private const string DATETIME_FORMAT = 'Y-m-d H:i:s';
1314

1415
public static function negativeDateRange(DateTimeInterface $from, DateTimeInterface $to): self
1516
{

src/Generators/BaseOutlook.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
abstract class BaseOutlook implements Generator
1616
{
1717
/** @see https://www.php.net/manual/en/function.date.php */
18-
private const DATE_FORMAT = 'Y-m-d';
18+
private const string DATE_FORMAT = 'Y-m-d';
1919

2020
/** @see https://www.php.net/manual/en/function.date.php */
21-
private const DATETIME_FORMAT = 'Y-m-d\TH:i:s\Z';
21+
private const string DATETIME_FORMAT = 'Y-m-d\TH:i:s\Z';
2222

2323
/** @psalm-var OutlookUrlParameters */
2424
protected array $urlParameters = [];
@@ -36,6 +36,7 @@ public function __construct(array $urlParameters = [])
3636
}
3737

3838
/** @inheritDoc */
39+
#[\Override]
3940
public function generate(Link $link): string
4041
{
4142
$url = $this->baseUrl();

src/Generators/Google.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
use Spatie\CalendarLinks\Link;
99

1010
/**
11+
* @api
1112
* @see https://github.com/InteractionDesignFoundation/add-event-to-calendar-docs/blob/main/services/google.md
1213
* @psalm-type GoogleUrlParameters = array<string, scalar|null>
1314
*/
1415
class Google implements Generator
1516
{
1617
/** @see https://www.php.net/manual/en/function.date.php */
17-
private const DATE_FORMAT = 'Ymd';
18+
private const string DATE_FORMAT = 'Ymd';
1819

1920
/** @see https://www.php.net/manual/en/function.date.php */
20-
private const DATETIME_FORMAT = 'Ymd\THis';
21+
private const string DATETIME_FORMAT = 'Ymd\THis';
2122

2223
/** @psalm-var GoogleUrlParameters */
2324
protected array $urlParameters = [];
@@ -29,9 +30,10 @@ public function __construct(array $urlParameters = [])
2930
}
3031

3132
/** @var non-empty-string */
32-
protected const BASE_URL = 'https://calendar.google.com/calendar/render?action=TEMPLATE';
33+
protected const string BASE_URL = 'https://calendar.google.com/calendar/render?action=TEMPLATE';
3334

3435
/** @inheritDoc */
36+
#[\Override]
3537
public function generate(Link $link): string
3638
{
3739
$url = self::BASE_URL;

src/Generators/Ics.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
use Spatie\CalendarLinks\Link;
99

1010
/**
11+
* @api
1112
* @see https://icalendar.org/RFC-Specifications/iCalendar-RFC-5545/
1213
* @psalm-type IcsOptions = array{UID?: string, URL?: string, PRODID?: string, REMINDER?: array{DESCRIPTION?: string, TIME?: \DateTimeInterface}}
1314
* @psalm-type IcsPresentationOptions = array{format?: self::FORMAT_*}
1415
*/
1516
class Ics implements Generator
1617
{
17-
public const FORMAT_HTML = 'html';
18-
public const FORMAT_FILE = 'file';
18+
public const string FORMAT_HTML = 'html';
19+
public const string FORMAT_FILE = 'file';
1920

2021
/** @see https://www.php.net/manual/en/function.date.php */
2122
protected string $dateFormat = 'Ymd';
@@ -39,6 +40,7 @@ public function __construct(array $options = [], array $presentationOptions = []
3940
}
4041

4142
/** @inheritDoc */
43+
#[\Override]
4244
public function generate(Link $link): string
4345
{
4446
$url = [
@@ -56,7 +58,7 @@ public function generate(Link $link): string
5658
if ($link->allDay) {
5759
$url[] = 'DTSTAMP:'.gmdate($this->dateTimeFormat, $link->from->getTimestamp());
5860
$url[] = 'DTSTART;VALUE=DATE:'.$link->from->format($dateTimeFormat);
59-
$url[] = 'DURATION:P'.(max(1, $link->from->diff($link->to)->days)).'D';
61+
$url[] = 'DURATION:P'.(max(1, (int) $link->from->diff($link->to)->days)).'D';
6062
} else {
6163
$url[] = 'DTSTAMP:'.gmdate($dateTimeFormat, $link->from->getTimestamp());
6264
$url[] = 'DTSTART:'.gmdate($dateTimeFormat, $link->from->getTimestamp());

src/Generators/WebOffice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ final class WebOffice extends BaseOutlook
1010
private const BASE_URL = 'https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent';
1111

1212
/** @inheritDoc */
13+
#[\Override]
1314
protected function baseUrl(): string
1415
{
1516
return static::BASE_URL;

src/Generators/WebOutlook.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ final class WebOutlook extends BaseOutlook
1010
private const BASE_URL = 'https://outlook.live.com/calendar/action/compose?path=/calendar/action/compose&rru=addevent';
1111

1212
/** @inheritDoc */
13+
#[\Override]
1314
protected function baseUrl(): string
1415
{
1516
return static::BASE_URL;

src/Generators/Yahoo.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
use Spatie\CalendarLinks\Link;
1010

1111
/**
12+
* @api
1213
* @see https://github.com/InteractionDesignFoundation/add-event-to-calendar-docs/blob/main/services/yahoo.md
1314
* @psalm-type YahooUrlParameters = array<string, scalar|null>
1415
*/
1516
class Yahoo implements Generator
1617
{
1718
/** @see https://www.php.net/manual/en/function.date.php */
18-
private const DATE_FORMAT = 'Ymd';
19+
private const string DATE_FORMAT = 'Ymd';
1920

2021
/** @see https://www.php.net/manual/en/function.date.php */
21-
private const DATETIME_FORMAT = 'Ymd\THis\Z';
22+
private const string DATETIME_FORMAT = 'Ymd\THis\Z';
2223

2324
/** @var non-empty-string */
24-
protected const BASE_URL = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
25+
protected const string BASE_URL = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
2526

26-
/** @inheritDoc */
2727
/** @psalm-var YahooUrlParameters */
2828
protected array $urlParameters = [];
2929

@@ -34,6 +34,7 @@ public function __construct(array $urlParameters = [])
3434
}
3535

3636
/** {@inheritDoc} */
37+
#[\Override]
3738
public function generate(Link $link): string
3839
{
3940
$url = self::BASE_URL;

src/Link.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Spatie\CalendarLinks\Generators\Yahoo;
1313

1414
/**
15+
* @api
1516
* @psalm-import-type IcsOptions from \Spatie\CalendarLinks\Generators\Ics
1617
* @psalm-import-type GoogleUrlParameters from \Spatie\CalendarLinks\Generators\Google
1718
* @psalm-import-type YahooUrlParameters from \Spatie\CalendarLinks\Generators\Yahoo

0 commit comments

Comments
 (0)