Skip to content

Commit 82217b4

Browse files
committed
Add Symfony 7.0 support
1 parent 39acb86 commit 82217b4

File tree

10 files changed

+52
-9
lines changed

10 files changed

+52
-9
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ jobs:
5959
- uses: actions/checkout@v2
6060
- uses: ./.github/actions/ci-env
6161
- run: bin/ci/phpunit ${{ matrix.php }} ${{ matrix.symfony }}
62+
63+
phpunit-symfony-7:
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
php: [--php=8.2, --php=8.3]
68+
steps:
69+
- uses: actions/checkout@v2
70+
- uses: ./.github/actions/ci-env
71+
- run: bin/ci/phpunit ${{ matrix.php }} --symfony=7.0

bin/ci/phpstan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if [ "${clearCache}" == true ] && [ -d "${ROOT_DIR}"/var/ci/phpstan ]; then
2626
fi
2727

2828
if [ "${phpVersion}" == "" ]; then
29-
php8.1 "${ROOT_DIR}"/bin/ci/phpstan.php ${phpstanParameters}
29+
php8.2 "${ROOT_DIR}"/bin/ci/phpstan.php ${phpstanParameters}
3030
else
3131
echo "PHP ${phpVersion}"
3232

bin/ci/phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ for arg in "${@}"; do
2020
done
2121

2222
if [ "${phpVersion}" == "" ] || [ "${symfonyVersion}" == "" ]; then
23-
php8.1 "${ROOT_DIR}"/bin/ci/phpunit.php "${@}"
23+
php8.2 "${ROOT_DIR}"/bin/ci/phpunit.php "${@}"
2424
else
2525
echo "PHP ${phpVersion} - Symfony ${symfonyVersion}"
2626

bin/ci/phpunit-coverage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
99
echo "PHP 8.1 - Symfony 6.1"
1010
set +e
1111
XDEBUG_MODE=coverage \
12-
php8.1 \
12+
php8.2 \
1313
"${ROOT_DIR}"/vendor/bin/phpunit \
1414
--bootstrap "${COMPOSER_HOME_SYMFONY_6_1}"/vendor/autoload.php \
1515
--coverage-html "${ROOT_DIR}"/var/ci/phpunit/coverage/html \

bin/ci/phpunit.inc.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ function createPhpunitProcesses(string $phpVersion = null, string $symfonyVersio
1212
{
1313
$phpVersions = new StringCollection(is_string($phpVersion) ? [$phpVersion] : ['8.1', '8.2', '8.3']);
1414
$symfonyVersions = new StringCollection(
15-
is_string($symfonyVersion) ? [$symfonyVersion] : ['6.1', '6.2', '6.3', '6.4']
15+
is_string($symfonyVersion) ? [$symfonyVersion] : ['6.1', '6.2', '6.3', '6.4', '7.0']
1616
);
1717

1818
$return = new ProcessInterfaceCollection();
1919
foreach ($phpVersions->toArray() as $loopPhpVersion) {
2020
foreach ($symfonyVersions->toArray() as $loopSymfonyVersion) {
21+
if ($loopSymfonyVersion === '7.0' && in_array($loopPhpVersion, ['8.2', '8.3'], true) === false) {
22+
continue;
23+
}
2124
$return->add(createPhpunitProcess($loopPhpVersion, $loopSymfonyVersion));
2225
}
2326
}

bin/ci/validate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
66
. "${ROOT_DIR}"/bin/common.inc.sh
77
. "${ROOT_DIR}"/bin/dockerise.inc.bash
88

9-
php8.1 "${ROOT_DIR}"/bin/ci/validate.php "${@}"
9+
php8.2 "${ROOT_DIR}"/bin/ci/validate.php "${@}"

bridge/Symfony/Normalizer/ObjectCollectionDenormalizer.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,23 @@ class ObjectCollectionDenormalizer implements DenormalizerInterface, Denormalize
1919
{
2020
use DenormalizerAwareTrait;
2121

22-
public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
22+
/** @param array<mixed> $context */
23+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
2324
{
2425
return
2526
is_subclass_of($type, AbstractObjectCollection::class)
2627
|| is_subclass_of($type, AbstractObjectNullableCollection::class);
2728
}
2829

30+
/** @return array<class-string|'*'|'object'|string, bool|null> */
31+
public function getSupportedTypes(?string $format): array
32+
{
33+
return [
34+
AbstractObjectCollection::class => false,
35+
AbstractObjectNullableCollection::class => false
36+
];
37+
}
38+
2939
/**
3040
* @param array<mixed> $context
3141
* @return AbstractObjectCollection<object>|AbstractObjectNullableCollection<object|null>

bridge/Symfony/Normalizer/ScalarCollectionDenormalizer.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
class ScalarCollectionDenormalizer implements DenormalizerInterface
1919
{
20-
public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
20+
/** @param array<mixed> $context */
21+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
2122
{
2223
return in_array(
2324
$type,
@@ -33,6 +34,19 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
3334
);
3435
}
3536

37+
/** @return array<class-string|'*'|'object'|string, bool|null> */
38+
public function getSupportedTypes(?string $format): array
39+
{
40+
return [
41+
FloatCollection::class => false,
42+
FloatNullableCollection::class => false,
43+
IntegerCollection::class => false,
44+
IntegerNullableCollection::class => false,
45+
StringCollection::class => false,
46+
StringNullableCollection::class => false
47+
];
48+
}
49+
3650
/**
3751
* @param array<mixed> $context
3852
* @return CollectionInterface<float|integer|string|null>

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
### master
22

3+
- Add support for Symfony `7.0`
4+
35
### [6.0.1](../../compare/6.0.0...6.0.1) - 2024-05-15
46

57
- Documentation

docker/ci/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENV COMPOSER_HOME_SYMFONY_6_1=/composer/symfony-6-1
77
ENV COMPOSER_HOME_SYMFONY_6_2=/composer/symfony-6-2
88
ENV COMPOSER_HOME_SYMFONY_6_3=/composer/symfony-6-3
99
ENV COMPOSER_HOME_SYMFONY_6_4=/composer/symfony-6-4
10+
ENV COMPOSER_HOME_SYMFONY_7_0=/composer/symfony-7-0
1011
ENV PHPSTAN_BIN_PATH=/usr/local/bin/phpstan
1112

1213
COPY docker/ci/composer.json ${COMPOSER_HOME}/composer.json
@@ -26,11 +27,11 @@ RUN \
2627
php8.3-cli \
2728
php8.3-simplexml \
2829
# For Composer
29-
curl zip php8.1-curl php8.1-zip \
30+
curl zip php8.1-curl php8.1-zip php8.2-curl php8.2-zip \
3031
# For unused-scanner and phpunit
3132
php8.1-mbstring php8.2-mbstring php8.3-mbstring \
3233
# For coverage
33-
php8.1-xdebug \
34+
php8.2-xdebug \
3435
&& update-alternatives --set php /usr/bin/php8.1 \
3536

3637
# Install CI tools
@@ -47,6 +48,9 @@ RUN \
4748
&& COMPOSER_HOME=${COMPOSER_HOME_SYMFONY_6_3} composer global require symfony/serializer:6.3.* \
4849
&& COMPOSER_HOME=${COMPOSER_HOME_SYMFONY_6_4} composer global require symfony/serializer:6.4.* \
4950

51+
&& update-alternatives --set php /usr/bin/php8.2 \
52+
&& COMPOSER_HOME=${COMPOSER_HOME_SYMFONY_7_0} composer global require symfony/serializer:7.0.* \
53+
5054
# Purge
5155
&& apt-get purge -y software-properties-common \
5256
&& apt-get autoremove -y \

0 commit comments

Comments
 (0)