Skip to content

Add Symfony 8 compatibility#150

Open
AntoineTesson wants to merge 1 commit intoacseo:masterfrom
AntoineTesson:feature/symfony8-compatibility
Open

Add Symfony 8 compatibility#150
AntoineTesson wants to merge 1 commit intoacseo:masterfrom
AntoineTesson:feature/symfony8-compatibility

Conversation

@AntoineTesson
Copy link
Contributor

Summary

This PR adds full Symfony 8 compatibility to the TypesenseBundle:

  • Replace XmlFileLoader with PhpFileLoaderXmlFileLoader is removed in Symfony 8. Service definitions are now in services.php using the Configurator pattern.
  • Add #[AsCommand] attribute to CreateCommand and ImportCommand — the deprecated $defaultName static property is removed.
  • Add : void return type to configure() methods — required by Symfony 8's stricter type enforcement.
  • Update composer.json constraints — support symfony/* ^8.0, PHP ^8.1, and typesense/typesense-php ^6.0.

Backward compatibility

  • Fully backward-compatible with Symfony 5.4, 6.x, and 7.x
  • The PHP Configurator syntax works on Symfony 5.4+
  • #[AsCommand] is supported since Symfony 6.1 (and ignored on earlier versions)
  • PHP 8.1+ is required (previously ^7.4)

Changes

File Change
composer.json Updated constraints for SF8, PHP ^8.1, typesense-php ^6.0
src/Command/CreateCommand.php #[AsCommand], removed $defaultName, configure(): void
src/Command/ImportCommand.php #[AsCommand], removed $defaultName, configure(): void
src/DependencyInjection/ACSEOTypesenseExtension.php PhpFileLoader instead of XmlFileLoader
src/Resources/config/services.php New — PHP service config (replaces services.xml)
src/Resources/config/services.xml Deleted

Context

PR #149 (merged) updated composer.json constraints to allow SF8 but didn't address actual code incompatibilities. This PR fixes the remaining runtime issues that prevented the bundle from booting on Symfony 8.

🤖 Generated with Claude Code

- Replace XmlFileLoader with PhpFileLoader (XmlFileLoader removed in SF8)
- Convert services.xml to services.php using Configurator pattern
- Add #[AsCommand] attribute to CreateCommand and ImportCommand
- Add : void return type to configure() methods
- Remove deprecated $defaultName static property from commands
- Update composer.json constraints to support Symfony ^8.0
- Update PHP requirement to ^8.1
- Support typesense-php ^6.0 alongside ^4.5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant