File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace PHPStan \Rules \Exceptions ;
4+
5+ use PHPStan \Rules \Rule ;
6+ use PHPStan \Testing \RuleTestCase ;
7+
8+ /**
9+ * @extends RuleTestCase<CatchWithUnthrownExceptionRule>
10+ */
11+ class CatchWithUnthrownExceptionRuleTest extends RuleTestCase
12+ {
13+
14+ protected function getRule (): Rule
15+ {
16+ return self ::getContainer ()->getByType (CatchWithUnthrownExceptionRule::class);
17+ }
18+
19+ public function testRule (): void
20+ {
21+ $ this ->analyse ([__DIR__ . '/data/unthrown-exception.php ' ], []);
22+ }
23+
24+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace UnthrownException ;
4+
5+ class FooFacade
6+ {
7+
8+ /** @var \Doctrine\ORM\EntityManager */
9+ private $ entityManager ;
10+
11+ public function doFoo (): void
12+ {
13+ try {
14+ $ this ->entityManager ->flush ();
15+ } catch (\Doctrine \DBAL \Exception \UniqueConstraintViolationException $ e ) {
16+ // pass
17+ }
18+ }
19+
20+ }
You can’t perform that action at this time.
0 commit comments