Skip to content

Replace illuminate/container with entropy container#13

Open
TomasVotruba wants to merge 1 commit into
mainfrom
migrate-container-to-entropy
Open

Replace illuminate/container with entropy container#13
TomasVotruba wants to merge 1 commit into
mainfrom
migrate-container-to-entropy

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Migrates the dependency-injection container from illuminate/container to entropy/entropy's container, and removes illuminate/container (and its patch) entirely.

Depends on TomasVotruba/entropy#8 (entropy gains Container::build() and becomes extendable). entropy is temporarily pinned to that feature branch via a VCS repositories entry; once #8 is merged this should revert to dev-main / a tagged release and the repositories entry removed.

What changed

  • ECSConfig now extends Entropy\Container\Container.
    • Checkers are registered as service factories that autowire the checker (via Container::build()), then apply its configuration (replacing Laravel's extend()), and are looked up via findByContract() instead of tags + contextual binding (when()->needs()->giveTagged()).
    • findByContract() is overridden to keep registration order and the documented "same rule in a set + explicitly = listed twice, last config wins" behaviour (discussion #198).
  • Compiler passes use ECSConfig::getCheckerClasses() / removeChecker() instead of getBindings() / offsetUnset() / tags reflection.
  • LazyContainerFactory registers custom-factory services with service(); everything else is autowired & cached by the container.
  • FileHashComputer hashes getCheckerConfiguration() (checkers + their config) instead of getBindings().
  • Collectors (FixerFileProcessor, SniffFileProcessor, OutputFormatterCollector) keep their existing @param X[] docblocks and are now autowired through docblock array injection.
  • Removed illuminate/container from composer.json and deleted patches/illuminate-container-container-php.patch.

Scope note — symfony/console is NOT removed

symfony/console is a transitive dependency of friendsofphp/php-cs-fixer and symplify/easy-parallel, so it cannot be removed from the install tree. This PR is container-only; the console layer still uses symfony/console. (entropy#8 already contains the console features — progress bar, styled output, default/hidden commands — for a future console migration.)

Verification

All green locally (PHP 8.4): PHPStan level 8, Rector (dry-run), bin/ecs check, PHPUnit (94 tests). End-to-end bin/ecs check / list-checkers verified against sample files.

ECSConfig now extends Entropy\Container\Container instead of Illuminate's:

- Checkers are registered as container service factories that autowire (via
  Container::build()) then apply their configuration; collectors receive them
  through docblock array autowiring / findByContract instead of Laravel tags
  and contextual bindings (when()->needs()->giveTagged()).
- findByContract() is overridden to preserve checker registration order and the
  documented duplicate-in-set behaviour (discussion #198).
- Compiler passes operate on ECSConfig::getCheckerClasses()/removeChecker()
  instead of Laravel getBindings()/offsetUnset()/tags reflection.
- LazyContainerFactory registers custom-factory services via service(); plain
  services are autowired and cached by the container.

Removes the illuminate/container dependency and its patch. entropy/entropy is
temporarily pinned to the feature branch (TomasVotruba/entropy#8) via a VCS
repository until that PR is merged.

symfony/console is intentionally untouched: it remains a transitive dependency
of friendsofphp/php-cs-fixer and symplify/easy-parallel, so it cannot be
removed from the install tree.
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