Skip to content

Commit aeb52db

Browse files
committed
Merge #455 - Remove unused if
Pull-request: #455 Signed-off-by: William Desportes <[email protected]>
2 parents e81953a + 1e4954e commit aeb52db

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

psalm-baseline.xml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@
191191
<InvalidArgument>
192192
<code><![CDATA[$options['breakOnParentheses']]]></code>
193193
</InvalidArgument>
194-
<InvalidAttribute>
195-
<code>\AllowDynamicProperties</code>
196-
</InvalidAttribute>
197194
<MixedArrayOffset>
198195
<code><![CDATA[Parser::$statementParsers[$token->keyword]]]></code>
199196
<code><![CDATA[self::$allowedKeywords[$token->keyword]]]></code>
@@ -236,6 +233,9 @@
236233
<TypeDoesNotContainType>
237234
<code><![CDATA[empty($options['field'])]]></code>
238235
</TypeDoesNotContainType>
236+
<UndefinedAttributeClass>
237+
<code>\AllowDynamicProperties</code>
238+
</UndefinedAttributeClass>
239239
</file>
240240
<file src="src/Components/ExpressionArray.php">
241241
<InvalidArgument>
@@ -255,9 +255,6 @@
255255
<code>$expr</code>
256256
<code>$expr</code>
257257
</PossiblyNullArgument>
258-
<RedundantCondition>
259-
<code>is_array($ret)</code>
260-
</RedundantCondition>
261258
</file>
262259
<file src="src/Components/FunctionCall.php">
263260
<MixedOperand>
@@ -4917,9 +4914,6 @@
49174914
<code>$built[$field]</code>
49184915
<code><![CDATA[$parsedClauses[$token->value]]]></code>
49194916
</InvalidArgument>
4920-
<InvalidAttribute>
4921-
<code>\AllowDynamicProperties</code>
4922-
</InvalidAttribute>
49234917
<MethodSignatureMustProvideReturnType>
49244918
<code>__toString</code>
49254919
</MethodSignatureMustProvideReturnType>
@@ -4955,6 +4949,9 @@
49554949
<TypeDoesNotContainType>
49564950
<code>count($clauses) === 0</code>
49574951
</TypeDoesNotContainType>
4952+
<UndefinedAttributeClass>
4953+
<code>\AllowDynamicProperties</code>
4954+
</UndefinedAttributeClass>
49584955
<UnusedForeachValue>
49594956
<code>$index</code>
49604957
</UnusedForeachValue>

src/Components/ExpressionArray.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use function count;
1414
use function implode;
15-
use function is_array;
1615
use function preg_match;
1716
use function strlen;
1817
use function substr;
@@ -105,15 +104,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
105104
}
106105

107106
--$list->idx;
108-
109-
if (is_array($ret)) {
110-
$retIndex = count($ret) - 1;
111-
if (isset($ret[$retIndex])) {
112-
$expr = $ret[$retIndex]->expr;
113-
if (preg_match('/\s*--\s.*$/', $expr, $matches)) {
114-
$found = $matches[0];
115-
$ret[$retIndex]->expr = substr($expr, 0, strlen($expr) - strlen($found));
116-
}
107+
$retIndex = count($ret) - 1;
108+
if (isset($ret[$retIndex])) {
109+
$expr = $ret[$retIndex]->expr;
110+
if (preg_match('/\s*--\s.*$/', $expr, $matches)) {
111+
$found = $matches[0];
112+
$ret[$retIndex]->expr = substr($expr, 0, strlen($expr) - strlen($found));
117113
}
118114
}
119115

0 commit comments

Comments
 (0)