Change __wakeup() to __unserialize()
class User {
- public function __wakeup() {
+ public function __unserialize(array $data): void{
+ foreach ($data as $property => $value) {
+ if (property_exists($this, $property)) {
+ $this->{$property} = $value;
+ }
+ }
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Php85\Rector\Class_\WakeupToUnserializeRector;
return RectorConfig::configure()
->withRules([
WakeupToUnserializeRector::class,
]);