File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -3616,4 +3616,13 @@ public function testBug12880(): void
36163616 $ this ->analyse ([__DIR__ . '/data/bug-12880.php ' ], []);
36173617 }
36183618
3619+ public function testBug12940 (): void
3620+ {
3621+ $ this ->checkThisOnly = false ;
3622+ $ this ->checkNullables = true ;
3623+ $ this ->checkUnionTypes = true ;
3624+ $ this ->checkExplicitMixed = true ;
3625+
3626+ $ this ->analyse ([__DIR__ . '/data/bug-12940.php ' ], []);
3627+ }
36193628}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug12940 ;
4+
5+ class GeneralUtility
6+ {
7+ /**
8+ * @template T of object
9+ * @param class-string<T> $className
10+ * @return T
11+ */
12+ public static function makeInstance (string $ className , mixed ...$ args ): object
13+ {
14+ return new $ className (...$ args );
15+ }
16+ }
17+
18+ class PageRenderer
19+ {
20+ public function setTemplateFile (string $ path ): void
21+ {
22+ }
23+
24+ public function setLanguage (string $ lang ): void
25+ {
26+ }
27+ }
28+
29+ class TypoScriptFrontendController
30+ {
31+
32+ protected ?PageRenderer $ pageRenderer = null ;
33+
34+ public function initializePageRenderer (): void
35+ {
36+ if ($ this ->pageRenderer !== null ) {
37+ return ;
38+ }
39+ $ this ->pageRenderer = GeneralUtility::makeInstance (PageRenderer::class);
40+ $ this ->pageRenderer ->setTemplateFile ('EXT:frontend/Resources/Private/Templates/MainPage.html ' );
41+ $ this ->pageRenderer ->setLanguage ('DE ' );
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments