Repository navigation
Backlog
Labels
enhancementNew feature or request
Milestone
Description
Description
Bridge step of cleverage/process-bundle#277 (done in cleverage/process-bundle#516 for the bundle v6.0).
The bundle uses the Bundle + Extension + Configuration triplet (CleverAgeCacheProcessBundle, CleverAgeCacheProcessExtension,
Configuration, the last two @internal) and YAML service definitions. Since Symfony 6.1, the
recommended way is a
single AbstractBundle class, and the
best practices for reusable bundles recommend
PHP service definitions (checked by static analysis, faster to load).
Proposed fix
CleverAgeCacheProcessBundle extends AbstractBundle:configure()holds the configuration tree (empty), and
loadExtension()the loading of the services, the autoconfiguration of#[AsCacheAdapter](tagcleverage.cache.adapter) and the deprecation of the configuration keys, ignored since 2.3 (moved as is, or removed with the other deprecations of 3.0 if that is done first: the emptyconfigure()tree then rejects them). RemoveCleverAgeCacheProcessExtensionandConfiguration.- Configuration root: keep
cleverage_cache_process. AbstractBundle guessesclever_age_cache_processfrom the
class name: setprotected string $extensionAlias = 'cleverage_cache_process';. - Services: one PHP file per YAML file, same service ids, aliases and definitions (
config/services/registry.yaml,task.yaml→registry.php,task.php). In PHP, the
defaults()of a file apply to every service written after them in that file: keep one file per former YAML file so
that_defaultsstay limited to their file. - Import the service files with an absolute path (
$container->import(__DIR__.'/../config/services/*.php')) and keep
getPath()returning\dirname(__DIR__): AbstractBundle resolves a relative path, and guesses the path, from the
file of the actual class, so a class extending the bundle would no longer load the services (found in
#277 - Use AbstractBundle and PHP service definitions process-bundle#516). - Keep
getContainerExtension(): ExtensionInterface(AbstractBundle declares?ExtensionInterface). - Tests: the extension of an AbstractBundle requires the
kernel.environmentandkernel.build_dirparameters with
Symfony 6.4 / 7.4 (ExtensionTrait), unlike 8.x: build the test containers with them (process-bundle uses a
tests/DependencyInjection/ExtensionLoaderhelper), and run the suite with the lowest and the highest dependencies.
Update the#[CoversClass]/#[UsesClass]attributes, and the tests or test kernel that read the YAML files. - Add
config/to the paths of PHPStan, Rector and PHP-CS-Fixer. - Prove that nothing changes: dump the container loaded by the extension (
YamlDumper, plus
getAutoconfiguredInstanceof()/getAttributeAutoconfigurators()) and the configuration reference
(YamlReferenceDumper) before and after, with the lowest and the highest Symfony version, and give the (empty) diff
in the pull request. - Update the messages, docs and
UPGRADE.mdlines that name the YAML service files or the removed classes.
Requirements
- Documentation updates
- Reference
- Cookbooks
- Changelog
- Unit tests
Breaking changes
- Major:
CleverAgeCacheProcessExtensionandConfigurationare removed. Both are@internaland used nowhere outside the bundle. - None for applications: same configuration root, same service ids and definitions.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity