-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d602c5
commit b86f3a4
Showing
13 changed files
with
323 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/PHPStan/Analyser/data/inherit-phpdoc-merging-param.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace InheritDocMergingParam; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class A {} | ||
class B extends A {} | ||
class C extends B {} | ||
|
||
class GrandparentClass | ||
{ | ||
/** @param A $one */ | ||
public function method($one, $two): void {} | ||
} | ||
|
||
class ParentClass extends GrandparentClass | ||
{ | ||
/** @param B $dos */ | ||
public function method($uno, $dos): void | ||
{ | ||
assertType('InheritDocMergingParam\A', $uno); | ||
assertType('InheritDocMergingParam\B', $dos); | ||
} | ||
} | ||
|
||
class ChildClass extends ParentClass | ||
{ | ||
/** @param C $one */ | ||
public function method($one, $two): void | ||
{ | ||
assertType('InheritDocMergingParam\C', $one); | ||
assertType('InheritDocMergingParam\B', $two); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
tests/PHPStan/Analyser/data/inherit-phpdoc-merging-return.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace InheritDocMergingReturn; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class A {} | ||
class B extends A {} | ||
class C extends B {} | ||
class D extends A {} | ||
|
||
class GrandparentClass | ||
{ | ||
/** @return B */ | ||
public function method() { return new B(); } | ||
} | ||
|
||
interface InterfaceC | ||
{ | ||
/** @return C */ | ||
public function method(); | ||
} | ||
|
||
interface InterfaceA | ||
{ | ||
/** @return A */ | ||
public function method(); | ||
} | ||
|
||
class ParentClass extends GrandparentClass implements InterfaceC, InterfaceA | ||
{ | ||
/** Some comment */ | ||
public function method() { } | ||
} | ||
|
||
class ChildClass extends ParentClass | ||
{ | ||
public function method() { } | ||
} | ||
|
||
class ChildClass2 extends ParentClass | ||
{ | ||
/** | ||
* @return D | ||
*/ | ||
public function method() { } | ||
} | ||
|
||
|
||
function (ParentClass $foo): void { | ||
assertType('InheritDocMergingReturn\C', $foo->method()); | ||
}; | ||
|
||
function (ChildClass $foo): void { | ||
assertType('InheritDocMergingReturn\C', $foo->method()); | ||
}; | ||
|
||
function (ChildClass2 $foo): void { | ||
assertType('InheritDocMergingReturn\D', $foo->method()); | ||
}; |
82 changes: 82 additions & 0 deletions
82
tests/PHPStan/Analyser/data/inherit-phpdoc-merging-var.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace InheritDocMergingVar; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class A {} | ||
class B extends A {} | ||
|
||
class One | ||
{ | ||
/** @var A */ | ||
protected $property; | ||
|
||
public function method(): void | ||
{ | ||
assertType('InheritDocMergingVar\A', $this->property); | ||
} | ||
} | ||
|
||
class Two extends One | ||
{ | ||
/** @var B */ | ||
protected $property; | ||
|
||
public function method(): void | ||
{ | ||
assertType('InheritDocMergingVar\B', $this->property); | ||
} | ||
} | ||
|
||
class Three extends Two | ||
{ | ||
/** Some comment */ | ||
protected $property; | ||
|
||
public function method(): void | ||
{ | ||
assertType('InheritDocMergingVar\B', $this->property); | ||
} | ||
} | ||
|
||
class Four extends Three | ||
{ | ||
protected $property; | ||
|
||
public function method(): void | ||
{ | ||
assertType('InheritDocMergingVar\B', $this->property); | ||
} | ||
} | ||
|
||
class Five extends Four | ||
{ | ||
|
||
public function method(): void | ||
{ | ||
assertType('InheritDocMergingVar\B', $this->property); | ||
} | ||
|
||
} | ||
|
||
class Six extends Five | ||
{ | ||
protected $property; | ||
|
||
public function method(): void | ||
{ | ||
// assertType('InheritDocMergingVar\B', $this->property); | ||
} | ||
} | ||
|
||
class Seven extends One | ||
{ | ||
|
||
/** | ||
* @inheritDoc | ||
* @var B | ||
*/ | ||
protected $property; | ||
|
||
} |
121 changes: 0 additions & 121 deletions
121
tests/PHPStan/PhpDoc/PhpDocInheritanceResolverIntegrationTest.php
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.