Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 24279f9

Browse filesBrowse files
bug symfony#40066 [ErrorHandler] fix parsing return types in DebugClassLoader (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [ErrorHandler] fix parsing return types in DebugClassLoader | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - In 5.3, we might want to make `SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1` the default, so that ppl know when they're missing some return types when they inherit some classes from vendors. This would fix https://github.com/orgs/symfony/projects/1#card-30856423 On 4.4, we have to disable this mode of reporting until these PRs are merged: - twigphp/Twig#3481 - doctrine/collections#269 - predis/predis#678 Commits ------- 58e32b3 [ErrorHandler] fix parsing return types in DebugClassLoader
2 parents 088eb1d + d10d19e commit 24279f9
Copy full SHA for 24279f9

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎DebugClassLoader.php

Copy file name to clipboardExpand all lines: DebugClassLoader.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
535535
if (null !== (self::INTERNAL_TYPES[$use] ?? null)) {
536536
foreach (self::INTERNAL_TYPES[$use] as $method => $returnType) {
537537
if ('void' !== $returnType) {
538-
self::$returnTypes[$class] += [$method => [$returnType, $returnType, $class, '']];
538+
self::$returnTypes[$class] += [$method => [$returnType, $returnType, $use, '']];
539539
}
540540
}
541541
}
@@ -612,7 +612,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
612612
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
613613
}
614614

615-
if (strncmp($ns, $declaringClass, $len)) {
615+
if (false === strpos($doc, '@deprecated') && strncmp($ns, $declaringClass, $len)) {
616616
if ($canAddReturnType && 'docblock' === $this->patchTypes['force'] && false === strpos($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
617617
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
618618
} elseif ('' !== $declaringClass && $this->patchTypes['deprecations']) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.