johannschopplich / kirby-highlighter

🌐 Server-side syntax highlighting for the code block & KirbyText
https://kirbyseo.com
MIT License
20 stars 4 forks source link

Add return type declarations for internal methods #15

Closed FabienYt closed 2 years ago

FabienYt commented 2 years ago

https://wiki.php.net/rfc/internal_method_return_types

Unfortunately, union return types impose a compatibility challenge for libraries: as this construct is only supported since PHP 8.0, libraries would have to accept the fact by default that their code triggers E_DEPRECATED notices on PHP 8.1 if they also want to support PHP versions below 8.0. As a remedy, this RFC proposes to add a ReturnTypeWillChange attribute which could be used to suppress the related E_DEPRECATED notices. Thanks to the backward compatible syntax of attributes, this can be done in code which is compatible with PHP 7 and below.

johannschopplich commented 2 years ago

Nice catch. Thanks!