Skip to content

Commit

Permalink
2914 Fix a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Inkin authored and ondrejmirtes committed May 10, 2020
1 parent dfd3c63 commit a66d6b1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/PhpDoc/PhpDocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,6 @@ private static function resolvePhpDocBlockFromClass(
if ($parentReflection->isPrivate()) {
return null;
}
if (
!$parentReflection->getDeclaringClass()->isTrait()
&& $parentReflection->getDeclaringClass()->getName() !== $classReflection->getName()
) {
return null;
}

if ($parentReflection instanceof PhpPropertyReflection || $parentReflection instanceof ResolvedPropertyReflection) {
$traitReflection = $parentReflection->getDeclaringTrait();
Expand Down
40 changes: 40 additions & 0 deletions tests/PHPStan/Analyser/data/generics.php
Original file line number Diff line number Diff line change
Expand Up @@ -1280,3 +1280,43 @@ function arrayOfGenericClassStrings(array $a): void
{
assertType('array<class-string<PHPStan\Generics\FunctionsAssertType\Foo>>', $a);
}

/**
* @template T
*/
class TagMergingGrandparent
{
/** @var T */
public $property;

/**
* @param T $one
* @param int $two
*/
public function method($one, $two): void {}
}

/**
* @template TT
* @extends TagMergingGrandparent<TT>
*/
class TagMergingParent extends TagMergingGrandparent
{
/**
* @param TT $one
*/
public function method($one, $two): void {}
}

/**
* @extends TagMergingParent<float>
*/
class TagMergingChild extends TagMergingParent
{
public function method($one, $two): void
{
assertType('float', $one);
assertType('int', $two);
assertType('float', $this->property);
}
}
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/data/inherit-phpdoc-merging-var.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Six extends Five

public function method(): void
{
// assertType('InheritDocMergingVar\B', $this->property);
assertType('InheritDocMergingVar\B', $this->property);
}
}

Expand Down

0 comments on commit a66d6b1

Please sign in to comment.