Skip to content

Commit

Permalink
Revert "Dumb down parameter types in recently added stubs"
Browse files Browse the repository at this point in the history
This reverts commit 2d79c62.
  • Loading branch information
ondrejmirtes committed Sep 30, 2024
1 parent f0a6296 commit 950a491
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions stubs/core.stub
Original file line number Diff line number Diff line change
Expand Up @@ -222,48 +222,48 @@ function preg_match_all($pattern, $subject, &$matches = [], int $flags = 1, int
function preg_match($pattern, $subject, &$matches = [], int $flags = 0, int $offset = 0) {}

/**
* @param string|array<mixed> $pattern
* @param callable(array<int|string, string>):string $callback
* @param string|array<mixed> $subject
* @param string|string[] $pattern
* @param callable(string[]):string $callback
* @param string|array<string|int|float> $subject
* @param int $count
* @param-out 0|positive-int $count
* @return ($subject is array ? list<string>|null : string|null)
*/
function preg_replace_callback($pattern, $callback, $subject, int $limit = -1, &$count = null, int $flags = 0) {}

/**
* @param string|array<mixed> $pattern
* @param string|array<mixed> $replacement
* @param string|array<mixed> $subject
* @param string|string[] $pattern
* @param string|array<string|int|float> $replacement
* @param string|array<string|int|float> $subject
* @param int $count
* @param-out 0|positive-int $count
* @return ($subject is array ? list<string>|null : string|null)
*/
function preg_replace($pattern, $replacement, $subject, int $limit = -1, &$count = null) {}

/**
* @param string|array<mixed> $pattern
* @param string|array<mixed> $replacement
* @param string|array<mixed> $subject
* @param string|string[] $pattern
* @param string|array<string|int|float> $replacement
* @param string|array<string|int|float> $subject
* @param int $count
* @param-out 0|positive-int $count
* @return ($subject is array ? list<string> : string|null)
*/
function preg_filter($pattern, $replacement, $subject, int $limit = -1, &$count = null) {}

/**
* @param array<mixed>|string $search
* @param array<mixed>|string $replace
* @param array<mixed>|string $subject
* @param array<string>|string $search
* @param array<string>|string $replace
* @param array<string>|string $subject
* @param-out int $count
* @return list<string>|string
*/
function str_replace($search, $replace, $subject, ?int &$count = null) {}

/**
* @param array<mixed>|string $search
* @param array<mixed>|string $replace
* @param array<mixed>|string $subject
* @param array<string>|string $search
* @param array<string>|string $replace
* @param array<string>|string $subject
* @param-out int $count
* @return list<string>|string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,19 +654,19 @@ public function testPregReplaceCallback(): void
{
$this->analyse([__DIR__ . '/data/preg_replace_callback.php'], [
[
'Parameter #2 $callback of function preg_replace_callback expects callable(array<int|string, string>): string, Closure(string): string given.',
'Parameter #2 $callback of function preg_replace_callback expects callable(array<string>): string, Closure(string): string given.',
6,
],
[
'Parameter #2 $callback of function preg_replace_callback expects callable(array<int|string, string>): string, Closure(string): string given.',
'Parameter #2 $callback of function preg_replace_callback expects callable(array<string>): string, Closure(string): string given.',
13,
],
[
'Parameter #2 $callback of function preg_replace_callback expects callable(array<int|string, string>): string, Closure(array): void given.',
'Parameter #2 $callback of function preg_replace_callback expects callable(array<string>): string, Closure(array): void given.',
20,
],
[
'Parameter #2 $callback of function preg_replace_callback expects callable(array<int|string, string>): string, Closure(): void given.',
'Parameter #2 $callback of function preg_replace_callback expects callable(array<string>): string, Closure(): void given.',
25,
],
]);
Expand Down

0 comments on commit 950a491

Please sign in to comment.