From cee81c9b1735d28bae8fad948491ef44d549eb67 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Fri, 26 Jan 2024 15:08:13 +0530 Subject: [PATCH 1/4] Update dependencies --- README.md | 14 ++++----- composer.json | 8 ++--- phpunit.xml.dist | 25 +++++++-------- psalm-baseline.xml | 56 ++++++++++++++++++++++++++++------ psalm.xml | 2 ++ src/Generators/BaseOutlook.php | 1 + 6 files changed, 72 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 531613e..b27aec1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Psalm level](https://shepherd.dev/github/spatie/calendar-links/level.svg)](https://shepherd.dev/github/spatie/calendar-links) -Using this package you can generate links to add events to calendar systems. Here's a quick example: +Using this package, you can generate links to add events to calendar systems. Here's a quick example: ```php use Spatie\CalendarLinks\Link; @@ -22,7 +22,7 @@ Link::create( This will output: `https://calendar.google.com/calendar/render?action=TEMPLATE&text=Birthday&dates=20180201T090000/20180201T180000&sprop=&sprop=name:` -If you follow that link (and are authenticated with Google) you'll see a screen to add the event to your calendar. +If you follow that link (and are authenticated with Google), you’ll see a screen to add the event to your calendar. The package can also generate ics files that you can open in several email and calendar programs, including Microsoft Outlook, Google Calendar, and Apple Calendar. @@ -76,17 +76,15 @@ echo $link->ics([], ['format' => 'file']); // e.g. to attach ics as a file to an echo $link->formatWith(new \Your\Generator()); ``` -> ⚠️ ICS download links don't work in IE and EdgeHTML-based Edge browsers, see [details](https://github.com/spatie/calendar-links/issues/71). - ## Package principles -1. it should produce a small output (to keep pagesize small) +1. it should produce a small output (to keep page-size small) 2. it should be fast (no any external heavy dependencies) 3. all features should be supported by at least 2 generators (different services have different features) ## Changelog -Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. +Please see [CHANGELOG](CHANGELOG.md) for more information. ## Testing @@ -100,11 +98,11 @@ Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTI ## Security -If you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker. +If you've found a bug regarding security, please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker. ## Postcardware -You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. +You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment, we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium. diff --git a/composer.json b/composer.json index c7390c5..c6eb937 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ "php": "^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14", - "phpunit/phpunit": "^9.6 || ^10.0", - "spatie/phpunit-snapshot-assertions": "^4.2 || ^5.0", - "vimeo/psalm": "^5.6" + "friendsofphp/php-cs-fixer": "^3.48", + "phpunit/phpunit": "^10.1", + "spatie/phpunit-snapshot-assertions": "^5.1", + "vimeo/psalm": "^5.20" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 93d19e0..83d1d55 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,20 @@ - - - src - - - - - tests - - + + + tests + + + + + src + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 793cfb5..6eaa7cc 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,36 +1,72 @@ - + - + + + + + + $dateFormat + $dateTimeFormat + + setTimezone setTimezone - + - + + + + + $dateFormat + + setTimezone setTimezone - + + + + + + + + $dateFormat + - + + + + + $dateFormat + + setTimezone setTimezone - + + + self::createAllDay($title, $startDate, $numberOfDays) + $property - - modify - clone $from clone $to + + modify + new static($title, $from, $to, $allDay) + + + $presentationOptions + + diff --git a/psalm.xml b/psalm.xml index cb3e980..b71cbbe 100644 --- a/psalm.xml +++ b/psalm.xml @@ -4,6 +4,8 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorLevel="2" + findUnusedBaselineEntry="true" + findUnusedCode="false" findUnusedVariablesAndParams="true" resolveFromConfigFile="true" useDocblockPropertyTypes="true" diff --git a/src/Generators/BaseOutlook.php b/src/Generators/BaseOutlook.php index 15d0434..8f0fc82 100644 --- a/src/Generators/BaseOutlook.php +++ b/src/Generators/BaseOutlook.php @@ -13,6 +13,7 @@ abstract class BaseOutlook implements Generator { /** @var string {@see https://www.php.net/manual/en/function.date.php} */ protected $dateFormat = 'Y-m-d'; + /** @var string {@see https://www.php.net/manual/en/function.date.php} */ protected $dateTimeFormat = 'Y-m-d\TH:i:s\Z'; From ef70059437827b27d056b4eb563d84c0890fde2f Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Fri, 26 Jan 2024 15:10:10 +0530 Subject: [PATCH 2/4] Bump the PHP version to 8.1 normalize composer.json --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index c6eb937..0b5a5bf 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,11 @@ { "name": "spatie/calendar-links", "description": "Generate add to calendar links for Google, iCal and other calendar systems", + "license": "MIT", "keywords": [ "spatie", "calendar-links" ], - "homepage": "https://github.com/spatie/calendar-links", - "license": "MIT", "authors": [ { "name": "Sebastian De Deyne", @@ -15,8 +14,9 @@ "role": "Developer" } ], + "homepage": "https://github.com/spatie/calendar-links", "require": { - "php": "^8.0" + "php": "^8.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.48", @@ -34,14 +34,14 @@ "Spatie\\CalendarLinks\\Tests\\": "tests" } }, + "config": { + "sort-packages": true + }, "scripts": { "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes", "psalm": "vendor/bin/psalm --find-unused-psalm-suppress --output-format=phpstorm", "psalm:ci": "vendor/bin/psalm --find-unused-psalm-suppress --output-format=github --shepherd", "test": "vendor/bin/phpunit", "test:update-snapshots": "vendor/bin/phpunit -d --update-snapshots" - }, - "config": { - "sort-packages": true } } From f178150e4972208b28519d7f5465ff4ea8d9b0e1 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Fri, 26 Jan 2024 15:12:59 +0530 Subject: [PATCH 3/4] Update PHP versions on CI --- .github/workflows/psalm.yml | 3 +-- .github/workflows/run-tests.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 2f8be73..2fa8ac1 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -17,8 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick + php-version: '8.3' coverage: none - name: Cache composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0694d73..1df62a1 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,7 +24,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.0, 8.1, 8.2] + php: [8.1, 8.2, 8.3] dependency-version: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} From cb438e90db11b5b6e20f4ecaed9c39a4e04592bf Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Fri, 26 Jan 2024 15:18:32 +0530 Subject: [PATCH 4/4] Fix tests --- tests/Generators/IcsGeneratorTest.php | 2 +- ...orTest__it_correctly_generates_all_day_events_by_days__1.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Generators/IcsGeneratorTest.php b/tests/Generators/IcsGeneratorTest.php index edaff03..8f4f998 100644 --- a/tests/Generators/IcsGeneratorTest.php +++ b/tests/Generators/IcsGeneratorTest.php @@ -54,7 +54,7 @@ public function it_has_a_product_dtstamp(): void public function it_generates_base64_encoded_link_for_html(): void { $this->assertMatchesSnapshot( - $this->generator([], ['format' => Ics::FORMAT_FILE])->generate($this->createShortEventLink()) + $this->generator([], ['format' => Ics::FORMAT_HTML])->generate($this->createShortEventLink()) ); } diff --git a/tests/Generators/__snapshots__/IcsGeneratorTest__it_correctly_generates_all_day_events_by_days__1.txt b/tests/Generators/__snapshots__/IcsGeneratorTest__it_correctly_generates_all_day_events_by_days__1.txt index d230a35..f159c15 100644 --- a/tests/Generators/__snapshots__/IcsGeneratorTest__it_correctly_generates_all_day_events_by_days__1.txt +++ b/tests/Generators/__snapshots__/IcsGeneratorTest__it_correctly_generates_all_day_events_by_days__1.txt @@ -2,7 +2,7 @@ BEGIN:VCALENDAR VERSION:2.0 PRODID:Spatie calendar-links BEGIN:VEVENT -UID:b4be522f87b9894dadd2b9cd5479136b +UID:a05fc4dac68ae6064aaae69dcdfd60a6 SUMMARY:All day bugs DTSTAMP:20240125 DTSTART:20240125