File tree 2 files changed +31
-1
lines changed
src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -789,7 +789,7 @@ private static function handleNamedCall(
789
789
}
790
790
}
791
791
792
- if (!$ callstatic_method_exists || $ class_storage ->hasSealedMethods ($ config )) {
792
+ if ($ naive_method_exists || !$ callstatic_method_exists || $ class_storage ->hasSealedMethods ($ config )) {
793
793
$ does_method_exist = MethodAnalyzer::checkMethodExists (
794
794
$ codebase ,
795
795
$ method_id ,
Original file line number Diff line number Diff line change @@ -90,6 +90,36 @@ function requiresString(string $_str): void {}
90
90
$ this ->analyzeFile ('somefile.php ' , new Context ());
91
91
}
92
92
93
+ public function testAssertsAllongCallStaticMethodWork (): void
94
+ {
95
+ $ this ->addFile (
96
+ 'somefile.php ' ,
97
+ '<?php
98
+
99
+ class ImportedAssert
100
+ {
101
+ /** @psalm-assert non-empty-string $b */
102
+ public static function notEmptyStrOnly(string $b): void
103
+ {
104
+ if ("" === $b) throw new \Exception("");
105
+ }
106
+
107
+ public function __callStatic() {}
108
+ }
109
+
110
+ /** @return non-empty-string */
111
+ function returnNonEmpty(string $b): string
112
+ {
113
+ ImportedAssert::notEmptyStrOnly($b);
114
+
115
+ return $b;
116
+ }
117
+ ' ,
118
+ );
119
+
120
+ $ this ->analyzeFile ('somefile.php ' , new Context ());
121
+ }
122
+
93
123
public function testAssertInvalidDocblockMessageDoesNotIncludeTrace (): void
94
124
{
95
125
$ this ->expectException (CodeException::class);
You can’t perform that action at this time.
0 commit comments