mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix preg_match_all stub (#4325)
* preg_match_all can return false * Test for preg_match_all returning false * Fix test * Add @psalm-ignore-falsable-return
This commit is contained in:
parent
d4ccfcf75d
commit
fb505df807
@ -760,7 +760,8 @@ function preg_replace_callback($search, $replace, $subject, int $limit = -1, &$c
|
||||
* )
|
||||
* )
|
||||
* ) $matches
|
||||
* @return int
|
||||
* @return int|false
|
||||
* @psalm-ignore-falsable-return
|
||||
*/
|
||||
function preg_match_all($pattern, $replace, &$matches = [], int $flags = 1, int $offset = 0) {}
|
||||
|
||||
|
@ -1341,6 +1341,15 @@ class FunctionCallTest extends TestCase
|
||||
return $matches[0];
|
||||
}'
|
||||
],
|
||||
'pregMatchAllReturnsFalse' => [
|
||||
'<?php
|
||||
/**
|
||||
* @return int|false
|
||||
*/
|
||||
function badpattern() {
|
||||
return @preg_match_all("foo", "foo", $matches);
|
||||
}'
|
||||
],
|
||||
'strposAllowDictionary' => [
|
||||
'<?php
|
||||
function sayHello(string $format): void {
|
||||
|
Loading…
Reference in New Issue
Block a user