Skip to content

[CI] Test adding PHP 8.4 #2078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
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
11 changes: 3 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
id: changes
run: |
echo "STATUS=$(git status --porcelain)" >> $GITHUB_OUTPUT

- name: No changes found
if: steps.changes.outputs.STATUS == ''
run: |
Expand All @@ -68,7 +67,6 @@ jobs:
components: ${{ steps.components.outputs.components }}
steps:
- uses: actions/checkout@v4

- id: components
run: |
components=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | jq -R -s -c 'split("\n")[:-1] | map(. | sub("^src/";"")) | sort')
Expand All @@ -81,12 +79,14 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.3']
php-version: ['8.1', '8.3', '8.4']
include:
- php-version: '8.1'
dependency-version: 'lowest'
- php-version: '8.3'
dependency-version: 'highest'
- php-version: '8.4'
dependency-version: 'highest'
component: ${{ fromJson(needs.tests-php-components.outputs.components )}}
exclude:
- component: Map # does not support PHP 8.1
Expand All @@ -101,27 +101,22 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Install root packages
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}
dependency-versions: ${{ matrix.dependency-version }}

- name: Build root packages
run: php .github/build-packages.php
working-directory: ${{ github.workspace }}

- name: Install ${{ matrix.component }} packages
uses: ramsey/composer-install@v3
with:
working-directory: "src/${{ matrix.component }}"
dependency-versions: ${{ matrix.dependency-version }}

- name: ${{ matrix.component }} Tests
working-directory: "src/${{ matrix.component }}"
run: vendor/bin/simple-phpunit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ public function __construct(private ManagerRegistry $doctrine)
{
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
[, $id] = \explode(':', $data);
[, $id] = explode(':', $data);

return $this->doctrine->getRepository(Entity2::class)->find($id);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return Entity2::class === $type;
}

public function normalize(mixed $object, string $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
public function normalize(mixed $object, ?string $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
{
return 'entity2:'.$object->id;
}

public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof Entity2;
}
Expand Down
14 changes: 7 additions & 7 deletions src/LiveComponent/tests/Fixtures/Serializer/MoneyNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@

final class MoneyNormalizer implements NormalizerInterface, DenormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): Money
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Money
{
return new Money(...\explode('|', $data));
return new Money(...explode('|', $data));
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return Money::class === $type;
}

public function normalize(mixed $object, string $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
public function normalize(mixed $object, ?string $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
{
return \implode('|', [$object->amount, $object->currency]);
return implode('|', [$object->amount, $object->currency]);
}

public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof Money;
}

public function getSupportedTypes(string $format = null): array
public function getSupportedTypes(?string $format = null): array
{
return [Money::class => true];
}
Expand Down