Skip to content

Commit b7fc29f

Browse files
committed
Update NonexistentOffsetInArrayDimFetchRuleTest.php
1 parent 741af2c commit b7fc29f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

test.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
class F {
3+
/** @param non-empty-array<scalar> $arr */
4+
public function sayHello2(array $arr): void
5+
{
6+
$num = 5;
7+
echo $arr[array_rand($arr, $num)];
8+
$randIndex = array_rand($arr, $num);
9+
echo $arr[$randIndex];
10+
}
11+
}

tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -947,14 +947,6 @@ public function testBug12981(): void
947947
$this->reportPossiblyNonexistentGeneralArrayOffset = true;
948948

949949
$this->analyse([__DIR__ . '/data/bug-12981.php'], [
950-
[
951-
'Offset array<int, int|string> might not exist on non-empty-array<bool|float|int|string>.',
952-
31,
953-
],
954-
[
955-
'Offset array<int, int|string> might not exist on non-empty-array<bool|float|int|string>.',
956-
33,
957-
],
958950
[
959951
'Offset array<int, int|string>|int|string might not exist on non-empty-array<bool|float|int|string>.',
960952
39,

0 commit comments

Comments
 (0)