Skip to content

Commit 75dc57c

Browse files
Reproduce error
1 parent 5e40360 commit 75dc57c

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

tests/PHPStan/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,9 @@ public function testRule(): void
7070
$this->analyse([__DIR__ . '/data/missing-exception-method-throws.php'], $errors);
7171
}
7272

73+
public function testBugArrayOffset(): void
74+
{
75+
$this->analyse([__DIR__ . '/data/bug-array-offset.php'], []);
76+
}
77+
7378
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace BugArrayOffset;
4+
5+
class ParameterNotFoundException extends \Exception {}
6+
7+
interface Container
8+
{
9+
/**
10+
* @throws ParameterNotFoundException
11+
*/
12+
public function getParameter(string $key): mixed;
13+
}
14+
15+
class Foo
16+
{
17+
public function __construct(Container $container)
18+
{
19+
$container->getParameter('shipmonkDeadCode')['debug']['usagesOf'];
20+
}
21+
22+
}

0 commit comments

Comments
 (0)