Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
if (
$innerType->hasOffsetValueType($innerDimType)->no()
) {
if ($innerType->isString()->yes() && $innerDimType->isInteger()->yes()) {

Check warning on line 129 in src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ( $innerType->hasOffsetValueType($innerDimType)->no() ) { - if ($innerType->isString()->yes() && $innerDimType->isInteger()->yes()) { + if ($innerType->isString()->yes() && !$innerDimType->isInteger()->no()) { continue; } $report = true;

Check warning on line 129 in src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ( $innerType->hasOffsetValueType($innerDimType)->no() ) { - if ($innerType->isString()->yes() && $innerDimType->isInteger()->yes()) { + if (!$innerType->isString()->no() && $innerDimType->isInteger()->yes()) { continue; } $report = true;

Check warning on line 129 in src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ( $innerType->hasOffsetValueType($innerDimType)->no() ) { - if ($innerType->isString()->yes() && $innerDimType->isInteger()->yes()) { + if ($innerType->isString()->yes() && !$innerDimType->isInteger()->no()) { continue; } $report = true;

Check warning on line 129 in src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ( $innerType->hasOffsetValueType($innerDimType)->no() ) { - if ($innerType->isString()->yes() && $innerDimType->isInteger()->yes()) { + if (!$innerType->isString()->no() && $innerDimType->isInteger()->yes()) { continue; } $report = true;
continue;
}
$report = true;
break 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,4 +1277,9 @@ public function testBug14308(): void
$this->analyse([__DIR__ . '/data/bug-14308.php'], []);
}

public function testBug13688(): void
{
$this->analyse([__DIR__ . '/data/bug-13688.php'], []);
}

}
12 changes: 12 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-13688.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php declare(strict_types = 1);

namespace Bug13688;

$inputs = [ '', ':' ];

foreach ( $inputs as $input )
{
$inputLen = \strlen($input);
$hasTrailingColon = $inputLen > 0 && $input[$inputLen-1] === ':';
echo $hasTrailingColon ? "{$input} has trailing colon\n" : "{$input} does not have trailing colon\n";
}
Loading