-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hello, respectful maintainers!
Great tool.
Is it possible to extend the PHP Builder to make classes with a more strict typing?
Trying to generate a class that will validate values not only at the end, but for every property.
The problem is: only in a runtime it will fail on validation, but I would like to have a proper PSALM static analysis and type hinting on IDE, before running any code.
Method setId() should guarantee positive-int value even before code "compiled", and as a bonus, fail on setting an invalid value.
Like this:
/**
* @param positive-int $id
*/
public function setId(int $id): self
{
\Webmozart\Assert\Assert::greaterThan($id, 0);
$this->id = $id;
return $this;
}
I may try to add this functionality, but need some help, an entry point.
Thank you anyway
Metadata
Metadata
Assignees
Labels
No labels