diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a98a43..f644f3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,24 +1,40 @@ name: tests on: - push: - - create: - tags: - - '*' - + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + create: + tags: + - '*' jobs: - build: - runs-on: ubuntu-latest + testsuite: + name: Unittests + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php-version: ['8.1', '8.2', '8.3'] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 - steps: - - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: json + tools: pecl - - name: Validate composer.json and composer.lock - run: composer validate + - name: Validate composer.json + run: composer validate - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest + - name: Composer install + run: composer install --prefer-dist --no-progress - - name: Run test suite - run: vendor/bin/phpunit + - name: Run PHPUnit + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index 4c31ad4..3da4004 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ Icon Network Trash Folder Temporary Items .apdisk +/.phpunit.cache diff --git a/.idea/api-client.iml b/.idea/api-client.iml index 407a27f..da31970 100644 --- a/.idea/api-client.iml +++ b/.idea/api-client.iml @@ -2,13 +2,11 @@ - - + - @@ -41,7 +39,6 @@ - @@ -72,6 +69,7 @@ + diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml index 520aef8..c9ae647 100644 --- a/.idea/php-test-framework.xml +++ b/.idea/php-test-framework.xml @@ -6,6 +6,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index 7fbfa9e..bc2cccf 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -44,8 +44,6 @@ - - @@ -79,6 +77,7 @@ + diff --git a/CHANGELOG.md b/CHANGELOG.md index b60c344..66dc773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Change Log ========== +2024-02-24 - 4.1.0 +------------------ + + * Update dependencies to Symfony 6.4 + * Add support for Symfony 7 + 2023-01-21 - 4.0.3 ------------------ diff --git a/composer.json b/composer.json index 5976944..41de31c 100644 --- a/composer.json +++ b/composer.json @@ -11,16 +11,16 @@ "pagerfanta/pagerfanta": "^3.5", "somnambulist/attribute-model": "^3.0", "somnambulist/collection": "^5.3", - "symfony/event-dispatcher": "^6.0", - "symfony/http-client": "^6.0", - "symfony/routing": "^6.0" + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/routing": "^6.4|^7.0" }, "require-dev": { - "phpunit/phpunit": "~9.5", + "phpunit/phpunit": "^10.5", "somnambulist/domain": "^5.0", - "symfony/framework-bundle": "^6.0", - "symfony/phpunit-bridge": "^6.0", - "symfony/var-dumper": "^6.0" + "symfony/framework-bundle": "^6.4", + "symfony/phpunit-bridge": "^6.4", + "symfony/var-dumper": "^6.4" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3c54303..06b4e52 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,7 @@ - - - - src/ - - - tests - - + @@ -17,12 +9,17 @@ - - - tests + + + src/ + + + tests + + diff --git a/src/AbstractModel.php b/src/AbstractModel.php index 4ede032..00f382c 100644 --- a/src/AbstractModel.php +++ b/src/AbstractModel.php @@ -2,7 +2,6 @@ namespace Somnambulist\Components\ApiClient; -use IlluminateAgnostic\Str\Support\Str; use LogicException; use Somnambulist\Components\ApiClient\Relationships\AbstractRelationship; use Somnambulist\Components\ApiClient\Relationships\BelongsTo; @@ -11,7 +10,6 @@ use Somnambulist\Components\AttributeModel\AbstractModel as AttributeModel; use Somnambulist\Components\Collection\Contracts\Collection; use Somnambulist\Components\Collection\MutableCollection; - use function array_key_exists; use function is_null; use function method_exists; diff --git a/src/Client/ApiRouter.php b/src/Client/ApiRouter.php index 75d1f28..bcb3925 100755 --- a/src/Client/ApiRouter.php +++ b/src/Client/ApiRouter.php @@ -6,7 +6,6 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; - use function parse_url; class ApiRouter diff --git a/src/Client/Connection/Decoders/SimpleJsonDecoder.php b/src/Client/Connection/Decoders/SimpleJsonDecoder.php index 5d72d58..1533ec9 100644 --- a/src/Client/Connection/Decoders/SimpleJsonDecoder.php +++ b/src/Client/Connection/Decoders/SimpleJsonDecoder.php @@ -4,12 +4,10 @@ use Somnambulist\Components\ApiClient\Client\Contracts\ResponseDecoderInterface; use Symfony\Contracts\HttpClient\ResponseInterface; - use function in_array; use function is_numeric; use function is_string; use function json_decode; - use const JSON_THROW_ON_ERROR; class SimpleJsonDecoder implements ResponseDecoderInterface diff --git a/src/Client/Decorators/AbstractDecorator.php b/src/Client/Decorators/AbstractDecorator.php index de8ea76..9ed5898 100644 --- a/src/Client/Decorators/AbstractDecorator.php +++ b/src/Client/Decorators/AbstractDecorator.php @@ -8,7 +8,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; - use function method_exists; abstract class AbstractDecorator implements ConnectionInterface diff --git a/src/Client/Decorators/LoggingDecorator.php b/src/Client/Decorators/LoggingDecorator.php index 65efe88..40ba9ea 100644 --- a/src/Client/Decorators/LoggingDecorator.php +++ b/src/Client/Decorators/LoggingDecorator.php @@ -6,7 +6,6 @@ use Psr\Log\LogLevel; use Somnambulist\Components\ApiClient\Client\Contracts\ConnectionInterface; use Symfony\Contracts\HttpClient\ResponseInterface; - use function sprintf; use function strtoupper; diff --git a/src/Client/Decorators/RecordResponseDecorator.php b/src/Client/Decorators/RecordResponseDecorator.php index be93676..a5586de 100644 --- a/src/Client/Decorators/RecordResponseDecorator.php +++ b/src/Client/Decorators/RecordResponseDecorator.php @@ -6,7 +6,6 @@ use Somnambulist\Components\ApiClient\Client\RequestTracker; use Somnambulist\Components\ApiClient\Client\ResponseStore; use Symfony\Contracts\HttpClient\ResponseInterface; - use function in_array; /** diff --git a/src/Client/Query/Behaviours/EncodeSimpleFilterConditions.php b/src/Client/Query/Behaviours/EncodeSimpleFilterConditions.php index cb16a97..2fcc115 100644 --- a/src/Client/Query/Behaviours/EncodeSimpleFilterConditions.php +++ b/src/Client/Query/Behaviours/EncodeSimpleFilterConditions.php @@ -5,7 +5,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Exceptions\QueryEncoderException; use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\QueryBuilder; - use function array_filter; use function array_merge; diff --git a/src/Client/Query/Encoders/AbstractEncoder.php b/src/Client/Query/Encoders/AbstractEncoder.php index 2bbcb3f..20e4de2 100644 --- a/src/Client/Query/Encoders/AbstractEncoder.php +++ b/src/Client/Query/Encoders/AbstractEncoder.php @@ -5,7 +5,6 @@ use IlluminateAgnostic\Str\Support\Str; use Somnambulist\Components\ApiClient\Client\Contracts\QueryEncoderInterface; use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; - use function array_map; use function count; use function floor; diff --git a/src/Client/Query/Encoders/CompoundNestedArrayEncoder.php b/src/Client/Query/Encoders/CompoundNestedArrayEncoder.php index d387e45..c2e5dbd 100644 --- a/src/Client/Query/Encoders/CompoundNestedArrayEncoder.php +++ b/src/Client/Query/Encoders/CompoundNestedArrayEncoder.php @@ -5,7 +5,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\Expression; use Somnambulist\Components\ApiClient\Client\Query\QueryBuilder; - use function array_filter; use function http_build_query; use function is_null; diff --git a/src/Client/Query/Encoders/JsonApiEncoder.php b/src/Client/Query/Encoders/JsonApiEncoder.php index 7dc43aa..120f948 100644 --- a/src/Client/Query/Encoders/JsonApiEncoder.php +++ b/src/Client/Query/Encoders/JsonApiEncoder.php @@ -7,7 +7,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\Expression; use Somnambulist\Components\ApiClient\Client\Query\Expression\ExpressionBuilder; - use function array_merge; use function is_null; diff --git a/src/Client/Query/Encoders/NestedArrayEncoder.php b/src/Client/Query/Encoders/NestedArrayEncoder.php index 373fdfa..9c700ae 100644 --- a/src/Client/Query/Encoders/NestedArrayEncoder.php +++ b/src/Client/Query/Encoders/NestedArrayEncoder.php @@ -5,7 +5,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\Expression; use Somnambulist\Components\ApiClient\Client\Query\QueryBuilder; - use function array_filter; use function http_build_query; use function is_null; diff --git a/src/Client/Query/Encoders/OpenStackApiEncoder.php b/src/Client/Query/Encoders/OpenStackApiEncoder.php index e6ebe29..5d547e7 100644 --- a/src/Client/Query/Encoders/OpenStackApiEncoder.php +++ b/src/Client/Query/Encoders/OpenStackApiEncoder.php @@ -6,7 +6,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Exceptions\QueryEncoderException; use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\Expression; - use function array_key_exists; use function array_merge; use function array_merge_recursive; diff --git a/src/Client/Query/Encoders/SimpleEncoder.php b/src/Client/Query/Encoders/SimpleEncoder.php index 1eaca9c..362d735 100644 --- a/src/Client/Query/Encoders/SimpleEncoder.php +++ b/src/Client/Query/Encoders/SimpleEncoder.php @@ -7,7 +7,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\Expression; use Somnambulist\Components\ApiClient\Client\Query\Expression\ExpressionBuilder; - use function array_merge_recursive; use function in_array; use function is_null; diff --git a/src/Client/Query/Expression/CompositeExpression.php b/src/Client/Query/Expression/CompositeExpression.php index 5a6900d..f12bf50 100644 --- a/src/Client/Query/Expression/CompositeExpression.php +++ b/src/Client/Query/Expression/CompositeExpression.php @@ -5,7 +5,6 @@ use ArrayAccess; use Countable; use Somnambulist\Components\ApiClient\Client\Contracts\ExpressionInterface; - use function array_key_exists; use function count; diff --git a/src/Client/Query/Expression/Expression.php b/src/Client/Query/Expression/Expression.php index bc5cb4f..17fe22e 100644 --- a/src/Client/Query/Expression/Expression.php +++ b/src/Client/Query/Expression/Expression.php @@ -3,7 +3,6 @@ namespace Somnambulist\Components\ApiClient\Client\Query\Expression; use Somnambulist\Components\ApiClient\Client\Contracts\ExpressionInterface; - use function implode; use function is_array; use function sprintf; diff --git a/src/Client/Query/QueryBuilder.php b/src/Client/Query/QueryBuilder.php index bd37cb1..e221ea4 100644 --- a/src/Client/Query/QueryBuilder.php +++ b/src/Client/Query/QueryBuilder.php @@ -5,7 +5,6 @@ use Somnambulist\Components\ApiClient\Client\Contracts\ExpressionInterface; use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\Client\Query\Expression\ExpressionBuilder; - use function array_key_exists; use function array_unshift; use function count; diff --git a/src/Client/ResponseStore.php b/src/Client/ResponseStore.php index e43c307..005a66c 100644 --- a/src/Client/ResponseStore.php +++ b/src/Client/ResponseStore.php @@ -5,7 +5,6 @@ use RuntimeException; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Contracts\HttpClient\ResponseInterface; - use function dirname; use function file_exists; use function file_get_contents; @@ -17,7 +16,6 @@ use function sprintf; use function strtoupper; use function substr; - use const JSON_PRETTY_PRINT; use const JSON_THROW_ON_ERROR; diff --git a/src/ConnectionManager.php b/src/ConnectionManager.php index cf0a729..475aee2 100644 --- a/src/ConnectionManager.php +++ b/src/ConnectionManager.php @@ -5,7 +5,6 @@ use Somnambulist\Components\ApiClient\Client\Connection; use Somnambulist\Components\ApiClient\Client\Contracts\ConnectionInterface; use Somnambulist\Components\ApiClient\Exceptions\ConnectionManagerException; - use function array_key_exists; final class ConnectionManager diff --git a/src/Exceptions/ConnectionManagerException.php b/src/Exceptions/ConnectionManagerException.php index 470b776..5af0bd1 100644 --- a/src/Exceptions/ConnectionManagerException.php +++ b/src/Exceptions/ConnectionManagerException.php @@ -3,7 +3,6 @@ namespace Somnambulist\Components\ApiClient\Exceptions; use Exception; - use function sprintf; class ConnectionManagerException extends Exception diff --git a/src/Exceptions/EntityNotFoundException.php b/src/Exceptions/EntityNotFoundException.php index 2c57343..81d0033 100644 --- a/src/Exceptions/EntityNotFoundException.php +++ b/src/Exceptions/EntityNotFoundException.php @@ -3,7 +3,6 @@ namespace Somnambulist\Components\ApiClient\Exceptions; use Exception; - use function sprintf; class EntityNotFoundException extends Exception diff --git a/src/Exceptions/NoResultsException.php b/src/Exceptions/NoResultsException.php index cb028eb..076d82f 100644 --- a/src/Exceptions/NoResultsException.php +++ b/src/Exceptions/NoResultsException.php @@ -4,7 +4,6 @@ use Exception; use Somnambulist\Components\ApiClient\Client\Query\QueryBuilder; - use function sprintf; class NoResultsException extends Exception diff --git a/src/Manager.php b/src/Manager.php index 5ac1b81..70667cd 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -5,7 +5,6 @@ use RuntimeException; use Somnambulist\Components\ApiClient\Client\Contracts\ConnectionInterface; use Somnambulist\Components\AttributeModel\AttributeCaster; - use function get_class; use function sprintf; diff --git a/src/Model.php b/src/Model.php index bfddc71..bdfd121 100644 --- a/src/Model.php +++ b/src/Model.php @@ -8,7 +8,6 @@ use Somnambulist\Components\ApiClient\Client\Contracts\ResponseDecoderInterface; use Somnambulist\Components\ApiClient\Client\Query\Encoders\SimpleEncoder; use Somnambulist\Components\ApiClient\Exceptions\EntityNotFoundException; - use function array_key_exists; /** diff --git a/src/ModelBuilder.php b/src/ModelBuilder.php index bbd701c..4a75d95 100644 --- a/src/ModelBuilder.php +++ b/src/ModelBuilder.php @@ -17,7 +17,6 @@ use Somnambulist\Components\ApiClient\Exceptions\NoResultsException; use Somnambulist\Components\ApiClient\Relationships\AbstractRelationship; use Somnambulist\Components\Collection\Contracts\Collection; - use function array_key_exists; use function array_merge; use function array_unique; diff --git a/src/Persistence/Behaviours/HasObjectData.php b/src/Persistence/Behaviours/HasObjectData.php index bf94822..a2be555 100644 --- a/src/Persistence/Behaviours/HasObjectData.php +++ b/src/Persistence/Behaviours/HasObjectData.php @@ -2,9 +2,6 @@ namespace Somnambulist\Components\ApiClient\Persistence\Behaviours; -use function is_null; -use function trigger_deprecation; - trait HasObjectData { protected ?string $class = null; diff --git a/src/Persistence/Behaviours/MakeDestroyRequest.php b/src/Persistence/Behaviours/MakeDestroyRequest.php index 41474d5..914ef7e 100644 --- a/src/Persistence/Behaviours/MakeDestroyRequest.php +++ b/src/Persistence/Behaviours/MakeDestroyRequest.php @@ -7,7 +7,6 @@ use Somnambulist\Components\ApiClient\Persistence\Contracts\ApiActionInterface; use Somnambulist\Components\ApiClient\Persistence\Exceptions\ActionPersisterException; use Symfony\Component\HttpClient\Exception\ClientException; - use function array_values; use function implode; diff --git a/src/Persistence/Behaviours/MakeRequest.php b/src/Persistence/Behaviours/MakeRequest.php index 6ac3407..47cadfc 100644 --- a/src/Persistence/Behaviours/MakeRequest.php +++ b/src/Persistence/Behaviours/MakeRequest.php @@ -7,7 +7,6 @@ use Somnambulist\Components\ApiClient\Persistence\Contracts\ApiActionInterface; use Somnambulist\Components\ApiClient\Persistence\Exceptions\ActionPersisterException; use Symfony\Component\HttpClient\Exception\ClientException; - use function strtolower; /** diff --git a/src/Persistence/Behaviours/MakeUpdateRequest.php b/src/Persistence/Behaviours/MakeUpdateRequest.php index 9f9462e..9b28a76 100644 --- a/src/Persistence/Behaviours/MakeUpdateRequest.php +++ b/src/Persistence/Behaviours/MakeUpdateRequest.php @@ -7,7 +7,6 @@ use Somnambulist\Components\ApiClient\Persistence\Contracts\ApiActionInterface; use Somnambulist\Components\ApiClient\Persistence\Exceptions\ActionPersisterException; use Symfony\Component\HttpClient\Exception\ClientException; - use function array_values; use function implode; diff --git a/src/Persistence/Exceptions/ActionPersisterException.php b/src/Persistence/Exceptions/ActionPersisterException.php index a014c1b..045dad1 100644 --- a/src/Persistence/Exceptions/ActionPersisterException.php +++ b/src/Persistence/Exceptions/ActionPersisterException.php @@ -8,7 +8,6 @@ use Somnambulist\Components\Collection\MutableCollection; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\ResponseInterface; - use function json_decode; /** diff --git a/src/Relationships/AbstractRelationship.php b/src/Relationships/AbstractRelationship.php index fca50fc..95dc87b 100644 --- a/src/Relationships/AbstractRelationship.php +++ b/src/Relationships/AbstractRelationship.php @@ -8,7 +8,6 @@ use Somnambulist\Components\ApiClient\Client\Query\Expression\CompositeExpression; use Somnambulist\Components\ApiClient\ModelBuilder; use Somnambulist\Components\Collection\Contracts\Collection; - use function sprintf; /** diff --git a/src/Relationships/BelongsTo.php b/src/Relationships/BelongsTo.php index fa25477..1dc372e 100644 --- a/src/Relationships/BelongsTo.php +++ b/src/Relationships/BelongsTo.php @@ -6,7 +6,6 @@ use Somnambulist\Components\ApiClient\Exceptions\ModelRelationshipException; use Somnambulist\Components\ApiClient\Model; use Somnambulist\Components\Collection\Contracts\Collection; - use function get_class; use function is_null; diff --git a/src/Relationships/HasMany.php b/src/Relationships/HasMany.php index f631d6b..4004826 100644 --- a/src/Relationships/HasMany.php +++ b/src/Relationships/HasMany.php @@ -6,7 +6,6 @@ use Somnambulist\Components\ApiClient\Exceptions\ModelRelationshipException; use Somnambulist\Components\ApiClient\Model; use Somnambulist\Components\Collection\Contracts\Collection; - use function get_class; /** diff --git a/src/Relationships/HasOne.php b/src/Relationships/HasOne.php index f5ee99a..4afe86b 100644 --- a/src/Relationships/HasOne.php +++ b/src/Relationships/HasOne.php @@ -6,7 +6,6 @@ use Somnambulist\Components\ApiClient\Exceptions\ModelRelationshipException; use Somnambulist\Components\ApiClient\Model; use Somnambulist\Components\Collection\Contracts\Collection; - use function get_class; use function is_null;