Skip to content

Symfony 8 support#44

Open
1ed wants to merge 11 commits into
Elao:masterfrom
1ed:symfony-8.x
Open

Symfony 8 support#44
1ed wants to merge 11 commits into
Elao:masterfrom
1ed:symfony-8.x

Conversation

@1ed

@1ed 1ed commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Adds support for Symfony 8 and removes support for unmaintained versions.

@1ed

1ed commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Cloud someone merge this and release a new version please? @maximecolin @benji07 @Tom32i

@maximecolin maximecolin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR 🙏 The migration is clean and consistent (Extension namespace fix, DI configs moved to PHP, composer/CI bumps). A few remarks to address before merging — especially points 1 and 2 in the inline comments; the rest can be follow-ups.

Also: dropping Symfony 7.0–7.3 support (keeping only ^6.4 and ^7.4 LTS + ^8.0) is worth mentioning explicitly in the release notes of the next version. And the README is outdated (Symfony 4.0 badge, AppKernel.php instructions) — pre-existing debt, but this would be a good time to refresh it.

Comment thread Form/Extension/TreeAwareExtension.php Outdated

/**
* @param array<string,mixed> &$vars
* @param array<mixed> &$vars

@maximecolin maximecolin Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This downgrade from array<string,mixed> to array<mixed> looks like an unnecessary loss of precision: $vars receives $view->vars, which is string-keyed. It also creates an inconsistency with optionEquals() just below, which keeps array<string,mixed>. Could you revert to array<string,mixed>? (and if phpstan was complaining, it's worth understanding why)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

$vars passed by reference so the method can change the type, and PropertyAccessor's setValue typed with object|array<mixed> which is looser

I added @param-out array<mixed> $vars which is ok by phpstan.

@@ -30,7 +30,7 @@ protected function setUp(): void
/**
* Get Form Type Extensions
*
* @return array<FormTypeExtensionInterface>
* @return array<FormTypeExtensionInterface<Extension\TreeAwareExtension>>

@maximecolin maximecolin Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FormTypeExtensionInterface is not generic in Symfony core, so the template parameter <Extension\TreeAwareExtension> is semantically empty (Lint passes, so not fatal, but misleading). The previous array<FormTypeExtensionInterface> was clearer — shall we revert to it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PhpStan's symfony-extension adds the type:

Image

without it:

Image

Comment thread .github/workflows/ci.yaml Outdated
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.2'

@maximecolin maximecolin Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting is usually run on the highest supported PHP version. Is this change from 8.3 to 8.2 intentional? (8.3+ would catch recent deprecations better)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
Setting PHP_CS_FIXER_IGNORE_ENV environment variable is deprecated and will be removed in 4.0, use unsupportedPhpVersionAllowed config instead.
You are running PHP CS Fixer on PHP 8.5.7, but the minimum PHP version supported by your project in composer.json is PHP 8.2. Executing PHP CS Fixer on newer PHP versions may introduce syntax or features not yet available in PHP 8.2, which could cause issues under that version. It is recommended to run PHP CS Fixer on PHP 8.2, to fit your project specifics.
If you need help while solving warnings, ask at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/discussions/, we will help you!

Comment thread .php-cs-fixer.php
'simplified_null_return' => false,
'void_return' => true,
'yoda_style' => [],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],

@maximecolin maximecolin Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling yoda_style is a style change unrelated to SF8 support (scope creep). Nothing blocking, but it would ideally belong in a dedicated commit/PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was required by php-cs-fixer to configure it explicitly.

@1ed 1ed left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast review.

Comment thread .github/workflows/ci.yaml Outdated
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.2'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
Setting PHP_CS_FIXER_IGNORE_ENV environment variable is deprecated and will be removed in 4.0, use unsupportedPhpVersionAllowed config instead.
You are running PHP CS Fixer on PHP 8.5.7, but the minimum PHP version supported by your project in composer.json is PHP 8.2. Executing PHP CS Fixer on newer PHP versions may introduce syntax or features not yet available in PHP 8.2, which could cause issues under that version. It is recommended to run PHP CS Fixer on PHP 8.2, to fit your project specifics.
If you need help while solving warnings, ask at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/discussions/, we will help you!

@@ -30,7 +30,7 @@ protected function setUp(): void
/**
* Get Form Type Extensions
*
* @return array<FormTypeExtensionInterface>
* @return array<FormTypeExtensionInterface<Extension\TreeAwareExtension>>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PhpStan's symfony-extension adds the type:

Image

without it:

Image

Comment thread Form/Extension/TreeAwareExtension.php Outdated

/**
* @param array<string,mixed> &$vars
* @param array<mixed> &$vars

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

$vars passed by reference so the method can change the type, and PropertyAccessor's setValue typed with object|array<mixed> which is looser

I added @param-out array<mixed> $vars which is ok by phpstan.

Comment thread .php-cs-fixer.php
'simplified_null_return' => false,
'void_return' => true,
'yoda_style' => [],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was required by php-cs-fixer to configure it explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants