Skip to content

Commit bb5e7d6

Browse files
committed
rectify
1 parent 520257e commit bb5e7d6

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

config/set/php85.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
ChrArgModuloRector::class,
4343
SleepToSerializeRector::class,
4444
OrdSingleByteRector::class,
45-
WakeupToUnserializeRector::class
45+
WakeupToUnserializeRector::class,
4646
]
4747
);
4848

rules/Php85/Rector/Class_/WakeupToUnserializeRector.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Rector\Php85\Rector\Class_;
66

77
use PhpParser\Node;
8+
use PhpParser\Node\Arg;
89
use PhpParser\Node\Expr\Assign;
910
use PhpParser\Node\Expr\FuncCall;
1011
use PhpParser\Node\Expr\PropertyFetch;
@@ -86,46 +87,43 @@ public function refactor(Node $node): ?Node
8687
if (! $classMethod instanceof ClassMethod) {
8788
return null;
8889
}
89-
90+
9091
$classMethod->name = new Identifier('__unserialize');
9192
$classMethod->returnType = new Identifier('void');
92-
$param = new Param(
93-
var: new Variable('data'),
94-
type: new Identifier('array')
95-
);
93+
94+
$param = new Param(var: new Variable('data'), type: new Identifier('array'));
9695

9796
$classMethod->params[] = $param;
9897

9998
$classMethod->stmts = [$this->assignProperties()];
100-
99+
101100
return $node;
102101
}
103102

104-
protected function assignProperties(): Foreach_{
103+
private function assignProperties(): Foreach_
104+
{
105105
$assign = new Assign(
106106
new PropertyFetch(new Variable('this'), new Variable('property')),
107107
new Variable('value')
108108
);
109109

110110
$if = new If_(
111111
new FuncCall(new Name('property_exists'), [
112-
new Node\Arg(new Variable('this')),
113-
new Node\Arg(new Variable('property')),
112+
new Arg(new Variable('this')),
113+
new Arg(new Variable('property')),
114114
]),
115115
[
116116
'stmts' => [new Expression($assign)],
117117
]
118118
);
119119

120-
$foreach = new Foreach_(
120+
return new Foreach_(
121121
new Variable('data'),
122122
new Variable('value'),
123123
[
124124
'keyVar' => new Variable('property'),
125-
'stmts' => [$if],
125+
'stmts' => [$if],
126126
]
127127
);
128-
129-
return $foreach;
130128
}
131129
}

src/ValueObject/PhpVersionFeature.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,13 +822,13 @@ final class PhpVersionFeature
822822
* @var int
823823
*/
824824
public const DEPRECATED_METHOD_SLEEP = PhpVersion::PHP_85;
825-
825+
826826
/**
827827
* @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
828828
* @var int
829829
*/
830830
public const DEPRECATED_METHOD_WAKEUP = PhpVersion::PHP_85;
831-
831+
832832
/**
833833
* @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_string_which_are_not_one_byte_long_to_ord
834834
* @var int

0 commit comments

Comments
 (0)