Skip to content

Commit

Permalink
Add actual php versions to gitlab action matrix (#27)
Browse files Browse the repository at this point in the history
* Add actual php versions to gitlab action matrix

* Downgrade cebe/openapi version: get issue after 1.6 with null nullable.

* drop php 7.4 support

* Change dependencies constraints

* replace cebe/php-openapi with league/openapi-psr7-validator used fork

* Replace neomerx/json-api with laravel-json-api maintained fork, update ramsey/uuid to php 8.1 support version, fix warnings in test

* Allow doctrine usage 3
  • Loading branch information
samizdam committed Nov 23, 2024
1 parent a9ae328 commit 70c9faf
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
strategy:
matrix:
php:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
prefer:
- lowest
- stable
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Best composer dependencies compatibility: allow more versions

## Removed
- php 7.4 support

## [0.0.14] - 2021-02-02
### Added
- Route info in the request attribute
Expand Down
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"require": {
"ext-intl": "*",
"ext-json": "*",
"cebe/php-openapi": "^1.4",
"doctrine/persistence": "^2.0",
"devizzent/cebe-php-openapi": "^1.0",
"doctrine/persistence": "^2.0|^3.0",
"fig/http-message-util": "^1.0",
"free-elephants/i18n": "^0.0.1",
"laminas/laminas-stratigility": "^3.2",
"league/openapi-psr7-validator": "0.14|^0.15|^0.16",
"neomerx/json-api": "^4.0",
"laravel-json-api/neomerx-json-api": "^5.0.2",
"league/openapi-psr7-validator": "0.19 - 0.22",
"nette/php-generator": "^3.4",
"nikic/fast-route": "^1.3",
"psr/cache": "^1|^2|^3",
Expand All @@ -30,16 +30,13 @@
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"rakit/validation": "^1.2",
"ramsey/uuid": "^3.0|^4.0"
"ramsey/uuid": "^3.9.7|^4.0"
},
"require-dev": {
"helmich/phpunit-psr7-assert": "^4",
"nyholm/psr7": "^1.2",
"phpunit/phpunit": "^9.0"
},
"conflict": {
"cebe/php-openapi": "1.5.0 || 1.5.1"
},
"suggest": {
"doctrine/orm": "^2.7",
"free-elephants/di": "*",
Expand Down
9 changes: 2 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
<php>
<ini name="error_reporting" value="E_ALL"/>
</php>
<testsuites>
<testsuite name="8.0">
<directory suffix="TestPHP8.php" phpVersion="8.0">./tests</directory>
<testsuite name="">
<directory>tests/</directory>
</testsuite>
<testsuite name="7.4">
<directory suffix="Test.php" phpVersion="7.4">./tests</directory>
</testsuite>
</testsuites>
<logging/>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(array $data)
$reflectionType = $relationshipsProperty->getType();

// handle php 8 union types
if (class_exists(\ReflectionUnionType::class) && $reflectionType instanceof \ReflectionUnionType) {
if ($reflectionType instanceof \ReflectionUnionType) {
$relationshipsClass = (new SuitableRelationshipsTypeDetector())->detect($reflectionType, $relationshipsData);
} else {
$relationshipsClass = $reflectionType->getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use FreeElephants\JsonApiToolkit\DTO\RelationshipToOne;
use ReflectionProperty;

class SuitableRelationshipsTypeDetectorTestPHP8 extends AbstractTestCase
class SuitableRelationshipsTypeDetectorTest extends AbstractTestCase
{

public function testDetect()
Expand Down
4 changes: 4 additions & 0 deletions tests/FreeElephants/JsonApiToolkit/Psr/ErrorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function testFromThrowable()

$throwable = new Exception('Hello, world!', 100500);
$request = $this->createMock(ServerRequestInterface::class);
// Prevent return null instead string
$request->method('getHeaderLine')->willReturn('');

$errorFactory = new ErrorFactory($translatorRegistry);
$error = $errorFactory->fromThrowable($throwable, 200, $request, ['pointer']);
Expand All @@ -37,6 +39,8 @@ public function testCreateError()
$translatorRegistry->method('getTranslator')->willReturn($translator);

$request = $this->createMock(ServerRequestInterface::class);
// Prevent return null instead string
$request->method('getHeaderLine')->willReturn('');

$errorFactory = new ErrorFactory($translatorRegistry);
$error = $errorFactory->createError('Hello, world!', 200, $request, ['pointer']);
Expand Down

0 comments on commit 70c9faf

Please sign in to comment.