File tree Expand file tree Collapse file tree 2 files changed +45
-38
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 2 files changed +45
-38
lines changed Original file line number Diff line number Diff line change @@ -86,41 +86,3 @@ public function doFoo(): void {
8686function getInt (): int {
8787 return 1 ;
8888}
89-
90-
91- interface ObjectDataMapper
92- {
93- /**
94- * @template OutType of object
95- *
96- * @param literal-string&class-string<OutType> $class
97- * @param mixed $data
98- *
99- * @return OutType
100- *
101- * @throws DataMappingException
102- */
103- public function map (string $ class , $ data ): object ;
104- }
105-
106- final class ApiProductController
107- {
108-
109- protected ?SearchProductsVM $ searchProductsVM = null ;
110-
111- protected static ?SearchProductsVM $ searchProductsVMStatic = null ;
112-
113- public function search (ObjectDataMapper $ dataMapper ): void
114- {
115- $ this ->searchProductsVM = $ dataMapper ->map (SearchProductsVM::class, $ _REQUEST );
116- assertType ('RememberNonNullablePropertyWhenStrictTypesDisabled\SearchProductsVM ' , $ this ->searchProductsVM );
117- }
118-
119- public function searchStatic (ObjectDataMapper $ dataMapper ): void
120- {
121- self ::$ searchProductsVMStatic = $ dataMapper ->map (SearchProductsVM::class, $ _REQUEST );
122- assertType ('RememberNonNullablePropertyWhenStrictTypesDisabled\SearchProductsVM ' , self ::$ searchProductsVMStatic );
123- }
124- }
125-
126- class SearchProductsVM {}
Original file line number Diff line number Diff line change 1+ <?php // lint >= 8.1
2+
3+ declare (strict_types = 0 );
4+
5+ namespace RememberNullablePropertyWhenStrictTypesDisabled ;
6+
7+ use function PHPStan \Testing \assertNativeType ;
8+ use function PHPStan \Testing \assertType ;
9+
10+ interface ObjectDataMapper
11+ {
12+ /**
13+ * @template OutType of object
14+ *
15+ * @param literal-string&class-string<OutType> $class
16+ * @param mixed $data
17+ *
18+ * @return OutType
19+ *
20+ * @throws DataMappingException
21+ */
22+ public function map (string $ class , $ data ): object ;
23+ }
24+
25+ final class ApiProductController
26+ {
27+
28+ protected ?SearchProductsVM $ searchProductsVM = null ;
29+
30+ protected static ?SearchProductsVM $ searchProductsVMStatic = null ;
31+
32+ public function search (ObjectDataMapper $ dataMapper ): void
33+ {
34+ $ this ->searchProductsVM = $ dataMapper ->map (SearchProductsVM::class, $ _REQUEST );
35+ assertType ('RememberNullablePropertyWhenStrictTypesDisabled\SearchProductsVM ' , $ this ->searchProductsVM );
36+ }
37+
38+ public function searchStatic (ObjectDataMapper $ dataMapper ): void
39+ {
40+ self ::$ searchProductsVMStatic = $ dataMapper ->map (SearchProductsVM::class, $ _REQUEST );
41+ assertType ('RememberNullablePropertyWhenStrictTypesDisabled\SearchProductsVM ' , self ::$ searchProductsVMStatic );
42+ }
43+ }
44+
45+ class SearchProductsVM {}
You can’t perform that action at this time.
0 commit comments