Skip to content

Commit 2a1de4c

Browse files
committed
update constant
1 parent 1272b81 commit 2a1de4c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class DowngradeSubstrFalsyRector extends AbstractRector
4747
/**
4848
* @var string
4949
*/
50-
private const IS_UNCASTABLE = 'is_uncastable';
50+
private const IS_FALSY_UNCASTABLE = 'is_falsy_uncastable';
5151

5252
public function __construct(
5353
private readonly ReflectionResolver $reflectionResolver,
@@ -95,60 +95,60 @@ public function getNodeTypes(): array
9595
public function refactor(Node $node): ?Node
9696
{
9797
if ($node instanceof Cast || $node instanceof Empty_ || $node instanceof BooleanNot || $node instanceof AssignOp) {
98-
$node->expr->setAttribute(self::IS_UNCASTABLE, true);
98+
$node->expr->setAttribute(self::IS_FALSY_UNCASTABLE, true);
9999
return null;
100100
}
101101

102102
if ($node instanceof Ternary) {
103103
if (! $node->if instanceof Expr) {
104-
$node->cond->setAttribute(self::IS_UNCASTABLE, true);
104+
$node->cond->setAttribute(self::IS_FALSY_UNCASTABLE, true);
105105
}
106106

107107
return null;
108108
}
109109

110110
if ($node instanceof Concat) {
111-
$node->left->setAttribute(self::IS_UNCASTABLE, true);
112-
$node->right->setAttribute(self::IS_UNCASTABLE, true);
111+
$node->left->setAttribute(self::IS_FALSY_UNCASTABLE, true);
112+
$node->right->setAttribute(self::IS_FALSY_UNCASTABLE, true);
113113
return null;
114114
}
115115

116116
if ($node instanceof Identical) {
117117
if ($this->valueResolver->isFalse($node->left)) {
118-
$node->right->setAttribute(self::IS_UNCASTABLE, true);
118+
$node->right->setAttribute(self::IS_FALSY_UNCASTABLE, true);
119119
}
120120

121121
if ($this->valueResolver->isFalse($node->right)) {
122-
$node->left->setAttribute(self::IS_UNCASTABLE, true);
122+
$node->left->setAttribute(self::IS_FALSY_UNCASTABLE, true);
123123
}
124124

125125
return null;
126126
}
127127

128128
if ($node instanceof If_ || $node instanceof While_ || $node instanceof Do_) {
129-
$node->cond->setAttribute(self::IS_UNCASTABLE, true);
129+
$node->cond->setAttribute(self::IS_FALSY_UNCASTABLE, true);
130130
return null;
131131
}
132132

133133
if ($node instanceof ArrayItem) {
134134
if ($node->key instanceof Expr) {
135-
$node->key->setAttribute(self::IS_UNCASTABLE, true);
135+
$node->key->setAttribute(self::IS_FALSY_UNCASTABLE, true);
136136
}
137137

138138
return null;
139139
}
140140

141141
if ($node instanceof ArrayDimFetch) {
142142
if ($node->dim instanceof Expr) {
143-
$node->dim->setAttribute(self::IS_UNCASTABLE, true);
143+
$node->dim->setAttribute(self::IS_FALSY_UNCASTABLE, true);
144144
}
145145

146146
return null;
147147
}
148148

149149
if ($node instanceof BinaryOp) {
150-
$node->left->setAttribute(self::IS_UNCASTABLE, true);
151-
$node->right->setAttribute(self::IS_UNCASTABLE, true);
150+
$node->left->setAttribute(self::IS_FALSY_UNCASTABLE, true);
151+
$node->right->setAttribute(self::IS_FALSY_UNCASTABLE, true);
152152
return null;
153153
}
154154

@@ -176,7 +176,7 @@ public function refactor(Node $node): ?Node
176176

177177
$arg = $node->getArg($parameterReflection->getName(), $position);
178178
if ($arg instanceof Arg) {
179-
$arg->value->setAttribute(self::IS_UNCASTABLE, true);
179+
$arg->value->setAttribute(self::IS_FALSY_UNCASTABLE, true);
180180
}
181181
}
182182
}
@@ -185,7 +185,7 @@ public function refactor(Node $node): ?Node
185185
return null;
186186
}
187187

188-
if ($node->getAttribute(self::IS_UNCASTABLE) === true) {
188+
if ($node->getAttribute(self::IS_FALSY_UNCASTABLE) === true) {
189189
return null;
190190
}
191191

0 commit comments

Comments
 (0)