Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prototype] Name conflict resolver may resolve without a need #326

Closed
vvval opened this issue Jun 26, 2020 · 0 comments · Fixed by #335
Closed

[prototype] Name conflict resolver may resolve without a need #326

vvval opened this issue Jun 26, 2020 · 0 comments · Fixed by #335
Assignees

Comments

@vvval
Copy link
Member

vvval commented Jun 26, 2020

A requested injection may have a numeric resolved postfix (2) in cases when a variable with such name is met in another method. Example:

<?php

declare(strict_types=1);

namespace App\Controller;

use Spiral\Prototype\Traits\PrototypeTrait;

class Test
{
    use PrototypeTrait;

    public function update($request): void
    {
    }

    public function view(): void
    {
        $this->request;
    }
}

Injects into:

<?php

declare(strict_types=1);

namespace App\Controller;

use Spiral\Http\Request\InputManager;

class Test
{
    private InputManager $request;

    public function __construct(InputManager $request2)
    {
        $this->request = $request2;
    }

    public function update($request): void
    {
    }

    public function view(): void
    {
        $this->request;
    }
}
@vvval vvval self-assigned this Jun 26, 2020
@SerafimArts SerafimArts transferred this issue from spiral/prototype Sep 19, 2020
@SerafimArts SerafimArts changed the title Name conflict resolver may resolve without a need [prototype] Name conflict resolver may resolve without a need Sep 19, 2020
@vvval vvval linked a pull request Oct 8, 2020 that will close this issue
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 a pull request may close this issue.

1 participant