northrook / types
Self-validating data types for PHP
dev-main
2024-06-12 07:49 UTC
Requires
- php: >=8.1
- meyfa/php-svg: ^0.15.0
- northrook/email-validator: dev-main
- northrook/logger: dev-main
- northrook/password-validator: dev-main
- northrook/support: dev-main
- symfony/uid: ^7.0
Requires (Dev)
- symfony/var-dumper: ^7.0
This package is auto-updated.
Last update: 2024-11-12 08:37:35 UTC
README
Updating the value
Create public function update()
, with the argument $value
, typed to match.
This method may be used to handle additional logic, as long as it results in a valid $value
.
Assign the updated value using $this->updateValue( $value )
.
The updateValue
method revalidates the new value, unless revalidate: false
is passed.
The method must return self.
// Example: class CustomType extends Type { public function update( ?string $value ): self { $this->updateValue( $value ); return $this; } }