Skip to content

Commit

Permalink
Merge pull request #85 from aeviiq/add-github-workflow-and-drop-suppo…
Browse files Browse the repository at this point in the history
…rt-for-php-below-8.1

Add GitHub workflow and drop support for php below 8.1
  • Loading branch information
aeviiq committed Dec 7, 2023
2 parents 972bdc9 + f4b3147 commit abbfdca
Show file tree
Hide file tree
Showing 26 changed files with 104 additions and 44 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
}
},
"require": {
"php": "^7.2 || ^8.0"
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^8.2"
"phpunit/phpunit": "^10.0"
},
"scripts": {
"test": "vendor/bin/phpunit tests"
Expand Down
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" colors="true" failOnRisky="true" failOnWarning="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache">
<coverage/>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
10 changes: 5 additions & 5 deletions src/Collection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down Expand Up @@ -206,8 +208,7 @@ public function exchangeArray(array $elements): void
/**
* {@inheritDoc}
*/
#[\ReturnTypeWillChange]
public function getIterator()
public function getIterator(): Traversable
{
$iteratorClass = $this->iteratorClass;

Expand Down Expand Up @@ -246,8 +247,7 @@ public function offsetExists($offset): bool
/**
* {@inheritDoc}
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->elements[$offset] ?? null;
}
Expand Down
4 changes: 3 additions & 1 deletion src/CollectionInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Exception;

Expand Down
4 changes: 3 additions & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Exception;

Expand Down
4 changes: 3 additions & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Exception;

Expand Down
4 changes: 3 additions & 1 deletion src/Exception/LogicException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Exception;

Expand Down
4 changes: 3 additions & 1 deletion src/FloatCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ImmutableCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ImmutableFloatCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ImmutableIntCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ImmutableObjectCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ImmutableStringCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/IntCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/ObjectCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/SortableInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
4 changes: 3 additions & 1 deletion src/StringCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection;

Expand Down
8 changes: 5 additions & 3 deletions tests/BaseCollectionTest.php → tests/BaseCollection.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

use Aeviiq\Collection\Exception\InvalidArgumentException;

abstract class BaseCollectionTest extends CollectionTest
abstract class BaseCollection extends CollectionTest
{
/**
* @dataProvider invalidDataProvider
Expand Down Expand Up @@ -87,7 +89,7 @@ public function testMergeWithInvalidDataTypes($value): void
/**
* @return mixed[]
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [];
}
Expand Down
4 changes: 3 additions & 1 deletion tests/CollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

Expand Down
8 changes: 5 additions & 3 deletions tests/FloatCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

use Aeviiq\Collection\FloatCollection;

final class FloatCollectionTest extends BaseCollectionTest
final class FloatCollectionTest extends BaseCollection
{
public function testMap(): void
{
Expand All @@ -19,7 +21,7 @@ public function testMap(): void
/**
* {@inheritDoc}
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'string' => ['some random string'],
Expand Down
6 changes: 4 additions & 2 deletions tests/ImmutableCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

Expand Down Expand Up @@ -91,7 +93,7 @@ public function testIterator(): void
/**
* @return mixed[]
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'string' => ['some random string'],
Expand Down
8 changes: 5 additions & 3 deletions tests/ImmutableObjectCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

Expand Down Expand Up @@ -83,7 +85,7 @@ public function testInstanceCreationWithInvalidObjectInstance($value): void
/**
* @return mixed[]
*/
public function invalidObjectInstanceDataProvider(): array
public static function invalidObjectInstanceDataProvider(): array
{
return [
'std_class' => [new \stdClass()],
Expand All @@ -93,7 +95,7 @@ public function invalidObjectInstanceDataProvider(): array
/**
* @return mixed[]
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'int' => [1],
Expand Down
8 changes: 5 additions & 3 deletions tests/IntCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

use Aeviiq\Collection\IntCollection;

final class IntCollectionTest extends BaseCollectionTest
final class IntCollectionTest extends BaseCollection
{
public function testMap(): void
{
Expand All @@ -19,7 +21,7 @@ public function testMap(): void
/**
* {@inheritDoc}
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'string' => ['some random string'],
Expand Down
10 changes: 6 additions & 4 deletions tests/ObjectCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

use Aeviiq\Collection\Exception\InvalidArgumentException;
use Aeviiq\Collection\ObjectCollection;

class ObjectCollectionTest extends BaseCollectionTest
class ObjectCollectionTest extends BaseCollection
{
/**
* @var \IteratorAggregate
Expand Down Expand Up @@ -123,7 +125,7 @@ public function testMergeWithInvalidObjectInstance($value): void
/**
* @return mixed[]
*/
public function invalidObjectInstanceDataProvider(): array
public static function invalidObjectInstanceDataProvider(): array
{
return [
'std_class' => [new \stdClass()],
Expand All @@ -133,7 +135,7 @@ public function invalidObjectInstanceDataProvider(): array
/**
* {@inheritDoc}
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'int' => [1],
Expand Down
8 changes: 5 additions & 3 deletions tests/StringCollectionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Aeviiq\Collection\Tests;

use Aeviiq\Collection\StringCollection;

final class StringCollectionTest extends BaseCollectionTest
final class StringCollectionTest extends BaseCollection
{
public function testMap(): void
{
Expand All @@ -19,7 +21,7 @@ public function testMap(): void
/**
* {@inheritDoc}
*/
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
'int' => [1],
Expand Down

0 comments on commit abbfdca

Please sign in to comment.