Skip to content

Commit

Permalink
minor #30464 [Debug][DebugClassLoader] Detect annotations before blan…
Browse files Browse the repository at this point in the history
…k docblock lines on final and internal methods (fancyweb)

This PR was merged into the 3.4 branch.

Discussion
----------

[Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

@xabbuh Follow up of #30437

Commits
-------

e97ea77 [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods
  • Loading branch information
nicolas-grekas committed Mar 7, 2019
2 parents c5610fa + e97ea77 commit e9c8e19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/DebugClassLoader.php
Expand Up @@ -307,7 +307,7 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
}

foreach (['final', 'internal'] as $annotation) {
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) {
if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
}
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php
Expand Up @@ -13,6 +13,8 @@ public function finalMethod()

/**
* @final
*
* @return int
*/
public function finalMethod2()
{
Expand Down

0 comments on commit e9c8e19

Please sign in to comment.