Skip to content

Commit 0e7176d

Browse files
committed
define similar_text() param-out
1 parent 4e4df1a commit 0e7176d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

stubs/core.stub

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ function bin2hex(string $string): string {}
7474
*/
7575
function parse_str(string $string, array &$result): void {}
7676

77+
/** @param-out float $percent */
78+
function similar_text(string $string1, string $string2, float &$percent = null) : int {}
79+
7780
/**
7881
* @template T
7982
* @template TArray as array<T>

tests/PHPStan/Analyser/data/param-out.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,9 @@ function testParseStr() {
320320

321321
\PHPStan\Testing\assertType('array<int|string, list<string>|string>', $output);
322322
}
323+
324+
function fooSimilar() {
325+
$similar = similar_text('foo', 'bar', $percent);
326+
assertType('int', $similar);
327+
assertType('float', $percent);
328+
}

0 commit comments

Comments
 (0)