Skip to content

Commit 8c69b16

Browse files
Fix testing functions with return types
1 parent 3e80d6c commit 8c69b16

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Php80/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function fdiv(float $dividend, float $divisor): float { return p\Php80::fdiv($di
1717
}
1818

1919
if (!function_exists('preg_last_error_msg')) {
20-
function preg_last_error_msg() { return p\Php80::preg_last_error_msg(); }
20+
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
2121
}
2222

2323
if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {

src/Util/TestListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function startTestSuite($mainSuite)
6565
$bootstrap->rewind();
6666

6767
foreach (new \RegexIterator($bootstrap, '/return p\\\\'.$testedClass->getShortName().'::/') as $defLine) {
68-
if (!preg_match('/^\s*function (?P<name>[^\(]++)(?P<signature>\(.*\)) \{ (?<return>return p\\\\'.$testedClass->getShortName().'::[^\(]++)(?P<args>\([^\)]*+\)); \}$/', $defLine, $f)) {
68+
if (!preg_match('/^\s*function (?P<name>[^\(]++)(?P<signature>\(.*\)(?: ?: [^ ]++)?) \{ (?<return>return p\\\\'.$testedClass->getShortName().'::[^\(]++)(?P<args>\([^\)]*+\)); \}$/', $defLine, $f)) {
6969
$warnings[] = TestListener::warning('Invalid line in bootstrap.php: '.trim($defLine));
7070
continue;
7171
}

tests/Php80/Php80Test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public function testFilterValidateBool()
5959
}
6060

6161
/**
62-
* @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
62+
* @covers \Symfony\Polyfill\Php80\Php80::preg_last_error_msg
6363
*/
6464
public function testPregNoError()
6565
{
6666
$this->assertSame('No error', preg_last_error_msg());
6767
}
6868

6969
/**
70-
* @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
70+
* @covers \Symfony\Polyfill\Php80\Php80::preg_last_error_msg
7171
*/
7272
public function testPregMalformedUtfError()
7373
{
@@ -76,7 +76,7 @@ public function testPregMalformedUtfError()
7676
}
7777

7878
/**
79-
* @covers \Symfony\Polyfill\Php80\Php80::pregLastErrorMsg
79+
* @covers \Symfony\Polyfill\Php80\Php80::preg_last_error_msg
8080
*/
8181
public function testPregMalformedUtf8Offset()
8282
{

0 commit comments

Comments
 (0)