Skip to content

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

@MartinMystikJonas

Description

@MartinMystikJonas

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?

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