Skip to content

Commit

Permalink
Fix vimeo#4481 - ReflectionProperty implements Reflector
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug authored and danog committed Jan 29, 2021
1 parent c673d61 commit e7a4645
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/Psalm/Internal/Scanner/DocblockParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ public static function parse(string $docblock) : ParsedDocblock
// Strip off comments.
$docblock = trim($docblock);

$docblock = preg_replace('@^/\*\*@', '', $docblock);
$docblock = preg_replace('@\*\*?/$@', '', $docblock);
if (substr($docblock, 0, 3) === '/**') {
$docblock = substr($docblock, 3);
}

if (substr($docblock, -2) === '*/') {
$docblock = substr($docblock, 0, -2);

if (substr($docblock, -1) === '*') {
$docblock = substr($docblock, 0, -1);
}
}

// Normalize multi-line @specials.
$lines = explode("\n", $docblock);
Expand Down
6 changes: 3 additions & 3 deletions stubs/CoreGenericClasses.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,7 @@ class ReflectionClass implements Reflector {
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

class ReflectionFunction
class ReflectionFunction implements Reflector
{
/**
* @since 8.0
Expand All @@ -2162,7 +2162,7 @@ class ReflectionFunction
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

class ReflectionProperty
class ReflectionProperty implements Reflector
{
/**
* @since 8.0
Expand All @@ -2173,7 +2173,7 @@ class ReflectionProperty
public function getAttributes(?string $name = null, int $flags = 0): array {}
}

class ReflectionMethod
class ReflectionMethod implements Reflector
{
/**
* @since 8.0
Expand Down

0 comments on commit e7a4645

Please sign in to comment.