File tree 2 files changed +19
-1
lines changed
src/Psalm/Internal/Analyzer/Statements/Expression/Call
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,17 @@ public static function analyze(
244
244
new Union ([$ result_atomic_type ]),
245
245
);
246
246
247
+ if (strtolower ($ fq_class_name ) === 'stdclass ' && $ stmt ->getArgs () !== []) {
248
+ IssueBuffer::maybeAdd (
249
+ new TooManyArguments (
250
+ 'stdClass::__construct() has no parameters ' ,
251
+ new CodeLocation ($ statements_analyzer ->getSource (), $ stmt ),
252
+ 'stdClass::__construct ' ,
253
+ ),
254
+ $ statements_analyzer ->getSuppressedIssues (),
255
+ );
256
+ }
257
+
247
258
if (strtolower ($ fq_class_name ) !== 'stdclass ' &&
248
259
$ codebase ->classlikes ->classExists ($ fq_class_name )
249
260
) {
Original file line number Diff line number Diff line change @@ -1238,7 +1238,7 @@ public function x(): void {}
1238
1238
}
1239
1239
class Child1 extends Old {}
1240
1240
class Child2 extends Old {}
1241
-
1241
+
1242
1242
/**
1243
1243
* @template IsClient of bool
1244
1244
*/
@@ -1798,6 +1798,13 @@ public function foo(callable $_a = "strlen"): void {}
1798
1798
' ,
1799
1799
'error_message ' => 'InvalidParamDefault ' ,
1800
1800
],
1801
+ 'stdClassConstructorHasNoParameters ' => [
1802
+ 'code ' => <<<'PHP'
1803
+ <?php
1804
+ $a = new stdClass(5);
1805
+ PHP,
1806
+ 'error_message ' => 'TooManyArguments ' ,
1807
+ ],
1801
1808
];
1802
1809
}
1803
1810
}
You can’t perform that action at this time.
0 commit comments