File tree Expand file tree Collapse file tree
tests/PHPStan/Rules/Variables Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1415,6 +1415,10 @@ public function testBug9349(): void
14151415 'Variable $sql might not be defined. ' ,
14161416 19 ,
14171417 ],
1418+ [
1419+ 'Variable $sql might not be defined. ' ,
1420+ 78 ,
1421+ ],
14181422 ]);
14191423 }
14201424
Original file line number Diff line number Diff line change @@ -60,3 +60,35 @@ public function maybeThrows2(): void
6060 }
6161 }
6262}
63+
64+ class HelloWorld3
65+ {
66+ public function test3 (): void
67+ {
68+ global $ pdo ;
69+
70+ try {
71+ $ this ->maybeThrows3 ();
72+ $ sql = "SELECT * FROM foo " ;
73+ $ rs = $ pdo ->query ($ sql );
74+ if ($ result = $ rs ->fetch (\PDO ::FETCH_ASSOC )) {
75+ // do something
76+ }
77+ } catch (\PDOException $ e ) {
78+ var_dump ($ sql );
79+ }
80+ }
81+
82+ /**
83+ * @throws \LogicException|\RuntimeException
84+ */
85+ public function maybeThrows3 (): void
86+ {
87+ if (random_int (0 , 1 ) === 1 ) {
88+ throw new \RuntimeException ();
89+ }
90+ if (random_int (0 , 1 ) === 1 ) {
91+ throw new \LogicException ();
92+ }
93+ }
94+ }
You can’t perform that action at this time.
0 commit comments