Fix bugs, remove dead code, and refactor Config internals#74
Merged
alganet merged 1 commit intoRespect:masterfrom Mar 21, 2026
Merged
Fix bugs, remove dead code, and refactor Config internals#74alganet merged 1 commit intoRespect:masterfrom
alganet merged 1 commit intoRespect:masterfrom
Conversation
Member
alganet
commented
Mar 21, 2026
- Fix empty("0") treating "0" as null in IniLoader::parseValue
- Fix pre-existing bug: matchConstructorParam no longer pollutes constructor array with null placeholders, allowing params with non-nullable defaults (e.g. EntityFactory::$style) to work
- Add numeric coercion in parseConstants for strict_types compat
- Add declare(strict_types=1) to Instantiator.php
- Guard Autowire::cleanupParams to only autowire constructor params, not method-call arguments
- Remove Container::__invoke and __call (unused by consumers)
- Extract shouldCache() to replace $forceNew param in getInstance; Factory overrides to return false instead of wrapping parent call
- Extract stripTrailingNulls helper, deduplicating Autowire/Instantiator
- Refactor keyHasStateInstance to existingKeyFrom (no side-effect)
- Cache plain callables consistently in lazyLoad
- Remove func_get_args(), stripos, and dead imports
- Use parent::offsetGet in has() for consistency
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #74 +/- ##
=============================================
- Coverage 100.00% 99.34% -0.66%
- Complexity 155 157 +2
=============================================
Files 6 6
Lines 319 306 -13
=============================================
- Hits 319 304 -15
- Misses 0 2 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR focuses on fixing a few configuration/instantiation edge cases while refactoring the container/instantiator internals to simplify caching behavior and remove unused magic-call APIs.
Changes:
- Refactor
Instantiatorcaching and parameter cleanup (shouldCache(),stripTrailingNulls()), and updateFactoryto opt out of caching. - Fix/adjust INI parsing semantics (
empty("0")no longer treated as null; add numeric coercion in constant parsing; refactor state precedence handling). - Remove unused
Container::__invoke/__callpaths and tightenAutowireconstructor-only autowiring (with new nesting/container-propagation tests).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Instantiator.php |
Introduces shouldCache(), refactors instance caching + param cleanup, and removes dead/legacy logic. |
src/Factory.php |
Switches Factory behavior to “never cache” via shouldCache(): false. |
src/Container.php |
Removes magic invoke/call APIs and updates lazy-loading/caching logic (including plain callables). |
src/IniLoader.php |
Fixes empty-string handling, refactors state precedence, and adds numeric coercion in constant parsing. |
src/Autowire.php |
Ensures autowiring happens only for constructor params and propagates container into nested autowires. |
tests/AutowireTest.php |
Adds coverage for nested/deeply nested autowire container propagation. |
tests/FactoryTest.php |
Removes obsolete force-new test aligned with the new caching API. |
tests/ContainerTest.php |
Removes tests for APIs that were deleted (__invoke, __call). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix empty("0") treating "0" as null in IniLoader::parseValue
- Fix pre-existing bug: matchConstructorParam no longer pollutes
constructor array with null placeholders, allowing params with
non-nullable defaults (e.g. EntityFactory::$style) to work
- Add numeric coercion in parseConstants for strict_types compat
- Add declare(strict_types=1) to Instantiator.php
- Guard Autowire::cleanupParams to only autowire constructor params,
not method-call arguments
- Remove Container::__invoke and __call (unused by consumers)
- Extract shouldCache() to replace $forceNew param in getInstance;
Factory overrides to return false instead of wrapping parent call
- Extract stripTrailingNulls helper, deduplicating Autowire/Instantiator
- Refactor keyHasStateInstance to existingKeyFrom (no side-effect)
- Cache plain callables consistently in lazyLoad
- Remove func_get_args(), stripos, and dead imports
- Use parent::offsetGet in has() for consistency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.