markrogoyski / ipv4-subnet-calculator-php

Network calculator for subnet mask and other classless (CIDR) network information.
MIT License
168 stars 42 forks source link

PHP 8.1 compatibility #17

Closed barhom closed 2 years ago

barhom commented 3 years ago

During inheritance of JsonSerializable: Uncaught ErrorException: Return type of IPv4\SubnetCalculator::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\Re
turnTypeWillChange] attribute should be used to temporarily suppress the notice in markrogoyski/ipv4-subnet-calculator/src/SubnetCalculator.php:549

I did not have try to track this or fix it yet, but I am adding it here just for reference. Seems that SubnetCalculator is broken in 8.1 (but not 8.0).

markrogoyski commented 3 years ago

Hi @barhom,

Thanks for bringing this to my attention. It looks like mixed is now the return type of the interface, so the method has to declare a return type. As the library was trying to support as low a PHP version as possible, there are no return types, but it is probably time to increase the minimum version to a version with return types and that will resolve this issue.

Thanks again. I'll report here once I've made changes to address the issue.

markrogoyski commented 2 years ago

Version v4.0.0 has been released which is compatible with PHP 8.1.

Thanks again for bringing this to my attention.