Hi,
PHPStan rly helps me fixing bugs in my code. I'm always eager to update it! However, the latest phpstan-symfony extensions seems to introduce a bug when using #[Required] on traits:
Class HelloWorld has an uninitialized readonly property $query. Assign it in the constructor.
Reproducible
https://phpstan.org/r/f7e42743-2ab6-44cc-ad55-ffae9b30dcc0
<?php
use Symfony\Contracts\Service\Attribute\Required;
interface MyQueryInterface {
public function execute(): array;
}
trait GenreFetcherTrait
{
private readonly MyQueryInterface $query;
protected function dosomething(): array
{
return $this->query->execute();
}
#[Required]
public function setQuery(MyQueryInterface $query): void {
$this->query = $query;
}
}
class HelloWorld
{
use GenreFetcherTrait;
}
Expected results
No issues. Used to work with v2.0.10.