psalm-plugin-symfony
psalm-plugin-symfony copied to clipboard
Kernel.stubphp is creating a PropertyNotSetInConstructor error
Ref https://github.com/psalm/psalm-plugin-symfony/pull/220#issuecomment-945447558
The following code
class AppKernel extends Kernel
{
use MicroKernelTrait;
public function __construct()
{
parent::__construct('test', true);
}
}
is giving a PropertyNotSetInConstructor error.
@enumag @seferov do you see a workaround ?
That's odd. It's a protected property so the responsibility of setting it lies in the parent Kernel class. Perhaps it might help adding the constructor which sets it into the stub? If that doesn't help then I think it's psalm bug.
I tried to add
public function __construct(string $environment, bool $debug)
{
$this->environment = $environment;
$this->debug = $debug;
}
inside the stub without success.
It's even worst because I end with the same error for the debug property.
Seems like a psalm bug. cc @weirdan @orklah
@VincentLanglet mind creating a reproducer in a separate repo?
Sure, https://github.com/VincentLanglet/SonataDoctrineORMAdminBundle/tree/reproducerPsalm can be used.
Can anyone help with provide steps to fix this issue?
Should it be fixed in vimeo/psalm or psalm-plugin-symfony?
There is a reproducer here: https://github.com/vimeo/psalm/pull/7075, so I assume it should be fixed in vimeo/psalm