Mistralys / HTML_QuickForm2

Provides methods to create, validate and render HTML forms in PHP.
2 stars 0 forks source link

Prepare for PHP8 compatibility #3

Open Mistralys opened 1 year ago

Mistralys commented 1 year ago

While PHP7.4 runs well, the library must be reviewed for use with PHP8.

Mistralys commented 1 year ago

So far, most of the issues in PHP8 are deprecated warnings regarding the iterator classes.

Some things cannot be fixed until the whole package switches to PHP8. For example, ArrayAccess messages like [...] should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed [...] require the : mixed return type to be added, which is only possible in PHP8.

The interim solution is to add the #[\ReturnTypeWillChange] attribute to the target method, which suppresses the warning in PHP8, and is ignored in PHP7.

This means that a follow-up task will be to fix all these attributes once the package switches to PHP8.