Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ See [keep a changelog] for information about writing changes to this log.

## [Unreleased]

- [PR-71](https://github.com/itk-dev/event-database-api/pull/71)
Require PHP 8.5 and apply the Rector PHP 8.5 rules

- [PR-70](https://github.com/itk-dev/event-database-api/pull/70)
Update the docker compose template (itk-version 3.2.4) and the PHP 8.5 image

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ API platform front-end for the Danish event database used by the municipality of
`docker-compose.yml` is part of the standard ITK Dev Symfony image but is **not used for domain data** (the
`migrations/` and `src/Entity/` directories are empty).

Stack: PHP 8.3+, Symfony 7.4, API Platform 4.3, Elasticsearch 8.x. Runs entirely in Docker via
Stack: PHP 8.5+, Symfony 7.4, API Platform 4.3, Elasticsearch 8.x. Runs entirely in Docker via
`itkdev/php8.5-fpm` + nginx.

## Common commands
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "proprietary",
"type": "project",
"require": {
"php": ">=8.3",
"php": ">=8.5",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "~4.3.0",
Expand Down
9 changes: 5 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Coding style and import (`use`) management are owned by php-cs-fixer
// (PostToolUse hook / coding standards), so Rector does not touch them.
//
// Modernize to the language level declared in composer.json (PHP >= 8.3).
// Modernize to the language level declared in composer.json (PHP >= 8.5).
->withPhpSets()
// Version-based upgrade + quality rules resolved from the installed package
// versions (Symfony 7.4, PHPUnit 13). No domain Doctrine here — the entities
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ApiKeysAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
*/
private function parseApiKeys(string $contents): array
{
$value = (new Dotenv())->parse($contents)[self::ENV_VAR] ?? '[]';
$value = new Dotenv()->parse($contents)[self::ENV_VAR] ?? '[]';

return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ElasticSearch/ElasticIndexException.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private function parse400(string $message): string
$message = json_decode($message, false, 512, JSON_THROW_ON_ERROR);

// Convert snake_case type to readable format (e.g., "parse_exception" -> "Parse exception")
$type = (new UnicodeString($message->error->root_cause[0]->type))
$type = new UnicodeString($message->error->root_cause[0]->type)
->replace('_', ' ')
->title()
->toString();
Expand Down
3 changes: 2 additions & 1 deletion tests/ApiPlatform/AbstractApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

abstract class AbstractApiTestCase extends ApiTestCase
{
#[\Override]
protected static ?bool $alwaysBootKernel = false;

protected static string $requestPath;
Expand Down Expand Up @@ -52,7 +53,7 @@ protected function get(array $query, ?string $path = null, bool $authenticated =

protected static function formatDateTime(string $datetime): string
{
return (new \DateTimeImmutable($datetime))->format(\DateTimeImmutable::ATOM);
return new \DateTimeImmutable($datetime)->format(\DateTimeImmutable::ATOM);
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
final class AuthenticationTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('protectedEndpointProvider')]
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Consumer/AarhusguidenContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
final class AarhusguidenContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/daily_occurrences';

// Calendar / tag view: public events carrying a tag, within a date window,
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Consumer/Os2displayContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
final class Os2displayContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/occurrences';

// Subscription poster: upcoming occurrences (end[gt]) for a tag/location.
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Contract/CollectionContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
final class CollectionContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('collectionProvider')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
final class ContentNegotiationContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

public function testLdJsonIsSupported(): void
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Contract/DateFormatContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
final class DateFormatContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

private const string ISO_8601_OFFSET = '/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}$/';
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Contract/ErrorContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
final class ErrorContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

public function testUnauthenticatedErrorShape(): void
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/Contract/ItemContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
final class ItemContractTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('collectionWrappedItemProvider')]
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/DailyOccurrencesFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
final class DailyOccurrencesFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/daily_occurrences';

#[DataProvider('getDailyOccurrencesProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/DailyOccurrencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ final class DailyOccurrencesTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/daily_occurrences';

#[\Override]
protected static string $resourceClass = DailyOccurrence::class;

// Members are the raw Elasticsearch _source with no @id/@type, so API
// Platform's self-generated collection schema does not apply (see D6).
#[\Override]
protected static bool $assertsGeneratedCollectionSchema = false;

#[\Override]
protected static int|string $itemId = 10;
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/EventsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
final class EventsFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('getEventsProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ final class EventsTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/events';

#[\Override]
protected static string $resourceClass = Event::class;

// Members are the raw Elasticsearch _source with no @id/@type, so API
// Platform's self-generated collection schema does not apply (see D6).
#[\Override]
protected static bool $assertsGeneratedCollectionSchema = false;

#[\Override]
protected static int|string $itemId = 7;
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/FilterErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
final class FilterErrorTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('invalidDateRangeProvider')]
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/LocationsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
final class LocationsFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/locations';

#[DataProvider('getLocationsProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/LocationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ final class LocationsTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/locations';

#[\Override]
protected static string $resourceClass = Location::class;

// Members are the raw Elasticsearch _source with no @id/@type, so API
// Platform's self-generated collection schema does not apply (see D6).
#[\Override]
protected static bool $assertsGeneratedCollectionSchema = false;

#[\Override]
protected static int|string $itemId = 4;
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/OccurrencesFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
final class OccurrencesFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/occurrences';

#[DataProvider('getOccurrencesProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/OccurrencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ final class OccurrencesTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/occurrences';

#[\Override]
protected static string $resourceClass = Occurrence::class;

// Members are the raw Elasticsearch _source with no @id/@type, so API
// Platform's self-generated collection schema does not apply (see D6).
#[\Override]
protected static bool $assertsGeneratedCollectionSchema = false;

#[\Override]
protected static int|string $itemId = 10;
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/OrganizationsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
final class OrganizationsFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/organizations';

#[DataProvider('getOrganizationsProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/OrganizationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ final class OrganizationsTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/organizations';

#[\Override]
protected static string $resourceClass = Organization::class;

// Members are the raw Elasticsearch _source with no @id/@type, so API
// Platform's self-generated collection schema does not apply (see D6).
#[\Override]
protected static bool $assertsGeneratedCollectionSchema = false;

#[\Override]
protected static int|string $itemId = 9;
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
final class PaginationTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

#[DataProvider('resourceProvider')]
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/SortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
final class SortTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/events';

public function testEventsAreSortedByTitleAscending(): void
Expand Down
1 change: 1 addition & 0 deletions tests/ApiPlatform/TagsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
final class TagsFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/tags';

#[DataProvider('getTagsProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/TagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ final class TagsTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/tags';

#[\Override]
protected static string $resourceClass = Tag::class;

#[\Override]
protected static int|string $itemId = 'aros';

#[\Override]
protected static int|string $unknownItemId = 'no-such-tag-slug';
}
1 change: 1 addition & 0 deletions tests/ApiPlatform/VocabulariesFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
final class VocabulariesFilterTest extends AbstractApiTestCase
{
#[\Override]
protected static string $requestPath = '/api/v2/vocabularies';

#[DataProvider('getVocabulariesProvider')]
Expand Down
4 changes: 4 additions & 0 deletions tests/ApiPlatform/VocabulariesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ final class VocabulariesTest extends AbstractApiTestCase
use GetEntitiesTestTrait;
use GetItemTestTrait;

#[\Override]
protected static string $requestPath = '/api/v2/vocabularies';

#[\Override]
protected static string $resourceClass = Vocabulary::class;

#[\Override]
protected static int|string $itemId = 'aarhusguiden';

#[\Override]
protected static int|string $unknownItemId = 'no-such-vocabulary-slug';
}
4 changes: 2 additions & 2 deletions tests/Command/ApiKeysAddCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testReplacesMultiLineValueAndKeepsOtherLines(): void
$this->assertFileDoesNotExist($this->dir.'/.env.local.backup');
$this->assertFileDoesNotExist($this->dir.'/.env.local.temp');

$env = (new Dotenv())->parse((string) file_get_contents($this->dir.'/.env.local'));
$env = new Dotenv()->parse((string) file_get_contents($this->dir.'/.env.local'));
$this->assertSame('http://elasticsearch:9200', $env['INDEX_URL']);
$this->assertSame('value', $env['OTHER']);
$keys = $this->keys();
Expand Down Expand Up @@ -181,7 +181,7 @@ private function runCommand(string $username, array $answers = []): CommandTeste
*/
private function keys(): array
{
$env = (new Dotenv())->parse((string) file_get_contents($this->dir.'/.env.local'));
$env = new Dotenv()->parse((string) file_get_contents($this->dir.'/.env.local'));

return json_decode((string) $env['APP_API_KEYS'], true, 512, JSON_THROW_ON_ERROR);
}
Expand Down
Loading
Loading