8000 Don't parse interfaces/traits doc blocks for @final · symfony/symfony@d1e0588 · GitHub
[go: up one dir, main page]

Skip to content

Commit d1e0588

Browse files
committed
Don't parse interfaces/traits doc blocks for @Final
1 parent 17e9488 commit d1e0588

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,18 @@ public function loadClass($class)
165165
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
166166
}
167167

168-
if (preg_match('#\n \* @final(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
169-
self::$final[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
170-
}
171-
172168
$parent = get_parent_class($class);
173-
if ($parent && isset(self::$final[$parent])) {
174-
@trigger_error(sprintf('The %s class is considered final%s. It may change without further notice as of its next major version. You should not extend it from %s.', $parent, self::$final[$parent], $name), E_USER_DEPRECATED);
175-
}
176169

177170
// Not an interface nor a trait
178171
if (class_exists($name, false)) {
172+
if (preg_match('#\n \* @final(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
173+
self::$final[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
174+
}
175+
176+
if ($parent && isset(self::$final[$parent])) {
177+
@trigger_error(sprintf('The %s class is considered final%s. It may change without further notice as of its next major version. You should not extend it from %s.', $parent, self::$final[$parent], $name), E_USER_DEPRECATED);
178+
}
179+
179180
// Inherit @final annotations
180181
self::$finalMethods[$name] = $parent && isset(self::$finalMethods[$parent]) ? self::$finalMethods[$parent] : array();
181182

0 commit comments

Comments
 (0)
0