mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Improve stubs for str_replace and preg_replace (#3495)
* expand accepted values for str_replace and preg_replace. Make return conditional based on type of $subject * Remove int|float from str_replace/preg_replace Co-authored-by: Matthew Brown <github@muglug.com>
This commit is contained in:
parent
51bf7f38de
commit
428beb21fb
@ -560,11 +560,11 @@ function htmlspecialchars_decode(string $string, ?int $quote_style = null) : str
|
||||
/**
|
||||
* @psalm-pure
|
||||
*
|
||||
* @param string|string[] $search
|
||||
* @param string|string[] $replace
|
||||
* @param string|string[] $subject
|
||||
* @param string|array<string|int|float> $search
|
||||
* @param string|array<string|int|float> $replace
|
||||
* @param string|array<string|int|float> $subject
|
||||
* @param int $count
|
||||
* @return string|string[]
|
||||
* @return ($subject is array ? array<string> : string)
|
||||
*
|
||||
* @psalm-flow ($replace, $subject) -> return
|
||||
*/
|
||||
@ -574,10 +574,10 @@ function str_replace($search, $replace, $subject, &$count = null) {}
|
||||
* @psalm-pure
|
||||
*
|
||||
* @param string|string[] $search
|
||||
* @param string|string[] $replace
|
||||
* @param string|string[] $subject
|
||||
* @param string|array<string|int|float> $replace
|
||||
* @param string|array<string|int|float> $subject
|
||||
* @param int $count
|
||||
* @return string|string[]
|
||||
* @return ($subject is array ? array<string> : string)
|
||||
*
|
||||
* @psalm-flow ($replace, $subject) -> return
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user