Skip to content

Commit

Permalink
Merge tag '2.1.4' into 2.1.x-merge-up-into-3.0.x_IPBBMKgx
Browse files Browse the repository at this point in the history
2.1.x bugfix release (patch)

- Total issues resolved: **0**
- Total pull requests resolved: **4**
- Total contributors: **3**

 - [380: Improve return type for Collection::partition](#380) thanks to @heiglandreas
 - [379: Make returntypes consistent with implementation](#379) thanks to @heiglandreas

 - [377: Add doctrine-project.json to .gitattributes](#377) thanks to @VincentLanglet

 - [376: Doctrine Coding Standard 12](#376) thanks to @derrabus

* tag '2.1.4':
  Improve return type for Collection::partition (#380)
  Make returntypes consistend with implementation (#379)
  Add doctrine-project.json to .gitattributes (#377)
  Doctrine Coding Standard 12 (#376)
  • Loading branch information
derrabus committed Oct 3, 2023
2 parents bdd8b62 + 72328a1 commit 9a86474
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/tests export-ignore
/.github export-ignore
.doctrine-project.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"require-dev": {
"ext-json": "*",
"doctrine/coding-standard": "^10.0",
"doctrine/coding-standard": "^12",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5",
Expand Down
18 changes: 2 additions & 16 deletions src/AbstractLazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,7 @@ public function findFirst(Closure $p): mixed
return $this->collection->findFirst($p);
}

/**
* @psalm-param Closure(T, TKey):bool $p
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, T>
*/
public function filter(Closure $p): ReadableCollection
public function filter(Closure $p): Collection

Check failure on line 180 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Method \Doctrine\Common\Collections\AbstractLazyCollection::filter() does not have @return annotation for its traversable return value.

Check failure on line 180 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Method \Doctrine\Common\Collections\AbstractLazyCollection::filter() does not have @return annotation for its traversable return value.
{
$this->initialize();

Expand All @@ -197,15 +191,7 @@ public function forAll(Closure $p): bool
return $this->collection->forAll($p);
}

/**
* @psalm-param Closure(T):U $func
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, U>
*
* @psalm-template U
*/
public function map(Closure $func): ReadableCollection
public function map(Closure $func): Collection

Check failure on line 194 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Method \Doctrine\Common\Collections\AbstractLazyCollection::map() does not have @return annotation for its traversable return value.

Check failure on line 194 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.1)

Method \Doctrine\Common\Collections\AbstractLazyCollection::map() does not have @return annotation for its traversable return value.
{
$this->initialize();

Expand Down
31 changes: 31 additions & 0 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Common\Collections;

use ArrayAccess;
use Closure;

/**
* The missing (SPL) Collection/Array/OrderedMap interface.
Expand Down Expand Up @@ -73,4 +74,34 @@ public function removeElement(mixed $element): bool;
* @psalm-param T $value
*/
public function set(string|int $key, mixed $value): void;

/**
* {@inheritDoc}
*
* @psalm-param Closure(T):U $func
*
* @return Collection<mixed>
* @psalm-return Collection<TKey, U>
*
* @psalm-template U
*/
public function map(Closure $func): self;

/**
* {@inheritDoc}
*
* @return Collection<mixed> A collection with the results of the filter operation.
* @psalm-return Collection<TKey, T>
*/
public function filter(Closure $p): self;

/**
* {@inheritDoc}
* @return Collection<mixed>[] An array with two elements. The first element contains the collection
* of elements where the predicate returned TRUE, the second element
* contains the collection of elements where the predicate returned FALSE.
* @psalm-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>}
*/
public function partition(Closure $p): array;
}

0 comments on commit 9a86474

Please sign in to comment.