nette / application

🏆 A full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.

Home Page:https://doc.nette.org/application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persistent attribute used for persistent controls does not allow params with control names

MartinMystikJonas opened this issue · comments

Version: 3.1.7

Bug Description

When we use attributte for persistent component

#[Persistent('control')]
class ControlTestCasePresenter extends Presenter {

PHPStan complains

Attribute class Nette\Application\Attributes\Persistent does not have a constructor and must be instantiated without any parameters.

Attributte Nette\Application\Attributes\Persistent indeed does not have a constructor.

Expected Behavior

No error

Possible Solution

Add constructor to Nette\Application\Attributes\Persistent that saves components names

public $names;

public function __construct(...$names)
	{
		$this->names = $names;
	}

Should I prepare PR?