-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch refs/heads/1.12.x into 2.1.x
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 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
46 changes: 46 additions & 0 deletions
46
tests/PHPStan/Rules/Methods/data/overriden-abstract-trait-method-phpdoc.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,46 @@ | ||
<?php | ||
|
||
namespace OverridenAbstractTraitMethodPhpDoc; | ||
|
||
/** | ||
* @template DataArray of array<string, mixed> | ||
*/ | ||
trait FooTrait | ||
{ | ||
/** | ||
* Offset checker | ||
* | ||
* @phpstan-param Offset $offset | ||
* @return bool | ||
* @template Offset of key-of<DataArray> | ||
*/ | ||
abstract public function offsetExists(mixed $offset): bool; | ||
} | ||
|
||
/** | ||
* @template DataArray of array<string, mixed> | ||
* @phpstan-type DataKey key-of<DataArray> | ||
* @phpstan-type DataValue DataArray[DataKey] | ||
*/ | ||
class FooClass | ||
{ | ||
|
||
/** @phpstan-use FooTrait<DataArray> */ | ||
use FooTrait; | ||
|
||
/** @phpstan-var DataArray|array{} */ | ||
public array $data = []; | ||
|
||
|
||
/** | ||
* Data checker | ||
* | ||
* @phpstan-param Offset $offset | ||
* @return bool | ||
* @template Offset of key-of<DataArray> | ||
*/ | ||
public function offsetExists(mixed $offset): bool | ||
{ | ||
return array_key_exists($offset, $this->data); | ||
} | ||
} |