Skip to content

Commit a7bd8ad

Browse files
author
Daniel Gomes
committed
Rename *Collections to *ImmutableCollections
1 parent 7773356 commit a7bd8ad

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ This way you have the possibility to use them and extend it's behavior tailored
5757
```php
5858
<?php
5959

60-
use DCSG\ImmutableCollections\Collection;
60+
use DCSG\ImmutableCollections\ImmutableCollection;
6161

62-
final class MyStringCollection extends Collection {
63-
// We have to override the `validateItems` in order to ensure the right Type for the Collection.
62+
final class MyStringCollection extends ImmutableCollection {
63+
ImmutableCollection
6464
protected function validateItems(array $elements): void
6565
{
6666
foreach ($elements as $element) {
@@ -80,10 +80,10 @@ echo $collection->count(); // 2
8080
```php
8181
<?php
8282

83-
use DCSG\ImmutableCollections\SetCollection;
83+
use DCSG\ImmutableCollections\SetImmutableCollection;
8484

85-
final class MyStringSetCollection extends SetCollection {
86-
// We have to override the `validateItems` in order to ensure the right Type for the Collection.
85+
final class MyStringSetCollection extends SetImmutableCollection {
86+
ImmutableCollection
8787
protected function validateItems(array $elements): void
8888
{
8989
foreach ($elements as $element) {

examples/CargoLegs/Legs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace Examples\DCSG\ImmutableCollections\CargoLegs;
44

55
use InvalidArgumentException;
6-
use DCSG\ImmutableCollections\Collection;
6+
use DCSG\ImmutableCollections\ImmutableCollection;
77

88
/**
99
* @method Leg first()
1010
* @method Leg last()
1111
* @method Leg head()
1212
* @method Leg[] getIterator(): CollectionIterator
1313
*/
14-
final class Legs extends Collection
14+
final class Legs extends ImmutableCollection
1515
{
1616
public function from(string $location): Legs
1717
{

examples/Invoices/InvoiceItems.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace Examples\DCSG\ImmutableCollections\Invoices;
44

55
use InvalidArgumentException;
6-
use DCSG\ImmutableCollections\Collection;
6+
use DCSG\ImmutableCollections\ImmutableCollection;
77

88
/**
99
* @method InvoiceItem first()
1010
* @method InvoiceItem last()
1111
* @method InvoiceItem head()
1212
* @method InvoiceItem[] getIterator(): CollectionIterator
1313
*/
14-
final class InvoiceItems extends Collection
14+
final class InvoiceItems extends ImmutableCollection
1515
{
1616
public function totalIncludingVAT(): float
1717
{

examples/Invoices/Invoices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace Examples\DCSG\ImmutableCollections\Invoices;
44

55
use InvalidArgumentException;
6-
use DCSG\ImmutableCollections\SetCollection;
6+
use DCSG\ImmutableCollections\SetImmutableCollection;
77

88
/**
99
* @method Invoice first()
1010
* @method Invoice last()
1111
* @method Invoice head()
1212
* @method Invoice[] getIterator(): CollectionIterator
1313
*/
14-
final class Invoices extends SetCollection
14+
final class Invoices extends SetImmutableCollection
1515
{
1616
public function totalExcludingVAT()
1717
{

src/Collection.php renamed to src/ImmutableCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* @author Daniel Gomes <[email protected]>
99
*/
10-
abstract class Collection implements CollectionInterface
10+
abstract class ImmutableCollection implements CollectionInterface
1111
{
1212
/** @var array */
1313
protected $elements;

src/SetCollection.php renamed to src/SetImmutableCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* @author Daniel Gomes <[email protected]>
99
*/
10-
abstract class SetCollection extends Collection
10+
abstract class SetImmutableCollection extends ImmutableCollection
1111
{
1212
protected function __construct(array $elements)
1313
{

tests/CollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Tests\DCSG\ImmutableCollections;
44

55
use InvalidArgumentException;
6-
use DCSG\ImmutableCollections\Collection;
6+
use DCSG\ImmutableCollections\ImmutableCollection;
77
use DCSG\ImmutableCollections\NotFoundException;
88
use PHPUnit\Framework\TestCase;
99

@@ -197,7 +197,7 @@ public function testReduce()
197197

198198
}
199199

200-
final class StringCollection extends Collection
200+
final class StringCollection extends ImmutableCollection
201201
{
202202
protected function validateItems(array $elements): void
203203
{

tests/SetCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Tests\DCSG\ImmutableCollections;
44

55
use InvalidArgumentException;
6-
use DCSG\ImmutableCollections\SetCollection;
6+
use DCSG\ImmutableCollections\SetImmutableCollection;
77
use PHPUnit\Framework\TestCase;
88

99
final class SetCollectionTest extends TestCase
@@ -20,7 +20,7 @@ public function testCreateWithValidElements(): void
2020
}
2121
}
2222

23-
final class StringSetCollection extends SetCollection
23+
final class StringSetCollection extends SetImmutableCollection
2424
{
2525
protected function validateItems(array $elements): void
2626
{

0 commit comments

Comments
 (0)