-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed handling of static in parameter type in implemented interfaces
- Loading branch information
1 parent
00a8ba9
commit d225a68
Showing
6 changed files
with
243 additions
and
6 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
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
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,66 @@ | ||
<?php | ||
|
||
namespace Bug4707Covariant; | ||
|
||
/** | ||
* @template-covariant TParent of ParentNodeInterface | ||
*/ | ||
interface ChildNodeInterface | ||
{ | ||
/** @return TParent */ | ||
public function getParent(): ParentNodeInterface; | ||
} | ||
|
||
interface ParentNodeInterface | ||
{ | ||
/** @return list<ChildNodeInterface<static>> */ | ||
public function getChildren(): array; | ||
} | ||
|
||
final class Block implements ParentNodeInterface | ||
{ | ||
/** @var list<Row> */ | ||
private $rows = []; | ||
|
||
/** @return list<Row> */ | ||
public function getChildren(): array | ||
{ | ||
return $this->rows; | ||
} | ||
} | ||
|
||
class Block2 implements ParentNodeInterface | ||
{ | ||
/** @var list<Row2> */ | ||
private $rows = []; | ||
|
||
/** @return list<Row2> */ | ||
public function getChildren(): array | ||
{ | ||
return $this->rows; | ||
} | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block> */ | ||
final class Row implements ChildNodeInterface | ||
{ | ||
/** @var Block $parent */ | ||
private $parent; | ||
|
||
public function getParent(): Block | ||
{ | ||
return $this->parent; | ||
} | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block2> */ | ||
final class Row2 implements ChildNodeInterface | ||
{ | ||
/** @var Block2 $parent */ | ||
private $parent; | ||
|
||
public function getParent(): Block2 | ||
{ | ||
return $this->parent; | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Bug4707Three; | ||
|
||
/** | ||
* @template TParent of ParentNodeInterface | ||
*/ | ||
interface ChildNodeInterface | ||
{} | ||
|
||
interface ParentNodeInterface | ||
{ | ||
/** @return ChildNodeInterface<Block> */ | ||
public function getChildren(); | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block> */ | ||
final class Row implements ChildNodeInterface {} | ||
|
||
class Block implements ParentNodeInterface | ||
{ | ||
/** @return Row */ | ||
public function getChildren() { | ||
return new Row(); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Bug4707Two; | ||
|
||
/** | ||
* @template TParent of ParentNodeInterface | ||
*/ | ||
interface ChildNodeInterface | ||
{} | ||
|
||
interface ParentNodeInterface | ||
{ | ||
/** @return ChildNodeInterface<Block> */ | ||
public function getChildren(); | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block> */ | ||
final class Row implements ChildNodeInterface {} | ||
|
||
final class Block implements ParentNodeInterface | ||
{ | ||
/** @return Row */ | ||
public function getChildren() { | ||
return new Row(); | ||
} | ||
} |
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,66 @@ | ||
<?php | ||
|
||
namespace Bug4707; | ||
|
||
/** | ||
* @template TParent of ParentNodeInterface | ||
*/ | ||
interface ChildNodeInterface | ||
{ | ||
/** @return TParent */ | ||
public function getParent(): ParentNodeInterface; | ||
} | ||
|
||
interface ParentNodeInterface | ||
{ | ||
/** @return list<ChildNodeInterface<static>> */ | ||
public function getChildren(): array; | ||
} | ||
|
||
final class Block implements ParentNodeInterface | ||
{ | ||
/** @var list<Row> */ | ||
private $rows = []; | ||
|
||
/** @return list<Row> */ | ||
public function getChildren(): array | ||
{ | ||
return $this->rows; | ||
} | ||
} | ||
|
||
class Block2 implements ParentNodeInterface | ||
{ | ||
/** @var list<Row2> */ | ||
private $rows = []; | ||
|
||
/** @return list<Row2> */ | ||
public function getChildren(): array | ||
{ | ||
return $this->rows; | ||
} | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block> */ | ||
final class Row implements ChildNodeInterface | ||
{ | ||
/** @var Block $parent */ | ||
private $parent; | ||
|
||
public function getParent(): Block | ||
{ | ||
return $this->parent; | ||
} | ||
} | ||
|
||
/** @implements ChildNodeInterface<Block2> */ | ||
final class Row2 implements ChildNodeInterface | ||
{ | ||
/** @var Block2 $parent */ | ||
private $parent; | ||
|
||
public function getParent(): Block2 | ||
{ | ||
return $this->parent; | ||
} | ||
} |