Can't use property typed by some class for persistent parameters
SendiMyrkr opened this issue · 0 comments
SendiMyrkr commented
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