Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
/ type Public archive
generated from spaceonfire/skeleton

Commit

Permalink
Merge pull request #6 from spaceonfire/php8
Browse files Browse the repository at this point in the history
chore: support installation on PHP 8
  • Loading branch information
hustlahusky committed Feb 16, 2021
2 parents 95a2cab + e7a2c58 commit 1a5a4de
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 23 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
29 changes: 25 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- Nothing
-->

## [1.3.1] - 2021-02-16

### Added

- Support installation on PHP 8

## [1.3.0] - 2020-10-17

### Added

- Lot of improvements for `DisjunctionType` and `ConjunctionType`:
- General code moved to `AbstractAggregatedType` class;
- They can be iterated over now;
Expand All @@ -34,31 +42,44 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- General code moved to `AbstractAggregatedTypeFactory` class;
- They can now parse complex type strings, such as: `int|string|array<bool|int>|string|null`.
- `GroupTypeFactory` allows parsing grouped with `()` type strings like: `(string|int)[]`
- `MemoizedTypeFactory` allows cache results of calls to `supports()` and `make()`.
Recommend wrap type factory with memoized decorator in production.
- `MemoizedTypeFactory` allows cache results of calls to `supports()` and `make()`. Recommend wrap type factory with
memoized decorator in production.

### Fixed

- Fixed string representation of collection type with complex value type.

## [1.2.0] - 2020-10-13

### Removed

- `Type` interface doesn't declare static methods `support()` and `create()` no more.

### Added

- Dynamic type factories. It replaces static methods in `Type` classes and static `TypeFactory` class.
- Mixed type.
- Void type.

### Deprecated
- Static methods in classes implementing `Type` interface and static `TypeFactory` class marked as deprecated.
Their API still backward compatible using dynamic type factories. It will be removed in next major release.

- Static methods in classes implementing `Type` interface and static `TypeFactory` class marked as deprecated. Their API
still backward compatible using dynamic type factories. It will be removed in next major release.

## [1.1.0] - 2020-10-04

### Added

- Support non strict mode for all scalar types (int, float, string and bool)
- Force return `null` when casting to null builtin type

## [1.0.1] - 2020-09-26

### Fixed

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

## [1.0.0] - 2020-06-01

- First release
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"webmozart/assert": "^1.3"
},
"require-dev": {
"ext-json": "*",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"phpunit/phpunit": "^8.0",
"phpunit/phpunit": "^8.5|^9.5",
"phpspec/prophecy-phpunit": "^1.1|^2.0",
"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 @@ -39,7 +40,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
1 change: 0 additions & 1 deletion src/TypeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/**
* Class TypeFactory
* @package spaceonfire\Type
* @deprecated use dynamic type factory instead. This class will be removed in next major release.
* @see Factory\TypeFactoryInterface
*/
Expand Down
18 changes: 18 additions & 0 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace spaceonfire\Type;

use PHPUnit\Framework\TestCase;

if (trait_exists('\Prophecy\PhpUnit\ProphecyTrait')) {
abstract class AbstractTestCase extends TestCase
{
use \Prophecy\PhpUnit\ProphecyTrait;
}
} else {
abstract class AbstractTestCase extends TestCase
{
}
}
3 changes: 1 addition & 2 deletions tests/ConjunctionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

use Iterator;
use JsonSerializable;
use PHPUnit\Framework\TestCase;
use Traversable;

class ConjunctionTypeTest extends TestCase
class ConjunctionTypeTest extends AbstractTestCase
{
public function testCheck(): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Factory/MemoizedTypeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace spaceonfire\Type\Factory;

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use spaceonfire\Type\AbstractTestCase;
use spaceonfire\Type\Type;

class MemoizedTypeFactoryTest extends TestCase
class MemoizedTypeFactoryTest extends AbstractTestCase
{
public function testSupports(): void
{
Expand Down

0 comments on commit 1a5a4de

Please sign in to comment.