Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from spaceonfire/php8
Browse files Browse the repository at this point in the history
chore: support install on PHP 8
  • Loading branch information
hustlahusky authored Feb 16, 2021
2 parents 2149fd1 + 6e61a05 commit 1f91afa
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 24 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ jobs:
COMPOSER_CACHE_KEY: 'composer-7.2'
with:
path: vendor
key: ${{ env.COMPOSER_CACHE_KEY }}
key: ${{ env.COMPOSER_CACHE_KEY }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ env.COMPOSER_CACHE_KEY }}

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
run: |
/opt/spaceonfire/bin/select-composer.sh v2
composer install --prefer-dist --no-progress
- name: Check coding standard
run: vendor/bin/ecs check --no-progress-bar --no-interaction
Expand All @@ -58,12 +59,13 @@ jobs:
COMPOSER_CACHE_KEY: 'composer-7.2'
with:
path: vendor
key: ${{ env.COMPOSER_CACHE_KEY }}
key: ${{ env.COMPOSER_CACHE_KEY }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ env.COMPOSER_CACHE_KEY }}

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
run: |
/opt/spaceonfire/bin/select-composer.sh v2
composer install --prefer-dist --no-progress
- name: PHPStan
run: vendor/bin/phpstan analyse --no-progress --no-interaction
Expand All @@ -76,6 +78,7 @@ jobs:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
container: spaceonfire/nginx-php-fpm:latest-${{ matrix.php-version }}
steps:
- name: Checkout
Expand All @@ -88,18 +91,19 @@ jobs:
COMPOSER_CACHE_KEY: 'composer-${{ matrix.php-version }}'
with:
path: vendor
key: ${{ env.COMPOSER_CACHE_KEY }}
key: ${{ env.COMPOSER_CACHE_KEY }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ env.COMPOSER_CACHE_KEY }}

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
run: |
/opt/spaceonfire/bin/select-composer.sh v2
composer install --prefer-dist --no-progress
- name: PHPUnit
run: |
apk update
docker-php-ext-enable xdebug
vendor/bin/phpunit --no-interaction
php -d xdebug.mode=coverage vendor/bin/phpunit --no-interaction
cat build/coverage.txt
- name: PHPUnit Artifacts
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,56 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- Nothing
-->

## [2.1.1] - 2020-02-16

### Added

- Support installation on PHP 8

## [2.1.0] - 2020-10-13

### Added

- Update `spaceonfire/type` library up to `^1.2`. Replace deprecated static `TypeFactory` call in `TypedCollection`.

## [2.0.1] - 2020-09-26

### Fixed

- Development config updates
- Minor type issues fixes found by static analyser

## [2.0.0] - 2020-06-04

### Added

- Make collection interface stricter
- Added abstract decorator
- Added `IndexedCollection` decorator
- `TypedCollection` now acts as decorator

### Deprecated

- `TypedCollection` now final. Extend it with a decorator.

### Removed

- `BaseCollection` has been removed. Use decorators if you need to add new functionality to collections.

## [1.5.0] - 2020-06-01

### Added

- Use `spaceonfire/type` for checking typed collection items type

### Fixed

- Fix division by zero when calling average() on empty collection

## [1.4.0] - 2020-05-31

### Added

- Update `CollectionInterface`:
- update method signatures according to `BaseCollection`
- update phpDoc comments
Expand All @@ -61,10 +80,13 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- Implement FilterableInterface from `spaceonfire/criteria` by collection

### Fixed

- Fixed `ArrayHelper::unflatten()` method.

## [1.3.0] - 2020-03-07

### Added

- New methods added:
- `CollectionInterface::unique()`
- `CollectionInterface::implode()`
Expand All @@ -79,31 +101,43 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- `BaseCollection::join()` alias to `BaseCollection::implode()`

## [1.2.2] - 2020-03-07

### Fixed

- Declare `CollectionInterface::merge` attributes
- Fix example in README.md

## [1.2.1] - 2019-11-09

### Fixed

- Fix `BaseCollection::filter` call with empty callback

## [1.2.0] - 2019-11-08

### Added

- Huge update for `TypedCollection`:
- check type on item add to collection
- add `downgrade` method that returns simple `Collection` instance
- override some methods witch logic requires downgrade, restore original `TypedCollection` when we can
- cover `BaseCollection` and `TypedCollection` with tests

## [1.1.1] - 2019-10-18

### Fixed

- Fix checking class and interface existence in TypedCollection

## [1.1.0] - 2019-10-18

### Added

- Add TypedCollection
- Documentation generated

## [1.0.0] - 2019-10-03

### Added

- Base collection implementation
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"ext-json": "*",
"spaceonfire/criteria": "^1.0",
"spaceonfire/type": "^1.2",
Expand All @@ -27,9 +27,9 @@
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpunit/phpunit": "^8.0",
"phpunit/phpunit": "^8.5|^9.5",
"roave/security-advisories": "dev-master",
"symplify/easy-coding-standard-prefixed": "^8.3"
"symplify/easy-coding-standard-prefixed": "^8.3|^9.1"
},
"autoload": {
"psr-4": {
Expand All @@ -42,7 +42,7 @@
}
},
"scripts": {
"test": "phpunit",
"test": "@php -d xdebug.mode=coverage `which phpunit`",
"codestyle": "ecs check --ansi",
"lint": "phpstan analyze --memory-limit=512M --ansi"
},
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractCollectionDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Traversable;

/**
* Class AbstractCollectionDecorator
* @package spaceonfire\Collection
* Class AbstractCollectionDecorator.
*
* @method string join(string|null $glue = null, $field = null) alias to implode()
* @method int|float avg($field = null) alias to average()
*/
Expand Down
4 changes: 1 addition & 3 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
/**
* `Collection` class allows you to create in-place simple collection object.
*
* @package spaceonfire\Collection
*
* @method string join(string|null $glue = null, $field = null) alias to implode()
* @method int|float avg($field = null) alias to average()
*/
Expand All @@ -30,7 +28,7 @@ final class Collection implements CollectionInterface
protected $items = [];

/**
* BaseCollection constructor.
* Collection constructor.
* @param array|iterable|mixed $items
*/
public function __construct($items = [])
Expand Down
3 changes: 1 addition & 2 deletions src/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
use Traversable;

/**
* Interface CollectionInterface
* @package spaceonfire\Collection
* CollectionInterface.
*
* @method string join(string|null $glue = null, $field = null) alias to implode()
* @method int|float avg($field = null) alias to average()
Expand Down
2 changes: 0 additions & 2 deletions src/TypedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* $dateTime = new TypedCollection($items, \DateTime::class);
* $jsonSerializable = new TypedCollection($items, \JsonSerializable::class);
* ```
*
* @package spaceonfire\Collection
*/
final class TypedCollection extends AbstractCollectionDecorator
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testGetValueObjects()

public function testGetValueNonexistingProperties1()
{
$this->expectNotice();
$this->expectError();
$object = new class {
};
ArrayHelper::getValue($object, 'nonExisting');
Expand Down

0 comments on commit 1f91afa

Please sign in to comment.