Skip to content

Support self and parent types for Container - #310

Merged
clue merged 1 commit into
clue:mainfrom
clue-labs:container-self-parent
Sep 23, 2026
Merged

clue merged 1 commit into
clue:mainfrom
clue-labs:container-self-parent

Conversation

@clue

@clue clue commented Sep 23, 2026

Copy link
Copy Markdown
Owner

This changeset adds support for self and parent types for Container factory functions and constructors. Previously, these types were treated as literal class names, so autowiring would throw an Error (Class self not found) and a matching container variable would be rejected with a TypeError. They now resolve against the class the parameter is declared in, including as part of union types (PHP 8+):

class AdminController extends UserController
{
    public function __construct(parent $user)
    {
        // …
    }
}

This includes new test cases covering self and parent types for autowiring and container variables. This has 100% code coverage and should be safe to apply.

Builds on top of #307, #306, #303, #287, #286, #284, #182 and others

@clue clue added this to the v0.18.0 milestone Sep 23, 2026
@clue clue added the new feature New feature or request label Sep 23, 2026
@clue
clue requested a lite review from Copilot September 23, 2026 15:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The remaining feedback is a minor, non-blocking test-coverage suggestion.

Review effort: Lite
Findings: None

What changed in this PR

Adds support for resolving self and parent types in Container parameters, including union types.

Changes:

  • Resolves relative types against the declaring class.
  • Supports autowiring and configured container values.
  • Adds factory and union-type test coverage.
File Summary
tests/​ContainerTest.php Adds coverage for relative and union type scenarios.
src/​Container.php Implements scoped self/parent type resolution.

Review note: One minor, non-blocking suggestion remains to add constructor-specific coverage.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@clue
clue merged commit b6bbb7a into clue:main Sep 23, 2026
75 checks passed
@clue
clue deleted the container-self-parent branch September 23, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants