Skip to content

Use AbstractBundle and PHP service definitions #86

Backlog

Description

@njoubert-cleverage

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] (tag cleverage.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 empty configure() tree then rejects them). Remove CleverAgeCacheProcessExtension and Configuration.
  • Configuration root: keep cleverage_cache_process. AbstractBundle guesses clever_age_cache_process from the
    class name: set protected 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 _defaults stay 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.environment and kernel.build_dir parameters with
    Symfony 6.4 / 7.4 (ExtensionTrait), unlike 8.x: build the test containers with them (process-bundle uses a
    tests/DependencyInjection/ExtensionLoader helper), 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.md lines that name the YAML service files or the removed classes.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

  • Major: CleverAgeCacheProcessExtension and Configuration are removed. Both are @internal and used nowhere outside the bundle.
  • None for applications: same configuration root, same service ids and definitions.

Activity

  1. added this to the v3.0 milestone on Dec 2, 2026
  2. added
    enhancement
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions