From a3a0f6460be4dbca6a18609e92f0b981da93e15d Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Tue, 10 Mar 2026 16:12:03 +0100 Subject: [PATCH 1/4] TASK: Add Readme and build yaml --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ .gitignore | 6 +++++- README.md | 31 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 README.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7741d6e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: build + +on: + push: + branches: + - 'main' + pull_request: + branches: + - 'main' + +jobs: + test: + name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})" + + strategy: + fail-fast: false + matrix: + php-versions: [ '8.2', '8.4' ] + neos-versions: [ '8.3', '8.4' ] + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: ${{ env.FLOW_FOLDER }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite + ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on + + - name: Set Neos Version + run: composer require neos/neos ^${{ matrix.neos-versions }} --no-progress --no-interaction + + - name: Lint + run: composer lint + + - name: Stan + run: composer analyze diff --git a/.gitignore b/.gitignore index 12dc185..fbb087d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ **/node_modules/** node_modules **/lib/ -.yarn \ No newline at end of file +.yarn + +composer.lock +Packages +vendor diff --git a/README.md b/README.md new file mode 100644 index 0000000..4902ed7 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Sitegeist.GroundhogDay + +> NodeTypes and PHP Tools for Events including recurrence rules +> based on RFC 5545 - iCalendar + +## Authors & Sponsors + +* Bernhard Schmitt + +_The development and the public-releases of this package is generously sponsored by our employer http://www.sitegeist.de._ + +## Installation + +Sitegeist.GroundhogDay is available via packagist: +```shell +composer require sitegeist/groundhogday +``` + +## Usage + +# to be written + +## Contributions + +We will gladly accept contributions. Please send us pull requests. + +In lieu of a formal styleguide, take care to maintain the existing coding style. Please make sure to contribute [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) compliant sources. + +## License + +See [LICENSE.md](./LICENSE.md) From 902c9e80b80fcb20a3a014a204c83f17591a756f Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Tue, 10 Mar 2026 16:25:34 +0100 Subject: [PATCH 2/4] TASK: Make linter happy --- .gitignore | 2 ++ Classes/Domain/StartDateIsMissing.php | 3 ++- Classes/Infrastructure/CalendarIsMissing.php | 3 ++- Classes/Infrastructure/LocationIsMissing.php | 3 ++- README.md | 6 ++++++ .../Unit/Domain/EventOccurrenceSpecificationTest.php | 11 +++++++++-- composer.json | 5 +++-- 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index fbb087d..018952d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ node_modules composer.lock Packages vendor +bin +Build diff --git a/Classes/Domain/StartDateIsMissing.php b/Classes/Domain/StartDateIsMissing.php index 43655f2..b6101a0 100644 --- a/Classes/Domain/StartDateIsMissing.php +++ b/Classes/Domain/StartDateIsMissing.php @@ -8,7 +8,8 @@ final class StartDateIsMissing extends \InvalidArgumentException { public static function butWasRequired(string $attemptedValue): self { - return new self('Start date is missing in value ' . $attemptedValue + return new self( + 'Start date is missing in value ' . $attemptedValue . ', must contain a DTSTART: line', 1746602782 ); diff --git a/Classes/Infrastructure/CalendarIsMissing.php b/Classes/Infrastructure/CalendarIsMissing.php index 96181b9..2eec24e 100644 --- a/Classes/Infrastructure/CalendarIsMissing.php +++ b/Classes/Infrastructure/CalendarIsMissing.php @@ -10,7 +10,8 @@ final class CalendarIsMissing extends \RuntimeException { public static function butWasRequired(NodeAggregateIdentifier $eventId): self { - return new self('Failed to resolve calendar ID for event ' + return new self( + 'Failed to resolve calendar ID for event ' . $eventId . ', one of its ancestors must be a calendar', 1745919357 ); diff --git a/Classes/Infrastructure/LocationIsMissing.php b/Classes/Infrastructure/LocationIsMissing.php index e02dd02..2140c58 100644 --- a/Classes/Infrastructure/LocationIsMissing.php +++ b/Classes/Infrastructure/LocationIsMissing.php @@ -10,7 +10,8 @@ final class LocationIsMissing extends \RuntimeException { public static function butWasRequired(NodeAggregateIdentifier $eventId): self { - return new self('Failed to resolve location time zone for event ' + return new self( + 'Failed to resolve location time zone for event ' . $eventId . ', one of its ancestors must be a location', 1746795172 ); diff --git a/README.md b/README.md index 4902ed7..c56d7fa 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ composer require sitegeist/groundhogday ## Usage +### NodeTypes + +- Sitegeist.GroundhogDay:Mixin.Calendar +- Sitegeist.GroundhogDay:Mixin.Event +- Sitegeist.GroundhogDay:Mixin.Location + # to be written ## Contributions diff --git a/Tests/Unit/Domain/EventOccurrenceSpecificationTest.php b/Tests/Unit/Domain/EventOccurrenceSpecificationTest.php index 029d59b..8aa0dda 100644 --- a/Tests/Unit/Domain/EventOccurrenceSpecificationTest.php +++ b/Tests/Unit/Domain/EventOccurrenceSpecificationTest.php @@ -28,7 +28,7 @@ public function testFromArray(array $array, EventOccurrenceSpecification $expect } /** - * @return iterable, expectedSpecification: EventOccurrenceSpecification}> + * @return iterable, expectedSpecification: EventOccurrenceSpecification}> */ public static function arrayProvider(): iterable { @@ -115,6 +115,9 @@ public function testResolveDates( ); } + /** + * @return iterable + */ public static function resolvedDatesProvider(): iterable { yield 'only startDate, no afterDate' => [ @@ -349,6 +352,10 @@ public static function resolvedDatesProvider(): iterable private static function createDateTime(string $date): \DateTimeImmutable { - return \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date, new \DateTimeZone('UTC')); + $date = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date, new \DateTimeZone('UTC')); + if ($date instanceof \DateTimeImmutable) { + return $date; + } + throw new \Exception('invalid date string: "' . $date . '"'); } } diff --git a/composer.json b/composer.json index 032532f..0ed9914 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,15 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "phpstan/phpstan": "^2.1", + "phpstan/phpstan": "^1.12", "neos/buildessentials": "^8.3", "mikey179/vfsstream": "^1.6", "squizlabs/php_codesniffer": "^3.6" }, "scripts": { + "fix": "bin/phpcbf --standard=PSR12 --extensions=php --exclude=Generic.Files.LineLength Classes/ Tests/", "lint": "bin/phpcs --standard=PSR12 --extensions=php --exclude=Generic.Files.LineLength Classes/ Tests/", - "analyse": "bin/phpstan analyse --level 9 Tests/Unit Classes", + "analyse": "bin/phpstan analyse --level 8 Tests/Unit Classes", "test:unit": "bin/phpunit -c phpunit.xml --enforce-time-limit --coverage-html Build/Reports/coverage Tests", "test:functional": [ "FLOW_CONTEXT=Testing bin/phpunit --colors --stop-on-failure -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Tests/Functional" From 0be08e0b699f9a010d84dfb05237c5dc395c9250 Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Tue, 10 Mar 2026 16:36:51 +0100 Subject: [PATCH 3/4] DOCS: Adjust readme --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c56d7fa..e96da78 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,13 @@ > NodeTypes and PHP Tools for Events including recurrence rules > based on RFC 5545 - iCalendar +The package will calculate all future occurences for the next Year based on the contained nodeType mixins. +The PHP class `Sitegeist\GroundhogDay\Domain\EventOccurrenceRepository` can be used to fetch events +based on calendar, location and time-period. + ## Authors & Sponsors -* Bernhard Schmitt +* Bernhard Schmitt - schmitt@sitegeist.de _The development and the public-releases of this package is generously sponsored by our employer http://www.sitegeist.de._ From 97c011899311e1385377df612b332d8f3f2a9fdb Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Tue, 10 Mar 2026 16:48:27 +0100 Subject: [PATCH 4/4] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7741d6e..4ee1f20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,4 +40,4 @@ jobs: run: composer lint - name: Stan - run: composer analyze + run: composer analyse