Skip to content

Commit 24a938d

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: [Dotenv] Documentation improvement [DI] Clarified deprecation for TypedReference in 4.4 [Validator] Add missing vietnamese translations add German translation add missing Messenger options to XML schema definition [Validator][ConstraintValidator] Update wrong PRETTY_DATE doc [DomCrawler][Form] Fix PHPDoc on get & offsetGet [ErrorHandler] fix parsing static return type on interface method annotation (fix #35836) prevent method calls on null values Return int if scale = 0
2 parents 533c832 + 89aa4b9 commit 24a938d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

DebugClassLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,17 +427,17 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
427427
}
428428
}
429429

430-
if ($refl->isInterface() && false !== strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
430+
if ($refl->isInterface() && false !== strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+([\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
431431
foreach ($notice as $method) {
432-
$static = '' !== $method[1];
433-
$name = $method[2];
434-
$description = $method[3] ?? null;
432+
$static = '' !== $method[1] && !empty($method[2]);
433+
$name = $method[3];
434+
$description = $method[4] ?? null;
435435
if (false === strpos($name, '(')) {
436436
$name .= '()';
437437
}
438438
if (null !== $description) {
439439
$description = trim($description);
440-
if (!isset($method[4])) {
440+
if (!isset($method[5])) {
441441
$description .= '.';
442442
}
443443
}

Tests/DebugClassLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ class_exists('Test\\'.ExtendsVirtual::class, true);
325325
restore_error_handler();
326326

327327
$this->assertSame([
328+
'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::staticReturningMethod()".',
328329
'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::sameLineInterfaceMethodNoBraces()".',
329330
'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::newLineInterfaceMethod()": Some description!',
330331
'Class "Test\Symfony\Component\ErrorHandler\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\ErrorHandler\Tests\Fixtures\VirtualInterface::newLineInterfaceMethodNoBraces()": Description.',

Tests/Fixtures/VirtualInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
/**
66
* @method string interfaceMethod()
7+
* @method static staticReturningMethod()
78
* @method sameLineInterfaceMethod($arg)
89
* @method sameLineInterfaceMethodNoBraces
910
*
@@ -25,7 +26,7 @@
2526
*
2627
* Static
2728
* @method static Foo&Bar staticMethod()
28-
* @method static staticMethodNoBraces
29+
* @method static mixed staticMethodNoBraces
2930
* @method static \stdClass staticMethodTyped(int $arg) Description
3031
* @method static \stdClass[] staticMethodTypedNoBraces
3132
*/

0 commit comments

Comments
 (0)