Skip to content

Commit bfe5b26

Browse files
jakejackson1claude
andcommitted
Drop the isset() on a foreach variable that PHPStan 2.2.15 no longer reports (#451)
The baseline ignored "Variable $c in isset() always exists" in Svg.php. PHPStan 2.2.15 stopped reporting it, so the unmatched ignore failed static analysis on gravitypdf and every branch cut from it. $c is always set inside its foreach, so the check goes and the ignore with it, which passes under 2.2.14 and 2.2.15 alike. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent af06334 commit bfe5b26

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ parameters:
210210
count: 50
211211
path: src/Image/Svg.php
212212

213-
-
214-
message: '#^Variable \$c in isset\(\) always exists and is not nullable\.$#'
215-
identifier: isset.variable
216-
count: 1
217-
path: src/Image/Svg.php
218-
219213
-
220214
message: '#^Variable \$class in empty\(\) always exists and is not falsy\.$#'
221215
identifier: empty.variable

‎src/Image/Svg.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3608,7 +3608,7 @@ function xml_svg2pdf_start($parser, $name, $attribs)
36083608
$this->pathBBox = [999999, 999999, -999999, -999999];
36093609

36103610
foreach ($commands as $c) {
3611-
if ((isset($c) && count($c) == 3) || (isset($c[2]) && $c[2] == '')) {
3611+
if (count($c) == 3 || (isset($c[2]) && $c[2] == '')) {
36123612
list($tmp, $command, $arguments) = $c;
36133613
} else {
36143614
list($tmp, $command) = $c;

0 commit comments

Comments
 (0)