__set_state() Method Must Be Static¶
Starting with PHP 8.0, the magic method __set_state() must be static when declared in a class.
PHP code¶
<?php
class x {
function __set_state() {}
}
Before¶
After¶
PHP Fatal error: Method x::__set_state() must be static
Fatal error: Method x::__set_state() must be static
PHP version change¶
This behavior changed in 8.0