Skip to content

Can't use property typed by some class for persistent parameters #241

@SendiMyrkr

Description

@SendiMyrkr

Version: v3.0.2

Bug Description

Persistent parameters doesn't work in PHP 7.4 when i set some class type on property.

Steps To Reproduce

class SomePresenter extends Presenter {
	/** @var SomeClass @persistent */
	public SomeClass $prop;
}

Then you get exception:

Value passed to persistent parameter 'prop' in presenter Homepage must be SomeClass, SomeClass given.

Expected Behavior

Correctly process class type on property with @persistent

Possible Solution

Problem is here:
https://github.com/nette/application/blob/master/src/Application/UI/Component.php#L145

Third parameter is missing when required type is class.

I guess that solution should be adding 'isClass' to $meta array in here and than put it as third parameter to convertType
https://github.com/nette/application/blob/master/src/Application/UI/ComponentReflection.php#L53

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