validation
validation copied to clipboard
A warning thrown in php 8.1.7
Bug Report
| Q | A |
|---|---|
| BC Break | yes |
| Version | 3.0.2 and dev-master |
Summary
nothing fancy, i'm just trying to validate an array and the error (warn) happen. and this is the log.
Deprecated: Return type of Sirius\Validation\RuleCollection::attach($rule, $data = null) should either be compatible with SplObjectStorage::attach(object $object, mixed $info = null): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/boku/Public/php-sandbox/adr-skeleton/vendor/siriusphp/validation/src/RuleCollection.php on line 8
Deprecated: Return type of Sirius\Validation\RuleCollection::getHash($rule) should either be compatible with SplObjectStorage::getHash(object $object): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/boku/Public/php-sandbox/adr-skeleton/vendor/siriusphp/validation/src/RuleCollection.php on line 30
How to reproduce
i have this code in slim 4 controller and serve it with php (PHP 8.1.7) dev server.
$input = [
'email'=>'email@me',
];
$this->valid->add('email', ['required', 'email']);
$data = $this->valid->validate($input);
var_dump($data);
var_dump($input);
Thanks for reporting. I haven't switched to PHP 8 yet. :( If you send me a pull-request I will happily approve it.
packagist page says that it support >= php7.1 i think we should update it. or maybe its time to release v4.0.0 and fully migrate to php8 since so much things break in php8.
@bokunodev I have merged your PR and tagged it with 3.1.0 Thank you very much