Skip to content

calling constructor of a trait in constructor method.resultUnused  #12379

@msprotte

Description

@msprotte

Bug report

When I use a trait with a separate constructor, which uses DI services and I call in the main Class the constructor like this:

use ArchiveTrait {
        ArchiveTrait::__construct as private __archiveConstruct;
    }

... __constructor(
        private readonly EntityManagerInterface $entityManager,
        private readonly Repository $repository,
)
$this->__archiveConstruct($this->repository, $this->entityManager);

gives the following result:

Call to method App\Service\AcmeService::__archiveConstruct() on a separate line has no effect.  
         🪪  method.resultUnused

Which I think is a bug or I'm totally wrong. The constructor has no return value.

Code snippet that reproduces the problem

https://phpstan.org/r/3aaacb1a-7e35-43f0-8087-f702d8aa0ad2

Expected output

no error

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions