-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
Version: 3.1.2
Bug Description
When using non-nullable typed property marked as @persistent Error Typed property must not be accessed before initialization is thrown
This can be fixed by using nullable public ?int $id = null but I think that clearly marking variable as required for presenter is better for code readability.
Error occurs here:
application/src/Application/UI/Component.php
Line 164 in 1ed2d0a
| $params[$name] = $this->$name; |
Steps To Reproduce
class SomePresenter extends Presenter {
/** @persistent */
public int $id;
public function actionSomething()
{
}
}Possible Solution
Throw something like BadRequestException Missing parameter $id required by SomePresenter for typed properties
or
Do not throw error and skip all unitialized (or null) persistent values just by isset check
Metadata
Metadata
Assignees
Labels
No labels