File tree Expand file tree Collapse file tree
src/Psalm/Internal/Analyzer/Statements/Expression/Call Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1368,7 +1368,7 @@ private static function taintReturnType(
13681368 ? ($ method_storage ->signature_return_type_location ?: $ method_storage ->location )
13691369 : null ;
13701370
1371- if ($ method_storage && $ method_storage ->pure ) {
1371+ if ($ method_storage && $ method_storage ->specialize_call ) {
13721372 $ method_source = TaintNode::getForMethodReturn (
13731373 (string ) $ method_id ,
13741374 $ cased_method_id ,
Original file line number Diff line number Diff line change @@ -1717,4 +1717,36 @@ public function testImplodeExplode() : void
17171717
17181718 $ this ->analyzeFile ('somefile.php ' , new Context ());
17191719 }
1720+
1721+ public function testSpecializeStaticMethod () : void
1722+ {
1723+ $ this ->project_analyzer ->trackTaintedInputs ();
1724+
1725+ $ this ->addFile (
1726+ 'somefile.php ' ,
1727+ '<?php
1728+ StringUtility::foo($_GET["c"]);
1729+
1730+ class StringUtility {
1731+ /**
1732+ * @psalm-taint-specialize
1733+ */
1734+ public static function foo(string $str) : string
1735+ {
1736+ return $str;
1737+ }
1738+
1739+ /**
1740+ * @psalm-taint-specialize
1741+ */
1742+ public static function slugify(string $url) : string {
1743+ return self::foo($url);
1744+ }
1745+ }
1746+
1747+ echo StringUtility::slugify("hello"); '
1748+ );
1749+
1750+ $ this ->analyzeFile ('somefile.php ' , new Context ());
1751+ }
17201752}
You can’t perform that action at this time.
0 commit comments