From 22fdb19e5cddc2d83e6d834106a207c722b1f4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 31 Oct 2021 22:46:18 +0100 Subject: [PATCH 1/5] Require PHP 8.0 --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/composer-json-lint.yml | 2 +- .github/workflows/mutation-tests.yml | 2 +- .github/workflows/phpunit.yml | 17 ++++++---- .github/workflows/static-analysis.yml | 2 +- composer.json | 2 +- composer.lock | 43 +++++++++++------------- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 67996f94..ea90aca0 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -15,7 +15,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/composer-json-lint.yml b/.github/workflows/composer-json-lint.yml index 8cec1dea..22a41b5c 100644 --- a/.github/workflows/composer-json-lint.yml +++ b/.github/workflows/composer-json-lint.yml @@ -15,7 +15,7 @@ jobs: dependencies: - "highest" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 0aa14c76..8a028a1a 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -15,7 +15,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b8066de3..f4b83a9f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -18,7 +18,7 @@ jobs: - "locked" - "development" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" @@ -73,7 +73,8 @@ jobs: dependencies: - "locked" php-version: - - "8.0" + - "8.1" + - "8.2" operating-system: - "ubuntu-latest" @@ -89,14 +90,16 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2, cs2pr + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Cache dependencies" uses: "actions/cache@v2.1.6" with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + path: ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - name: "Install locked dependencies" if: ${{ matrix.dependencies == 'locked' }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index be096ba5..bf4cdfdb 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -15,7 +15,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" diff --git a/composer.json b/composer.json index 255a77ce..13292e21 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "ext-json": "*", "fig/http-message-util": "^1.1", "psr/http-factory": "^1.0", diff --git a/composer.lock b/composer.lock index 40518f73..a68ab735 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c1688de7f5a7e638051d0ab9f898aef4", + "content-hash": "9d1e2bbec6ad7c0fed0201e5c7689117", "packages": [ { "name": "fig/http-message-util", @@ -1642,37 +1642,34 @@ }, { "name": "ocramius/package-versions", - "version": "1.9.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "94c9d42a466c57f91390cdd49c81313264f49d85" + "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/94c9d42a466c57f91390cdd49c81313264f49d85", - "reference": "94c9d42a466c57f91390cdd49c81313264f49d85", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a7e35c34bc166a5684a1e2f13da7b1d6a821349d", + "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7.4.0" + "composer-runtime-api": "^2.0.0", + "php": "^7.4.7 || ~8.0.0" + }, + "replace": { + "composer/package-versions-deprecated": "*" }, "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "doctrine/coding-standard": "^7.0.2", + "composer/composer": "^2.0.0@dev", + "doctrine/coding-standard": "^8.1.0", "ext-zip": "^1.15.0", - "infection/infection": "^0.15.3", - "phpunit/phpunit": "^9.1.1", - "vimeo/psalm": "^3.9.3" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.99.x-dev" - } + "infection/infection": "dev-master#8d6c4d6b15ec58d3190a78b7774a5d604ec1075a", + "phpunit/phpunit": "~9.3.11", + "vimeo/psalm": "^4.0.1" }, + "type": "library", "autoload": { "psr-4": { "PackageVersions\\": "src/PackageVersions" @@ -1688,10 +1685,10 @@ "email": "ocramius@gmail.com" } ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "description": "Provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/Ocramius/PackageVersions/issues", - "source": "https://github.com/Ocramius/PackageVersions/tree/1.9.0" + "source": "https://github.com/Ocramius/PackageVersions/tree/2.1.0" }, "funding": [ { @@ -1703,7 +1700,7 @@ "type": "tidelift" } ], - "time": "2020-06-22T14:15:44+00:00" + "time": "2020-10-21T13:48:04+00:00" }, { "name": "ondram/ci-detector", @@ -5704,7 +5701,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "ext-json": "*" }, "platform-dev": [], From 06b378c1ac84f032d976f5f594180a6bb7484b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 31 Oct 2021 22:50:35 +0100 Subject: [PATCH 2/5] Upgrade lcobucci/coding-standard to v8.0 Lock file operations: 0 installs, 4 updates, 0 removals - Upgrading doctrine/coding-standard (8.2.1 => 9.0.0) - Upgrading lcobucci/coding-standard (6.0.1 => 8.0.0) - Upgrading phpstan/phpdoc-parser (0.4.9 => 1.2.0) - Upgrading slevomat/coding-standard (6.4.1 => 7.0.16) --- composer.json | 2 +- composer.lock | 104 +++++++++++++----------- src/ContentTypeMiddleware.php | 19 ++--- src/Formatter/ContentOnly.php | 11 +-- src/Formatter/JmsSerializer.php | 11 +-- src/Formatter/Json.php | 9 +- src/Formatter/Plates.php | 14 +--- src/Formatter/StringCast.php | 2 +- src/Formatter/Twig.php | 16 ++-- src/UnformattedResponse.php | 43 +++------- tests/ContentTypeMiddlewareTest.php | 19 ++--- tests/Formatter/JsonTest.php | 11 ++- tests/Formatter/NaiveTemplateEngine.php | 4 +- tests/Formatter/StringCastTest.php | 4 +- tests/Formatter/TwigTest.php | 2 +- tests/PersonDto.php | 7 +- tests/UnformattedResponseTest.php | 12 ++- 17 files changed, 117 insertions(+), 173 deletions(-) diff --git a/composer.json b/composer.json index 13292e21..18d39aa8 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "infection/infection": "^0.21", "jms/serializer": "^3.15", "laminas/laminas-diactoros": "^2.8", - "lcobucci/coding-standard": "^6.0", + "lcobucci/coding-standard": "^8.0", "league/plates": "^3.4", "middlewares/negotiation": "^2.0", "phpstan/extension-installer": "^1.1", diff --git a/composer.lock b/composer.lock index a68ab735..20518396 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9d1e2bbec6ad7c0fed0201e5c7689117", + "content-hash": "83479260e8aadf9eb1c0aae8138cd9d6", "packages": [ { "name": "fig/http-message-util", @@ -494,23 +494,23 @@ }, { "name": "doctrine/coding-standard", - "version": "8.2.1", + "version": "9.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "f595b060799c1a0d76ead16981804eaa0bbcd8d6" + "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/f595b060799c1a0d76ead16981804eaa0bbcd8d6", - "reference": "f595b060799c1a0d76ead16981804eaa0bbcd8d6", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/35a2452c6025cb739c3244b3348bcd1604df07d1", + "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", "php": "^7.1 || ^8.0", - "slevomat/coding-standard": "^6.4.1", - "squizlabs/php_codesniffer": "^3.5.8" + "slevomat/coding-standard": "^7.0.0", + "squizlabs/php_codesniffer": "^3.6.0" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -543,9 +543,9 @@ ], "support": { "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/8.2.1" + "source": "https://github.com/doctrine/coding-standard/tree/9.0.0" }, - "time": "2021-04-03T10:54:55+00:00" + "time": "2021-04-12T15:11:14+00:00" }, { "name": "doctrine/instantiator", @@ -1306,21 +1306,21 @@ }, { "name": "lcobucci/coding-standard", - "version": "6.0.1", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/lcobucci/coding-standard.git", - "reference": "79a4324025f909cb786a21587da75f4c0f40e34b" + "reference": "060bf65affbde2a4da148fb10c20ea1d2e3a2ecd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/coding-standard/zipball/79a4324025f909cb786a21587da75f4c0f40e34b", - "reference": "79a4324025f909cb786a21587da75f4c0f40e34b", + "url": "https://api.github.com/repos/lcobucci/coding-standard/zipball/060bf65affbde2a4da148fb10c20ea1d2e3a2ecd", + "reference": "060bf65affbde2a4da148fb10c20ea1d2e3a2ecd", "shasum": "" }, "require": { - "doctrine/coding-standard": "^8.1", - "php": "^7.4 || ^8.0" + "doctrine/coding-standard": "^9.0", + "php": "^8.0" }, "require-dev": { "roave/security-advisories": "dev-master" @@ -1339,9 +1339,19 @@ "description": "Lcobucci's Coding Standard", "support": { "issues": "https://github.com/lcobucci/coding-standard/issues", - "source": "https://github.com/lcobucci/coding-standard/tree/6.0.1" + "source": "https://github.com/lcobucci/coding-standard/tree/8.0.0" }, - "time": "2020-09-05T21:36:16+00:00" + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2021-10-11T21:46:38+00:00" }, { "name": "league/plates", @@ -2159,37 +2169,33 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "0.4.9", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531" + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/98a088b17966bdf6ee25c8a4b634df313d8aa531", - "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/dbc093d7af60eff5cd575d2ed761b15ed40bd08e", + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "consistence/coding-standard": "^3.5", - "ergebnis/composer-normalize": "^2.0.2", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", + "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.26", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^4.7.2", - "symfony/process": "^4.0" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.4-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -2206,9 +2212,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/master" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.2.0" }, - "time": "2020-08-03T20:32:43+00:00" + "time": "2021-09-16T20:46:02+00:00" }, { "name": "phpstan/phpstan", @@ -4149,37 +4155,37 @@ }, { "name": "slevomat/coding-standard", - "version": "6.4.1", + "version": "7.0.16", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "696dcca217d0c9da2c40d02731526c1e25b65346" + "reference": "14c324b2f2f0072933036c2f3abaeda16a56dcd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/696dcca217d0c9da2c40d02731526c1e25b65346", - "reference": "696dcca217d0c9da2c40d02731526c1e25b65346", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/14c324b2f2f0072933036c2f3abaeda16a56dcd3", + "reference": "14c324b2f2f0072933036c2f3abaeda16a56dcd3", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", "php": "^7.1 || ^8.0", - "phpstan/phpdoc-parser": "0.4.5 - 0.4.9", - "squizlabs/php_codesniffer": "^3.5.6" + "phpstan/phpdoc-parser": "^1.0.0", + "squizlabs/php_codesniffer": "^3.6.1" }, "require-dev": { - "phing/phing": "2.16.3", - "php-parallel-lint/php-parallel-lint": "1.2.0", - "phpstan/phpstan": "0.12.48", - "phpstan/phpstan-deprecation-rules": "0.12.5", - "phpstan/phpstan-phpunit": "0.12.16", - "phpstan/phpstan-strict-rules": "0.12.5", - "phpunit/phpunit": "7.5.20|8.5.5|9.4.0" + "phing/phing": "2.17.0", + "php-parallel-lint/php-parallel-lint": "1.3.1", + "phpstan/phpstan": "0.12.99", + "phpstan/phpstan-deprecation-rules": "0.12.6", + "phpstan/phpstan-phpunit": "0.12.22", + "phpstan/phpstan-strict-rules": "0.12.11", + "phpunit/phpunit": "7.5.20|8.5.5|9.5.10" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -4194,7 +4200,7 @@ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/6.4.1" + "source": "https://github.com/slevomat/coding-standard/tree/7.0.16" }, "funding": [ { @@ -4206,7 +4212,7 @@ "type": "tidelift" } ], - "time": "2020-10-05T12:39:37+00:00" + "time": "2021-10-22T06:56:51+00:00" }, { "name": "squizlabs/php_codesniffer", diff --git a/src/ContentTypeMiddleware.php b/src/ContentTypeMiddleware.php index de9fed19..1e0f1b1c 100644 --- a/src/ContentTypeMiddleware.php +++ b/src/ContentTypeMiddleware.php @@ -16,21 +16,12 @@ final class ContentTypeMiddleware implements MiddlewareInterface { - private MiddlewareInterface $negotiator; - private StreamFactoryInterface $streamFactory; - - /** @var Formatter[] */ - private array $formatters; - /** @param Formatter[] $formatters */ public function __construct( - MiddlewareInterface $negotiator, - array $formatters, - StreamFactoryInterface $streamFactory + private MiddlewareInterface $negotiator, + private array $formatters, + private StreamFactoryInterface $streamFactory, ) { - $this->negotiator = $negotiator; - $this->formatters = $formatters; - $this->streamFactory = $streamFactory; } /** @@ -40,12 +31,12 @@ public function __construct( public static function fromRecommendedSettings( array $formats, array $formatters, - StreamFactoryInterface $streamFactory + StreamFactoryInterface $streamFactory, ): self { return new self( new ContentType($formats), $formatters, - $streamFactory + $streamFactory, ); } diff --git a/src/Formatter/ContentOnly.php b/src/Formatter/ContentOnly.php index fb83bad6..3778e48c 100644 --- a/src/Formatter/ContentOnly.php +++ b/src/Formatter/ContentOnly.php @@ -16,14 +16,11 @@ public function format(UnformattedResponse $response, StreamFactoryInterface $st { return $response->withBody( $streamFactory->createStream( - $this->formatContent($response->getUnformattedContent(), $response->getAttributes()) - ) + $this->formatContent($response->getUnformattedContent(), $response->getAttributes()), + ), ); } - /** - * @param mixed $content - * @param mixed[] $attributes - */ - abstract public function formatContent($content, array $attributes = []): string; + /** @param mixed[] $attributes */ + abstract public function formatContent(mixed $content, array $attributes = []): string; } diff --git a/src/Formatter/JmsSerializer.php b/src/Formatter/JmsSerializer.php index 98df71ba..fb248ea3 100644 --- a/src/Formatter/JmsSerializer.php +++ b/src/Formatter/JmsSerializer.php @@ -11,18 +11,13 @@ final class JmsSerializer extends ContentOnly { - private SerializerInterface $serializer; - private string $format; - - public function __construct(SerializerInterface $serializer, string $format) + public function __construct(private SerializerInterface $serializer, private string $format) { - $this->serializer = $serializer; - $this->format = $format; } /** {@inheritdoc} */ // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { try { return $this->serializer->serialize($content, $this->format); @@ -30,7 +25,7 @@ public function formatContent($content, array $attributes = []): string throw new ContentCouldNotBeFormatted( sprintf('Given content could not be formatted in %s using JMS Serializer', $this->format), $exception->getCode(), - $exception + $exception, ); } } diff --git a/src/Formatter/Json.php b/src/Formatter/Json.php index 5d262174..4ee54929 100644 --- a/src/Formatter/Json.php +++ b/src/Formatter/Json.php @@ -20,16 +20,13 @@ final class Json extends ContentOnly { private const DEFAULT_FLAGS = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES; - private int $flags; - - public function __construct(int $flags = self::DEFAULT_FLAGS) + public function __construct(private int $flags = self::DEFAULT_FLAGS) { - $this->flags = $flags; } /** {@inheritdoc} */ // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { try { return json_encode($content, $this->flags | JSON_THROW_ON_ERROR); @@ -37,7 +34,7 @@ public function formatContent($content, array $attributes = []): string throw new ContentCouldNotBeFormatted( sprintf('An exception was thrown during JSON formatting: %s', $exception->getMessage()), $exception->getCode(), - $exception + $exception, ); } } diff --git a/src/Formatter/Plates.php b/src/Formatter/Plates.php index 408a05b6..d108e5e2 100644 --- a/src/Formatter/Plates.php +++ b/src/Formatter/Plates.php @@ -11,17 +11,12 @@ final class Plates extends ContentOnly { private const DEFAULT_ATTRIBUTE = 'template'; - private Engine $engine; - private string $attributeName; - - public function __construct(Engine $engine, string $attributeName = self::DEFAULT_ATTRIBUTE) + public function __construct(private Engine $engine, private string $attributeName = self::DEFAULT_ATTRIBUTE) { - $this->engine = $engine; - $this->attributeName = $attributeName; } /** {@inheritdoc} */ - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { try { return $this->render($content, $attributes); @@ -29,18 +24,17 @@ public function formatContent($content, array $attributes = []): string throw new ContentCouldNotBeFormatted( 'An error occurred while formatting using plates', $exception->getCode(), - $exception + $exception, ); } } /** - * @param mixed $content * @param mixed[] $attributes * * @throws Throwable */ - private function render($content, array $attributes = []): string + private function render(mixed $content, array $attributes = []): string { $template = $attributes[$this->attributeName] ?? ''; diff --git a/src/Formatter/StringCast.php b/src/Formatter/StringCast.php index 1be88e77..d988d0ae 100644 --- a/src/Formatter/StringCast.php +++ b/src/Formatter/StringCast.php @@ -12,7 +12,7 @@ final class StringCast extends ContentOnly { /** {@inheritdoc} */ // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { if (is_object($content) && ! method_exists($content, '__toString')) { throw new ContentCouldNotBeFormatted('Given data could not be cast to string'); diff --git a/src/Formatter/Twig.php b/src/Formatter/Twig.php index 08bc5b74..a3c18c17 100644 --- a/src/Formatter/Twig.php +++ b/src/Formatter/Twig.php @@ -11,19 +11,14 @@ final class Twig extends ContentOnly { private const DEFAULT_ATTRIBUTE = 'template'; - private Environment $environment; - private string $attributeName; - public function __construct( - Environment $environment, - string $attributeName = self::DEFAULT_ATTRIBUTE + private Environment $environment, + private string $attributeName = self::DEFAULT_ATTRIBUTE, ) { - $this->environment = $environment; - $this->attributeName = $attributeName; } /** {@inheritdoc} */ - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { try { return $this->render($content, $attributes); @@ -31,18 +26,17 @@ public function formatContent($content, array $attributes = []): string throw new ContentCouldNotBeFormatted( 'An error occurred while formatting using twig', $exception->getCode(), - $exception + $exception, ); } } /** - * @param mixed $content * @param mixed[] $attributes * * @throws Throwable */ - private function render($content, array $attributes = []): string + private function render(mixed $content, array $attributes = []): string { $template = $attributes[$this->attributeName] ?? ''; diff --git a/src/UnformattedResponse.php b/src/UnformattedResponse.php index 9d26c6c6..ab6832ae 100644 --- a/src/UnformattedResponse.php +++ b/src/UnformattedResponse.php @@ -8,30 +8,15 @@ final class UnformattedResponse implements ResponseInterface { - private ResponseInterface $decoratedResponse; - - /** @var mixed */ - private $unformattedContent; - - /** @var array */ - private array $attributes; - - /** - * @param mixed $unformattedContent - * @param array $attributes - */ + /** @param array $attributes */ public function __construct( - ResponseInterface $decoratedResponse, - $unformattedContent, - array $attributes = [] + private ResponseInterface $decoratedResponse, + private mixed $unformattedContent, + private array $attributes = [], ) { - $this->decoratedResponse = $decoratedResponse; - $this->unformattedContent = $unformattedContent; - $this->attributes = $attributes; } - /** @return mixed */ - public function getUnformattedContent() + public function getUnformattedContent(): mixed { return $this->unformattedContent; } @@ -47,7 +32,7 @@ public function withProtocolVersion($version) return new self( $this->decoratedResponse->withProtocolVersion($version), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -81,7 +66,7 @@ public function withHeader($name, $value) return new self( $this->decoratedResponse->withHeader($name, $value), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -91,7 +76,7 @@ public function withAddedHeader($name, $value) return new self( $this->decoratedResponse->withAddedHeader($name, $value), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -101,7 +86,7 @@ public function withoutHeader($name) return new self( $this->decoratedResponse->withoutHeader($name), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -116,7 +101,7 @@ public function withBody(StreamInterface $body) return new self( $this->decoratedResponse->withBody($body), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -131,7 +116,7 @@ public function withStatus($code, $reasonPhrase = '') return new self( $this->decoratedResponse->withStatus($code, $reasonPhrase), $this->unformattedContent, - $this->attributes + $this->attributes, ); } @@ -142,15 +127,13 @@ public function getReasonPhrase(): string /** * Returns an instance with the specified attribute - * - * @param mixed $value */ - public function withAttribute(string $name, $value): self + public function withAttribute(string $name, mixed $value): self { return new self( $this->decoratedResponse, $this->unformattedContent, - [$name => $value] + $this->attributes + [$name => $value] + $this->attributes, ); } diff --git a/tests/ContentTypeMiddlewareTest.php b/tests/ContentTypeMiddlewareTest.php index 92b1c7d9..02f280d3 100644 --- a/tests/ContentTypeMiddlewareTest.php +++ b/tests/ContentTypeMiddlewareTest.php @@ -75,7 +75,7 @@ public function processShouldReturnAResponseWithErrorWhenFormatterWasNotFound(): $response = $middleware->process( (new ServerRequest())->withAddedHeader('Accept', 'text/plain'), - $this->createRequestHandler($this->createResponse()) + $this->createRequestHandler($this->createResponse()), ); self::assertInstanceOf(UnformattedResponse::class, $response); @@ -101,7 +101,7 @@ public function processShouldReturnAResponseWithFormattedContent(): void $response = $middleware->process( new ServerRequest(), - $this->createRequestHandler($this->createResponse()) + $this->createRequestHandler($this->createResponse()), ); self::assertInstanceOf(UnformattedResponse::class, $response); @@ -128,7 +128,7 @@ public function processShouldPassAttributesToTheFormatterProperly(): void $response = $middleware->process( (new ServerRequest())->withAddedHeader('Accept', 'text/html'), - $this->createRequestHandler($this->createResponse(['template' => 'person'])) + $this->createRequestHandler($this->createResponse(['template' => 'person'])), ); self::assertInstanceOf(UnformattedResponse::class, $response); @@ -159,7 +159,7 @@ public function processShouldReturnAResponseWithFormattedContentEvenWithoutForci $response = $middleware->process( new ServerRequest(), - $this->createRequestHandler($this->createResponse()) + $this->createRequestHandler($this->createResponse()), ); self::assertInstanceOf(UnformattedResponse::class, $response); @@ -174,7 +174,7 @@ private function createResponse(array $attributes = []): UnformattedResponse return new UnformattedResponse( new Response(), new PersonDto(1, 'Testing'), - $attributes + $attributes, ); } @@ -182,11 +182,8 @@ private function createRequestHandler(ResponseInterface $response): RequestHandl { return new class ($response) implements RequestHandlerInterface { - private ResponseInterface $response; - - public function __construct(ResponseInterface $response) + public function __construct(private ResponseInterface $response) { - $this->response = $response; } // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter @@ -205,7 +202,7 @@ private function createMiddleware(bool $forceCharset = true): ContentTypeMiddlew 'application/json' => new Formatter\Json(), 'text/html' => new NaiveTemplateEngine(), ], - new StreamFactory() + new StreamFactory(), ); } @@ -216,7 +213,7 @@ private function configureCharset(bool $forceCharset = true): array static function (array $config) use ($forceCharset): array { return ['charset' => $forceCharset] + $config; }, - self::SUPPORTED_FORMATS + self::SUPPORTED_FORMATS, ); } } diff --git a/tests/Formatter/JsonTest.php b/tests/Formatter/JsonTest.php index f5568ae6..0e009d0e 100644 --- a/tests/Formatter/JsonTest.php +++ b/tests/Formatter/JsonTest.php @@ -29,7 +29,7 @@ public function constructorShouldAllowTheConfigurationOfEncodingFlags(): void self::assertSame( '["","\'bar\'","\"baz\"","&blong&","\u00e9","http://"]', (new Json(JSON_UNESCAPED_SLASHES)) - ->formatContent(['', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://']) + ->formatContent(['', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://']), ); } @@ -44,7 +44,7 @@ public function constructorShouldUseDefaultFlagsWhenNothingWasSet(): void { self::assertSame( '["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026","\u00e9","http://"]', - $this->formatContent(['', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://']) + $this->formatContent(['', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://']), ); } @@ -59,7 +59,7 @@ public function formatShouldReturnAJsonEncodedValue(): void { self::assertJsonStringEqualsJsonString( '{"id":1,"name":"Test"}', - $this->formatContent(new PersonDto(1, 'Test')) + $this->formatContent(new PersonDto(1, 'Test')), ); } @@ -97,12 +97,11 @@ public function jsonSerialize(): void { throw new RuntimeException('This should be converted'); } - } + }, ); } - /** @param mixed $content */ - private function formatContent($content): string + private function formatContent(mixed $content): string { $formatter = new Json(); diff --git a/tests/Formatter/NaiveTemplateEngine.php b/tests/Formatter/NaiveTemplateEngine.php index 68df7430..e1e9d9f1 100644 --- a/tests/Formatter/NaiveTemplateEngine.php +++ b/tests/Formatter/NaiveTemplateEngine.php @@ -21,7 +21,7 @@ final class NaiveTemplateEngine extends ContentOnly /** * {@inheritdoc} */ - public function formatContent($content, array $attributes = []): string + public function formatContent(mixed $content, array $attributes = []): string { $template = $this->getTemplateContent($attributes); @@ -48,7 +48,7 @@ private function render(string $template, array $data): string static function (string $attribute): string { return '{' . $attribute . '}'; }, - array_keys($data) + array_keys($data), ); return trim(str_replace($variables, $data, $template)); diff --git a/tests/Formatter/StringCastTest.php b/tests/Formatter/StringCastTest.php index e8ab0073..827ff473 100644 --- a/tests/Formatter/StringCastTest.php +++ b/tests/Formatter/StringCastTest.php @@ -15,12 +15,10 @@ final class StringCastTest extends TestCase * @dataProvider validData * * @covers ::formatContent() - * - * @param mixed $content */ public function formatShouldSimplyReturnTheStringRepresentationOfTheContent( string $expected, - $content + mixed $content, ): void { $formatter = new StringCast(); diff --git a/tests/Formatter/TwigTest.php b/tests/Formatter/TwigTest.php index 57622cc3..095680d0 100644 --- a/tests/Formatter/TwigTest.php +++ b/tests/Formatter/TwigTest.php @@ -21,7 +21,7 @@ final class TwigTest extends TestCase public function configureEngine(): void { $this->environment = new Environment( - new FilesystemLoader('templates/twig', dirname(__DIR__, 2) . '/') + new FilesystemLoader('templates/twig', dirname(__DIR__, 2) . '/'), ); } diff --git a/tests/PersonDto.php b/tests/PersonDto.php index d3810d80..fbfac2cf 100644 --- a/tests/PersonDto.php +++ b/tests/PersonDto.php @@ -5,12 +5,7 @@ final class PersonDto { - public int $id; - public string $name; - - public function __construct(int $id, string $name) + public function __construct(public int $id, public string $name) { - $this->id = $id; - $this->name = $name; } } diff --git a/tests/UnformattedResponseTest.php b/tests/UnformattedResponseTest.php index a325b93b..513e0fbf 100644 --- a/tests/UnformattedResponseTest.php +++ b/tests/UnformattedResponseTest.php @@ -55,7 +55,7 @@ public function withAttributeShouldOverrideExistingAttributes(): void $response = new UnformattedResponse( new Response(), new PersonDto(1, 'Testing'), - ['test' => 1] + ['test' => 1], ); self::assertSame(['test' => 2], $response->withAttribute('test', 2)->getAttributes()); @@ -72,7 +72,7 @@ public function getAttributesShouldReturnTheConfiguredAttributes(): void $response = new UnformattedResponse( new Response(), new PersonDto(1, 'Testing'), - ['test' => 1] + ['test' => 1], ); self::assertSame(['test' => 1], $response->getAttributes()); @@ -166,8 +166,7 @@ public function getReasonPhraseShouldReturnTheSameValueAsTheDecoratedObject(): v $this->assertGetterReturn('getReasonPhrase'); } - /** @param mixed ...$arguments */ - private function assertGetterReturn(string $method, ...$arguments): void + private function assertGetterReturn(string $method, mixed ...$arguments): void { $decoratedResponse = new Response(); $response = new UnformattedResponse($decoratedResponse, new PersonDto(1, 'Testing')); @@ -241,8 +240,7 @@ public function withStatusShouldReturnANewInstanceWithTheModifiedDecoratedObject $this->assertSetterReturn('withStatus', 202); } - /** @param mixed ...$arguments */ - private function assertSetterReturn(string $method, ...$arguments): void + private function assertSetterReturn(string $method, mixed ...$arguments): void { $decoratedResponse = new Response(); $dto = new PersonDto(1, 'Testing'); @@ -251,7 +249,7 @@ private function assertSetterReturn(string $method, ...$arguments): void $expected = new UnformattedResponse( $decoratedResponse->$method(...$arguments), $dto, - ['test' => 1] + ['test' => 1], ); self::assertEquals($expected, $response->$method(...$arguments)); From 84945f34ae8c10b556e2c4f1524a7a81f7304c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 31 Oct 2021 22:52:18 +0100 Subject: [PATCH 3/5] Update infection to v0.25 Lock file operations: 0 installs, 7 updates, 1 removal - Removing ocramius/package-versions (2.1.0) - Upgrading composer/xdebug-handler (1.4.6 => 2.0.2) - Upgrading infection/abstract-testframework-adapter (0.3.1 => 0.5.0) - Upgrading infection/infection (0.21.5 => 0.25.3) - Upgrading psr/cache (1.0.1 => 3.0.0) - Upgrading psr/log (1.1.4 => 2.0.0) - Upgrading symfony/console (v5.3.7 => v5.3.10) - Upgrading symfony/string (v5.3.7 => v5.3.10) --- composer.json | 2 +- composer.lock | 191 ++++++++++++++++++-------------------------------- 2 files changed, 71 insertions(+), 122 deletions(-) diff --git a/composer.json b/composer.json index 18d39aa8..678c1d70 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "psr/http-server-middleware": "^1.0" }, "require-dev": { - "infection/infection": "^0.21", + "infection/infection": "^0.25", "jms/serializer": "^3.15", "laminas/laminas-diactoros": "^2.8", "lcobucci/coding-standard": "^8.0", diff --git a/composer.lock b/composer.lock index 20518396..7c3c3388 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "83479260e8aadf9eb1c0aae8138cd9d6", + "content-hash": "f0fbd5467421a17779fce368bd8456bd", "packages": [ { "name": "fig/http-message-util", @@ -288,21 +288,21 @@ "packages-dev": [ { "name": "composer/xdebug-handler", - "version": "1.4.6", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f27e06cd9675801df441b3656569b328e04aa37c" + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f27e06cd9675801df441b3656569b328e04aa37c", - "reference": "f27e06cd9675801df441b3656569b328e04aa37c", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { "phpstan/phpstan": "^0.12.55", @@ -332,7 +332,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.6" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" }, "funding": [ { @@ -348,7 +348,7 @@ "type": "tidelift" } ], - "time": "2021-03-25T17:01:18+00:00" + "time": "2021-07-31T17:03:58+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -698,25 +698,25 @@ }, { "name": "infection/abstract-testframework-adapter", - "version": "0.3.1", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/infection/abstract-testframework-adapter.git", - "reference": "c52539339f28d6b67625ff24496289b3e6d66025" + "reference": "18925e20d15d1a5995bb85c9dc09e8751e1e069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/abstract-testframework-adapter/zipball/c52539339f28d6b67625ff24496289b3e6d66025", - "reference": "c52539339f28d6b67625ff24496289b3e6d66025", + "url": "https://api.github.com/repos/infection/abstract-testframework-adapter/zipball/18925e20d15d1a5995bb85c9dc09e8751e1e069b", + "reference": "18925e20d15d1a5995bb85c9dc09e8751e1e069b", "shasum": "" }, "require": { - "php": "^7.3 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.8", - "friendsofphp/php-cs-fixer": "^2.16", - "phpunit/phpunit": "^9.0" + "friendsofphp/php-cs-fixer": "^2.17", + "phpunit/phpunit": "^9.5" }, "type": "library", "autoload": { @@ -737,9 +737,19 @@ "description": "Abstract Test Framework Adapter for Infection", "support": { "issues": "https://github.com/infection/abstract-testframework-adapter/issues", - "source": "https://github.com/infection/abstract-testframework-adapter/tree/0.3" + "source": "https://github.com/infection/abstract-testframework-adapter/tree/0.5.0" }, - "time": "2020-08-30T13:50:12+00:00" + "funding": [ + { + "url": "https://github.com/infection", + "type": "github" + }, + { + "url": "https://opencollective.com/infection", + "type": "open_collective" + } + ], + "time": "2021-08-17T18:49:12+00:00" }, { "name": "infection/extension-installer", @@ -855,31 +865,31 @@ }, { "name": "infection/infection", - "version": "0.21.5", + "version": "0.25.3", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "cee1ab77f755c9faa8e5b75ba720125037942c80" + "reference": "f7a1af285476eeef7e72cedcfd69fa11fbb61c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/cee1ab77f755c9faa8e5b75ba720125037942c80", - "reference": "cee1ab77f755c9faa8e5b75ba720125037942c80", + "url": "https://api.github.com/repos/infection/infection/zipball/f7a1af285476eeef7e72cedcfd69fa11fbb61c71", + "reference": "f7a1af285476eeef7e72cedcfd69fa11fbb61c71", "shasum": "" }, "require": { - "composer/xdebug-handler": "^1.3.3", + "composer-runtime-api": "^2.0", + "composer/xdebug-handler": "^2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", - "infection/abstract-testframework-adapter": "^0.3.1", + "infection/abstract-testframework-adapter": "^0.5.0", "infection/extension-installer": "^0.1.0", - "infection/include-interceptor": "^0.2.4", - "justinrainbow/json-schema": "^5.2", + "infection/include-interceptor": "^0.2.5", + "justinrainbow/json-schema": "^5.2.10", "nikic/php-parser": "^4.10.3", - "ocramius/package-versions": "^1.2 || ^2.0", "ondram/ci-detector": "^3.3.0", - "php": "^7.4 || ^8.0", + "php": "^7.4.7 || ^8.0", "sanmai/later": "^0.1.1", "sanmai/pipeline": "^5.1", "sebastian/diff": "^3.0.2 || ^4.0", @@ -888,7 +898,7 @@ "symfony/filesystem": "^3.4.29 || ^4.1.19 || ^5.0", "symfony/finder": "^3.4.29 || ^4.1.19 || ^5.0", "symfony/process": "^3.4.29 || ^4.1.19 || ^5.0", - "thecodingmachine/safe": "^1.0", + "thecodingmachine/safe": "^1.1.3", "webmozart/assert": "^1.3", "webmozart/path-util": "^2.3" }, @@ -897,6 +907,7 @@ "symfony/console": "=4.1.5" }, "require-dev": { + "brianium/paratest": "^6.3", "ext-simplexml": "*", "helmich/phpunit-json-assert": "^3.0", "phpspec/prophecy-phpunit": "^2.0", @@ -964,7 +975,7 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.21.5" + "source": "https://github.com/infection/infection/tree/0.25.3" }, "funding": [ { @@ -976,7 +987,7 @@ "type": "open_collective" } ], - "time": "2021-03-31T11:40:44+00:00" + "time": "2021-10-02T13:16:05+00:00" }, { "name": "jms/metadata", @@ -1650,68 +1661,6 @@ }, "time": "2021-09-20T12:20:58+00:00" }, - { - "name": "ocramius/package-versions", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/a7e35c34bc166a5684a1e2f13da7b1d6a821349d", - "reference": "a7e35c34bc166a5684a1e2f13da7b1d6a821349d", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.4.7 || ~8.0.0" - }, - "replace": { - "composer/package-versions-deprecated": "*" - }, - "require-dev": { - "composer/composer": "^2.0.0@dev", - "doctrine/coding-standard": "^8.1.0", - "ext-zip": "^1.15.0", - "infection/infection": "dev-master#8d6c4d6b15ec58d3190a78b7774a5d604ec1075a", - "phpunit/phpunit": "~9.3.11", - "vimeo/psalm": "^4.0.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/Ocramius/PackageVersions/issues", - "source": "https://github.com/Ocramius/PackageVersions/tree/2.1.0" - }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ocramius/package-versions", - "type": "tidelift" - } - ], - "time": "2020-10-21T13:48:04+00:00" - }, { "name": "ondram/ci-detector", "version": "3.5.1", @@ -2858,20 +2807,20 @@ }, { "name": "psr/cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -2891,7 +2840,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -2901,9 +2850,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/container", @@ -2955,30 +2904,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2999,9 +2948,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "sanmai/later", @@ -4272,16 +4221,16 @@ }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", "shasum": "" }, "require": { @@ -4351,7 +4300,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.3.10" }, "funding": [ { @@ -4367,7 +4316,7 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-10-26T09:30:15+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5190,16 +5139,16 @@ }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", "shasum": "" }, "require": { @@ -5253,7 +5202,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v5.3.10" }, "funding": [ { @@ -5269,7 +5218,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-10-27T18:21:46+00:00" }, { "name": "thecodingmachine/safe", From 047d95469dec7d8bd8e651f38c9658710257b89d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 31 Oct 2021 22:53:11 +0100 Subject: [PATCH 4/5] Update other packages Lock file operations: 0 installs, 1 update, 0 removals - Upgrading phpunit/php-code-coverage (9.2.7 => 9.2.8) --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 7c3c3388..9c51456d 100644 --- a/composer.lock +++ b/composer.lock @@ -2386,23 +2386,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cf04e88a2e3c56fc1a65488afd493325b4c1bc3e", + "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -2451,7 +2451,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.8" }, "funding": [ { @@ -2459,7 +2459,7 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2021-10-30T08:01:38+00:00" }, { "name": "phpunit/php-file-iterator", From 92177620dcfd2a3c300736a2065c6b49fe57dcc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 31 Oct 2021 23:01:47 +0100 Subject: [PATCH 5/5] Ensure compatibility with PHP 8.1 --- .github/workflows/phpunit.yml | 4 ++-- tests/Formatter/JsonTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index f4b83a9f..56a0b1e2 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,6 +19,7 @@ jobs: - "development" php-version: - "8.0" + - "8.1" operating-system: - "ubuntu-latest" @@ -64,7 +65,7 @@ jobs: run: "make phpunit" phpunit-rc: - name: "PHPUnit tests on PHP 8" + name: "PHPUnit tests on nightly" runs-on: ${{ matrix.operating-system }} @@ -73,7 +74,6 @@ jobs: dependencies: - "locked" php-version: - - "8.1" - "8.2" operating-system: - "ubuntu-latest" diff --git a/tests/Formatter/JsonTest.php b/tests/Formatter/JsonTest.php index 0e009d0e..c4243185 100644 --- a/tests/Formatter/JsonTest.php +++ b/tests/Formatter/JsonTest.php @@ -93,7 +93,7 @@ public function formatShouldConvertAnyExceptionDuringJsonSerialization(): void $this->formatContent( new class implements JsonSerializable { - public function jsonSerialize(): void + public function jsonSerialize(): mixed { throw new RuntimeException('This should be converted'); }