Skip to content

Commit

Permalink
Merge pull request #274 from ondrejmirtes/fix-phpstan
Browse files Browse the repository at this point in the history
PHPStan already supports array-key as template type variable bound
  • Loading branch information
greg0ire authored Jun 9, 2021
2 parents 9491825 + f5e6f4c commit b33e58d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/Doctrine/Common/Collections/AbstractLazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Lazy collection that is backed by a concrete collection
*
* @phpstan-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
* @template-implements Collection<TKey,T>
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/Common/Collections/ArrayCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* serialize a collection use {@link toArray()} and reconstruct the collection
* manually.
*
* @phpstan-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
* @template-implements Collection<TKey,T>
Expand Down Expand Up @@ -92,7 +91,6 @@ public function first()
*
* @psalm-template K of array-key
* @psalm-template V
* @phpstan-template K
*
* @psalm-param array<K,V> $elements
* @psalm-return static<K,V>
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/Common/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* position unless you explicitly positioned it before. Prefer iteration with
* external iterators.
*
* @phpstan-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
* @template-extends IteratorAggregate<TKey, T>
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/Common/Collections/Selectable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* this API can implement efficient database access without having to ask the
* EntityManager or Repositories.
*
* @phpstan-template TKey
* @psalm-template TKey as array-key
* @psalm-template T
*/
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ parameters:
- 'lib/Doctrine/Common/Collections/ArrayCollection.php'
- 'lib/Doctrine/Common/Collections/Criteria.php'
-
message: '~Array \(array\<TKey, T\>\) does not accept key int\.~'
message: '~Array \(array\<TKey of \(int\|string\), T\>\) does not accept key int\.~'
path: 'lib/Doctrine/Common/Collections/ArrayCollection.php'
5 changes: 5 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@
<RawObjectIteration errorLevel="info" />

<InvalidStringClass errorLevel="info" />
<UnsafeGenericInstantiation>
<errorLevel type="suppress">
<file name="lib/Doctrine/Common/Collections/ArrayCollection.php"/>
</errorLevel>
</UnsafeGenericInstantiation>
</issueHandlers>
</psalm>

0 comments on commit b33e58d

Please sign in to comment.