Skip to content

Issue #12: Drop PHP 8.2, fix attribute/dot-notation resolution bugs, expand docs - #13

Merged
alexmerlin merged 4 commits into
1.0from
issue-12
Sep 16, 2026
Merged

alexmerlin merged 4 commits into
1.0from
issue-12

Conversation

@alexmerlin

Copy link
Copy Markdown
Member

Removed

  • Drop PHP 8.2: composer.json requires ~8.3.0 || ~8.4.0 || ~8.5.0; removed from both CI matrices

Fixed

  • AttributedServiceFactory treated a config value of null as a missing key (isset()array_key_exists()/offsetExists())
  • Dot paths continuing past a scalar were silently truncated instead of throwing
  • Removed the mutable $originalKey property — shared factory instances made it stateful
  • AttributedRepositoryFactory returned whatever Doctrine built, so an entity missing repositoryClass produced a repository of the wrong type under the requested service name
  • Added a guard for an #[Entity] attribute naming a non-existent class
  • findEntityAttribute()/findInjectAttribute() returned object where ?Entity/?Inject was declared (IDE + static-analysis error)

Changed

  • #[Entity]TARGET_CLASS, #[Inject]TARGET_METHOD (were TARGET_ALL, where misplacement was a silent no-op)
  • Added InvalidArgumentException::missingKey() and RuntimeException::unexpectedRepository()
  • Replaced hand-rolled attribute loops with getAttributes(X::class); Entity::$name is now a promoted readonly property
  • Dropped both ignoreErrors entries from phpstan.neon by fixing their cause

Tests

  • 8 new tests (12 → 20): null config value, path overshooting a scalar, dot notation on a non-array service, ArrayAccess traversal, exact-name service preferred over dot resolution, unregistered class instantiated directly, missing entity, wrong repository class

Documentation

  • New page: Attributes vs. factories — comparison, advantages, trade-offs, when to still write a factory
  • New page: FAQ — 27 questions across setup, #[Inject], config values, repositories, performance, testing
  • Corrected the dot-notation description: only the full name and the first segment are resolved from the container, not every segment
  • Documented InvalidArgumentException, constructor-less classes, the unregistered-class fallback, ArrayAccess traversal, only-direct-recursion detection, the repositoryClass requirement, createObject() vs __invoke()
  • Fixed unrunnable PHP samples (missing use statements) and the Srevice typos
  • README rewritten with requirements + QA sections; PHP badge un-pinned from 1.3.0
  • Reformatted all Markdown to one sentence per row

BC notes

  • readKeysFromArray() gained a third parameter (string $serviceKey) — overriding subclasses must be updated, and backwardCompatibilityCheck will flag it
  • Restricting the attribute targets turns previously silent misuse into a compile-time error

…expand docs

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin alexmerlin self-assigned this Sep 16, 2026
…expand docs

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3422229) to head (1384a88).

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.0       #13   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        39        44    +5     
===========================================
  Files              6         7    +1     
  Lines             84        99   +15     
===========================================
+ Hits              84        99   +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexmerlin alexmerlin linked an issue Sep 16, 2026 that may be closed by this pull request
…expand docs

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@alexmerlin
alexmerlin requested a review from arhimede September 16, 2026 12:14
@alexmerlin

Copy link
Copy Markdown
Member Author

@arhimede Note that this targets a new 1.4.0 minor release.

…expand docs

Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
@arhimede

Copy link
Copy Markdown
Member

Make a new release then

@alexmerlin
alexmerlin merged commit d1485f5 into 1.0 Sep 16, 2026
33 of 34 checks passed
@alexmerlin
alexmerlin deleted the issue-12 branch September 16, 2026 12:38
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.

Drop PHP 8.2, fix attribute/dot-notation resolution bugs, expand docs

2 participants