Skip to content

Modernize baton (Symfony 4 -> 8 etc)#77

Merged
MalteWunsch merged 51 commits into
webfactory:masterfrom
MalteWunsch:203683-modernization
May 19, 2026
Merged

Modernize baton (Symfony 4 -> 8 etc)#77
MalteWunsch merged 51 commits into
webfactory:masterfrom
MalteWunsch:203683-modernization

Conversation

@MalteWunsch
Copy link
Copy Markdown
Member

@MalteWunsch MalteWunsch commented May 14, 2026

This pull request introduces a major modernization and refactor of the codebase, upgrading dependencies, updating project structure to align with current Symfony best practices and using modern Symfony and PHP features.

Main changes:

  • Update Symfony ^4.4 → 8.0, PhpUnit 8 → 13, Doctrine 2 → 3/4
  • Bump PHP requirement to 8.4

Notable improvements:

  • Add types and declare(strict_types=1)
  • Use newer PHP syntax like constructor property promotion, readonly modifiers
  • Use newer Symfony features like attributes instead of annotations, Autowiring
  • Migrate config from YAML to PHP format
    • With the exception of a config.local.yml - while not strictly necessary for baton itself, this is how webfactory's deployment setup currently provides configuration.
  • Move Repositories in namespace outside of Entity/
  • Dissolve AppBundle/update directory structure: AppBundleApp
  • Use Doctrine ORM 3 column type inference
  • Replace DatalistType wrapper with EntityType + block_prefix option
  • Removed deprecated or unused bundles: SensioFrameworkExtraBundle, WebServerBundle, SwiftmailerBundle
    • Also removed doctrine migrations dependency, as it was unused (happy to reintroduce it when we make use of it)

Will be removes in Symfony 5.2
- sensio/framework-extra-bundle -> ^6.1
- composer/composer 1 -> 2

Update code and config accordingly.
- split symfony packages
- doctrine/doctrine-migrations-bundle 2 -> 3
- doctrine/migrations 2 -> 3
- phpunit/phpunit 8 -> 10

Update code and config accordingly:
- remove SensioFrameworkExtraBundle
- use more type hints
- use constructor property promotion
- replace doctrine annotations with attributes
- Require PHP ^8.2
- symfony/* ^6.4 -> ^7.2
- symfony/dotenv ^8.0
- doctrine/orm ^2.5 -> ^3.0
- doctrine/dbal ^4.0
- doctrine/doctrine-bundle ^2.0 -> ^2.13
- enable_annotations → enable_attributes in framework.validation
- enable_native_lazy_objects: true (needed for ORM 3 + symfony/var-exporter 8.x)
- server_version quoted as string (DBAL 4 expects string, not float)
- return type for ImportProjectCommand::execute()
- src/AppBundle/ → src/App/
- Namespace AppBundle\ → App\
- services config
- routing.yml: type annotation → attribute (Symfony 7)
- phpunit.xml.dist: src/App/Tests
- Move templates from src/App/Resources/views/ to templates/
- Plain paths without @appbundle in Twig paths, routing, config
- Remove DependencyInjection\AppExtension, use Kernel to load services
- Use php format for routing files
- Replace auto_mapping with explicit Doctrine mapping config
Add return types to satisfy Symfony 8 interface contracts.
DatalistType was only a workaround for the missing block_prefix option in Symfony < 4.
- use typed properties
- use #[Test]/#[DataProvider] attributes
- add return types
- use arrow functions
- use assertNotEmpty
- add native property types
- add return types
- use arrow functions
- remove @var docblocks
Doctrine 3 with enable_native_lazy_objects supports readonly properties in PHP 8.2.
`enable_attributes` is default in Symfony 7+.
Bump PHP requirement from 8.2 to 8.3
There was only configuration, which this commit removes, too.
@konstantintieber
Copy link
Copy Markdown

Love it

While not strictly necessary for baton itself, this is how webfactory's deployment setup currently provides configuration.
Request::get() was removed in Symfony 7. This method searched multiple sources for data and was removed due to its ambiguity. The replacement for POST data ist `$request->request->get()`.
They do no longer add anything meaningful beyond the type system.
This method was lost when converting them to ServiceEntityRepositories.
@MalteWunsch
Copy link
Copy Markdown
Member Author

Love it

And I love using baton 😄 Thank you very much, Konsti!

@MalteWunsch
Copy link
Copy Markdown
Member Author

The CI job failure is unrelated - we should probably modernize the CI jobs, too, but this is out of scope for now.

@MalteWunsch MalteWunsch marked this pull request as ready for review May 19, 2026 09:33
@MalteWunsch MalteWunsch merged commit 4ec6e9f into webfactory:master May 19, 2026
1 check failed
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