Repository navigation
Conversation
Reviewer's GuideAPIRemove the class-string return-type promise from container lookups and require the configured ContainerInterface definition to resolve to a container before using it for dependency resolution.
Narrow the public exception solution methods to always return a string, matching their actual behavior.
Specify the public shapes of container configuration and service-provider results so callers can rely on their documented types.
ImplementationAdapt container internals to the revised types, validate dependency-container resolution, and make tagged-service and resetter handling explicit for PHPStan.
Add precise property and accessor documentation types to the immutable container configuration implementation.
ConfigurationReplace Psalm with PHPStan in the static-analysis workflow, Composer tooling, and analysis configuration while removing the obsolete Psalm setup.
DocumentationUpdate the static-analysis instructions and changelog to describe the PHPStan migration and accompanying behavior and type improvements.
Remove the obsolete Psalm type-coverage badge from the project README.
TestsCover associative tag keys and verify that a non-container ContainerInterface definition fails clearly during dependency resolution.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/Container.php" line_range="315" />
<code_context>
* Sets multiple definitions at once.
*
- * @param array $config Definitions indexed by their IDs.
+ * @param array<int|string, mixed> $config Definitions indexed by their IDs.
*
* @throws InvalidConfigException
</code_context>
<issue_to_address>
**Integer service IDs fail in permissive mode**
When a caller supplies an integer-keyed definition with validation disabled, `addDefinitions()` skips its string-key check when validation is disabled, then passes the integer key to `addDefinition(string $id, ...)`, which raises a `TypeError` instead of accepting the documented input.
Require string definition IDs regardless of validation mode, or change the documented definition types and API behavior so integer keys are not advertised as supported.
Also at `src/ContainerConfig.php:46`, `src/ContainerConfigInterface.php:15`, `src/ServiceProviderInterface.php:42`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/Container.php:315
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #412 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 190 192 +2
===========================================
Files 11 11
Lines 523 535 +12
===========================================
+ Hits 523 535 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sourcery withdrew this approval because the latest commits introduced blocking findings.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
samdark
left a comment
There was a problem hiding this comment.
Please allow keyed service ID arrays in the tag configuration PHPDoc and retain list types for resolved services. Please also avoid promising a class-matching return from get() when configured services or delegated PSR-11 containers can return a different value.
| } | ||
|
|
||
| public function getSolution(): ?string | ||
| public function getSolution(): string |
There was a problem hiding this comment.
There was a problem hiding this comment.
Narrowing the type in the implementation is OK.
# Conflicts: # src/CompositeContainer.php # tools/psalm/composer.json
…terface definition check As suggested in #412 review: there is no guarantee that a configured service or a delegated PSR-11 container returns an instance of the class given as ID, so "get()" no longer promises a class-matching return type. Internal call sites that relied on the inference were adjusted: - CompositeContainer always returns a StateResetter for StateResetter::class, so the delegates reset call is annotated with a phpstan-ignore. - New private getDependencyContainer() validates that the ContainerInterface::class definition is actually a container and throws InvalidConfigException with a clear message otherwise.
Summary by Sourcery
Replace Psalm with PHPStan while tightening type declarations and validating container dependency definitions.
Bug Fixes:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: