You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Activity