From ee9ebe6db7f556e96eb6bf551319730b25691e4e Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:08:25 +0400 Subject: [PATCH 1/9] Laravel v9 removed from `composer.json`. --- composer.json | 2 +- packages/core/composer.json | 2 +- packages/documentator/composer.json | 2 +- packages/eloquent/composer.json | 2 +- packages/formatter/composer.json | 2 +- packages/graphql/composer.json | 2 +- packages/migrator/composer.json | 2 +- packages/serializer/composer.json | 2 +- packages/spa/composer.json | 2 +- packages/testing/composer.json | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index e3a3e0b7c..1b5677855 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "doctrine/sql-formatter": "^1.1", "guzzlehttp/psr7": "^1.9.1|^2.4.5", "http-interop/http-factory-guzzle": "^1.0.0", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "league/commonmark": "^2.4", "nuwave/lighthouse": "^6.5.0", "opis/json-schema": "^2.3.0", diff --git a/packages/core/composer.json b/packages/core/composer.json index a589a4d22..68023171d 100644 --- a/packages/core/composer.json +++ b/packages/core/composer.json @@ -20,7 +20,7 @@ "require": { "php": "^8.1|^8.2|^8.3", "ext-mbstring": "*", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "symfony/polyfill-php83": "^1.28" }, "require-dev": { diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index a2f197019..744a044ae 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -21,7 +21,7 @@ "php": "^8.1|^8.2|^8.3", "ext-mbstring": "*", "composer/semver": "^3.2", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "league/commonmark": "^2.4", "phpdocumentor/reflection-docblock": "^5.2", "symfony/filesystem": "^6.3.0", diff --git a/packages/eloquent/composer.json b/packages/eloquent/composer.json index 97d5fd119..d889452e5 100644 --- a/packages/eloquent/composer.json +++ b/packages/eloquent/composer.json @@ -18,7 +18,7 @@ }, "require": { "php": "^8.1|^8.2|^8.3", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "symfony/polyfill-php83": "^1.28" }, diff --git a/packages/formatter/composer.json b/packages/formatter/composer.json index 4a7aea5af..18b594540 100644 --- a/packages/formatter/composer.json +++ b/packages/formatter/composer.json @@ -22,7 +22,7 @@ "ext-bcmath": "*", "ext-intl": "*", "ext-mbstring": "*", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "symfony/polyfill-php83": "^1.28" }, diff --git a/packages/graphql/composer.json b/packages/graphql/composer.json index c966794f2..8e913ae6a 100644 --- a/packages/graphql/composer.json +++ b/packages/graphql/composer.json @@ -21,7 +21,7 @@ "php": "^8.1|^8.2|^8.3", "ext-mbstring": "*", "composer/semver": "^3.2", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "nuwave/lighthouse": "^6.5.0", "lastdragon-ru/lara-asp-core": "self.version", "lastdragon-ru/lara-asp-eloquent": "self.version", diff --git a/packages/migrator/composer.json b/packages/migrator/composer.json index bb68a3d9d..9c2fc17d8 100644 --- a/packages/migrator/composer.json +++ b/packages/migrator/composer.json @@ -23,7 +23,7 @@ "php": "^8.1|^8.2|^8.3", "ext-json": "*", "composer/semver": "^3.2", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "symfony/filesystem": "^6.3.0", "symfony/finder": "^6.3.0", diff --git a/packages/serializer/composer.json b/packages/serializer/composer.json index 3b6870a92..18a886081 100644 --- a/packages/serializer/composer.json +++ b/packages/serializer/composer.json @@ -18,7 +18,7 @@ }, "require": { "php": "^8.1|^8.2|^8.3", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "phpdocumentor/type-resolver": "^1.7", "phpstan/phpdoc-parser": "^1.23", diff --git a/packages/spa/composer.json b/packages/spa/composer.json index 2cb19478f..d7758e31b 100644 --- a/packages/spa/composer.json +++ b/packages/spa/composer.json @@ -21,7 +21,7 @@ "php": "^8.1|^8.2|^8.3", "ext-mbstring": "*", "guzzlehttp/psr7": "^1.9.1|^2.4.5", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "symfony/polyfill-php83": "^1.28" }, diff --git a/packages/testing/composer.json b/packages/testing/composer.json index 779baa7c9..a9ac41b0f 100644 --- a/packages/testing/composer.json +++ b/packages/testing/composer.json @@ -28,7 +28,7 @@ "doctrine/dbal": "^3.1.4", "doctrine/sql-formatter": "^1.1", "http-interop/http-factory-guzzle": "^1.0.0", - "laravel/framework": "^9.21.0|^10.0.0", + "laravel/framework": "^10.0.0", "mockery/mockery": "^1.6.2", "opis/json-schema": "^2.3.0", "psr/http-message": "^1.0.0|^2.0.0", From aa496ed8337784180bd46081ebead76483dac34f Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:09:09 +0400 Subject: [PATCH 2/9] Code comments fix. --- packages/documentator/src/Utils/ArtisanSerializer.php | 2 +- packages/migrator/src/Extenders/SmartMigrator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/documentator/src/Utils/ArtisanSerializer.php b/packages/documentator/src/Utils/ArtisanSerializer.php index 48ef8df20..7e95fef3e 100644 --- a/packages/documentator/src/Utils/ArtisanSerializer.php +++ b/packages/documentator/src/Utils/ArtisanSerializer.php @@ -59,7 +59,7 @@ public function getOptionSignature(InputOption $option): string { } if ($option->isNegatable()) { - // Not yet supported by Laravel :( + // todo(documentator): Not yet supported by Laravel :( Check in v11 } if ($option->isArray()) { diff --git a/packages/migrator/src/Extenders/SmartMigrator.php b/packages/migrator/src/Extenders/SmartMigrator.php index 3e60dea82..c158bd07a 100644 --- a/packages/migrator/src/Extenders/SmartMigrator.php +++ b/packages/migrator/src/Extenders/SmartMigrator.php @@ -9,7 +9,7 @@ use function is_string; -// TODO [laravel] [update] \Illuminate\Database\Migrations\Migrator +// todo(migrator): [laravel] [update] \Illuminate\Database\Migrations\Migrator /** * Extends standard migrator. From 717b66ba4048abb64adcaaa61122337036c4637c Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:23:05 +0400 Subject: [PATCH 3/9] Removed specific to v9 code. --- .../src/Commands/CommandsTest.php | 7 ------ .../docs/Examples/BuilderInfoProvider.php | 2 -- .../src/Extenders/SmartMigratorTest.php | 23 ++----------------- .../Extenders/SmartMigratorTest/9.0+down.txt | 9 -------- .../Extenders/SmartMigratorTest/9.0+up.txt | 11 --------- .../Extenders/SmartMigratorTest/9.21+down.txt | 10 -------- .../Extenders/SmartMigratorTest/9.26+up.txt | 10 -------- .../{9.26+down.txt => down.txt} | 0 .../SmartMigratorTest/{9.21+up.txt => up.txt} | 0 .../serializer/src/Casts/AsSerializable.php | 7 +++--- 10 files changed, 5 insertions(+), 74 deletions(-) delete mode 100644 packages/migrator/src/Extenders/SmartMigratorTest/9.0+down.txt delete mode 100644 packages/migrator/src/Extenders/SmartMigratorTest/9.0+up.txt delete mode 100644 packages/migrator/src/Extenders/SmartMigratorTest/9.21+down.txt delete mode 100644 packages/migrator/src/Extenders/SmartMigratorTest/9.26+up.txt rename packages/migrator/src/Extenders/SmartMigratorTest/{9.26+down.txt => down.txt} (100%) rename packages/migrator/src/Extenders/SmartMigratorTest/{9.21+up.txt => up.txt} (100%) diff --git a/packages/documentator/src/Commands/CommandsTest.php b/packages/documentator/src/Commands/CommandsTest.php index 6c47ae4a7..f43d84c43 100644 --- a/packages/documentator/src/Commands/CommandsTest.php +++ b/packages/documentator/src/Commands/CommandsTest.php @@ -128,13 +128,6 @@ class CommandsTest_CommandB extends Command { */ protected $aliases = ['command-b-alias']; - public function __construct() { - parent::__construct(); - - // @phpstan-ignore-next-line Required for Laravel v9 - $this->setAliases((array) $this->aliases); - } - public function __invoke(): void { throw new Exception('Should not be called.'); } diff --git a/packages/graphql/docs/Examples/BuilderInfoProvider.php b/packages/graphql/docs/Examples/BuilderInfoProvider.php index 221203672..655fe5486 100644 --- a/packages/graphql/docs/Examples/BuilderInfoProvider.php +++ b/packages/graphql/docs/Examples/BuilderInfoProvider.php @@ -21,8 +21,6 @@ public function getBuilderInfo(TypeSource $source): ?BuilderInfo { } public function __invoke(): mixed { - // TODO: Implement __invoke() method. - return null; } } diff --git a/packages/migrator/src/Extenders/SmartMigratorTest.php b/packages/migrator/src/Extenders/SmartMigratorTest.php index d48ac2e6f..16ee30d7a 100644 --- a/packages/migrator/src/Extenders/SmartMigratorTest.php +++ b/packages/migrator/src/Extenders/SmartMigratorTest.php @@ -2,8 +2,6 @@ namespace LastDragon_ru\LaraASP\Migrator\Extenders; -use Composer\InstalledVersions; -use Composer\Semver\VersionParser; use Illuminate\Container\Container; use Illuminate\Database\ConnectionResolverInterface; use Illuminate\Database\Migrations\MigrationRepositoryInterface; @@ -43,25 +41,8 @@ public function testMigrate(): void { ['migration' => '2021_05_09_055655_raw_migration_b'], ['migration' => '2021_05_09_055650_anonymous'], ]; - $expectedUp = '9.0+up.txt'; - $expectedDown = '9.0+down.txt'; - - if (InstalledVersions::satisfies(new VersionParser(), 'laravel/framework', '>=9.26.0')) { - # Since v9.26.0 commands output was slightly changed - # - # https://github.com/laravel/framework/pull/43769 - $expectedUp = '9.26+up.txt'; - $expectedDown = '9.26+down.txt'; - } elseif (InstalledVersions::satisfies(new VersionParser(), 'laravel/framework', '>=9.21.0')) { - # Since v9.21.0 commands output was changed - # - # https://github.com/laravel/framework/releases/tag/v9.21.0 - # https://github.com/laravel/framework/pull/43065 - $expectedUp = '9.21+up.txt'; - $expectedDown = '9.21+down.txt'; - } else { - // empty - } + $expectedUp = 'up.txt'; + $expectedDown = 'down.txt'; // Mocks $repository = Mockery::mock(MigrationRepositoryInterface::class); diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.0+down.txt b/packages/migrator/src/Extenders/SmartMigratorTest/9.0+down.txt deleted file mode 100644 index 2eb9794ca..000000000 --- a/packages/migrator/src/Extenders/SmartMigratorTest/9.0+down.txt +++ /dev/null @@ -1,9 +0,0 @@ -Rolling back: 2021_05_09_055650_raw_migration_a -RawMigrationA: DROP TABLE IF EXISTS `migrator_raw_migration_a`; - -Rolling back: 2021_05_09_055655_raw_data_migration_a -Rolling back: 2021_05_09_055655_raw_migration_b -RawMigrationB: DROP TABLE IF EXISTS `migrator_raw_migration_b`; - -Rolling back: 2021_05_09_055650_anonymous -2021_05_09_055650_anonymous: DROP TABLE IF EXISTS `migrator_anonymous`; diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.0+up.txt b/packages/migrator/src/Extenders/SmartMigratorTest/9.0+up.txt deleted file mode 100644 index c8f400189..000000000 --- a/packages/migrator/src/Extenders/SmartMigratorTest/9.0+up.txt +++ /dev/null @@ -1,11 +0,0 @@ -2021_05_09_055650_anonymous: CREATE TABLE IF NOT EXISTS `migrator_anonymous` ( - `id` INT NOT NULL -); - -RawMigrationA: CREATE TABLE IF NOT EXISTS `migrator_raw_migration_a` ( - `id` INT NOT NULL -); - -RawMigrationB: CREATE TABLE IF NOT EXISTS `migrator_raw_migration_b` ( - `id` INT NOT NULL -); diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.21+down.txt b/packages/migrator/src/Extenders/SmartMigratorTest/9.21+down.txt deleted file mode 100644 index 6239eaa08..000000000 --- a/packages/migrator/src/Extenders/SmartMigratorTest/9.21+down.txt +++ /dev/null @@ -1,10 +0,0 @@ -INFO Rollbacking migrations. - - RawMigrationA ...................................................................................................... - ⇂ DROP TABLE IF EXISTS `migrator_raw_migration_a`; - RawDataMigrationA .................................................................................................. - - RawMigrationB ...................................................................................................... - ⇂ DROP TABLE IF EXISTS `migrator_raw_migration_b`; - 2021_05_09_055650_anonymous ........................................................................................ - ⇂ DROP TABLE IF EXISTS `migrator_anonymous`; diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.26+up.txt b/packages/migrator/src/Extenders/SmartMigratorTest/9.26+up.txt deleted file mode 100644 index fc69e554a..000000000 --- a/packages/migrator/src/Extenders/SmartMigratorTest/9.26+up.txt +++ /dev/null @@ -1,10 +0,0 @@ -INFO Running migrations. - - 2021_05_09_055650_anonymous ........................................................................................ - ⇂ CREATE TABLE IF NOT EXISTS `migrator_anonymous` ( `id` INT NOT NULL ); - RawMigrationA ...................................................................................................... - ⇂ CREATE TABLE IF NOT EXISTS `migrator_raw_migration_a` ( `id` INT NOT NULL ); - RawDataMigrationA .................................................................................................. - - RawMigrationB ...................................................................................................... - ⇂ CREATE TABLE IF NOT EXISTS `migrator_raw_migration_b` ( `id` INT NOT NULL ); diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.26+down.txt b/packages/migrator/src/Extenders/SmartMigratorTest/down.txt similarity index 100% rename from packages/migrator/src/Extenders/SmartMigratorTest/9.26+down.txt rename to packages/migrator/src/Extenders/SmartMigratorTest/down.txt diff --git a/packages/migrator/src/Extenders/SmartMigratorTest/9.21+up.txt b/packages/migrator/src/Extenders/SmartMigratorTest/up.txt similarity index 100% rename from packages/migrator/src/Extenders/SmartMigratorTest/9.21+up.txt rename to packages/migrator/src/Extenders/SmartMigratorTest/up.txt diff --git a/packages/serializer/src/Casts/AsSerializable.php b/packages/serializer/src/Casts/AsSerializable.php index d0cf23131..6ba9dff4c 100644 --- a/packages/serializer/src/Casts/AsSerializable.php +++ b/packages/serializer/src/Casts/AsSerializable.php @@ -4,14 +4,13 @@ use Illuminate\Container\Container; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; +use Illuminate\Database\Eloquent\Model; use LastDragon_ru\LaraASP\Serializer\Contracts\Serializer; use LastDragon_ru\LaraASP\Serializer\Exceptions\FailedToCast; use Override; use function is_string; -// todo(laravel): [update] Update methods signatures after remove v9.x support. - /** * @template TGet of object * @template TSet of object @@ -37,7 +36,7 @@ public function __construct( * @inheritDoc */ #[Override] - public function get(mixed $model, string $key, mixed $value, array $attributes): ?object { + public function get(Model $model, string $key, mixed $value, array $attributes): ?object { if ($value === null || $value instanceof $this->class) { // no action } elseif (is_string($value)) { @@ -58,7 +57,7 @@ public function get(mixed $model, string $key, mixed $value, array $attributes): * @inheritDoc */ #[Override] - public function set(mixed $model, string $key, mixed $value, array $attributes): mixed { + public function set(Model $model, string $key, mixed $value, array $attributes): mixed { if ($value !== null) { $value = Container::getInstance()->make(Serializer::class)->serialize( $value, From 5afb4e64e281b762b3eb61dd75e82c3ee11b9dce Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:34:33 +0400 Subject: [PATCH 4/9] Removed PHPUnit v9 support. --- composer.json | 2 +- packages/core/composer.json | 2 +- packages/documentator/composer.json | 2 +- packages/eloquent/composer.json | 2 +- packages/formatter/composer.json | 2 +- packages/graphql-printer/composer.json | 2 +- packages/graphql/composer.json | 2 +- packages/migrator/composer.json | 2 +- packages/serializer/composer.json | 2 +- packages/spa/composer.json | 2 +- packages/testing/composer.json | 2 +- .../Comparators/DatabaseQueryComparator.php | 16 +++------------- .../Comparators/EloquentModelComparator.php | 16 +++------------- .../Comparators/ScalarStrictComparator.php | 19 +++++++------------ 14 files changed, 24 insertions(+), 49 deletions(-) diff --git a/composer.json b/composer.json index 1b5677855..7bb07444c 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "phpstan/phpstan-mockery": "^1.0.0", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "slevomat/coding-standard": "^8.12.0", "spaze/phpstan-disallowed-calls": "^2.16", "squizlabs/php_codesniffer": "^3.7.1", diff --git a/packages/core/composer.json b/packages/core/composer.json index 68023171d..06b1904ff 100644 --- a/packages/core/composer.json +++ b/packages/core/composer.json @@ -24,7 +24,7 @@ "symfony/polyfill-php83": "^1.28" }, "require-dev": { - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0" }, diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index 744a044ae..4e1a01f66 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -34,7 +34,7 @@ "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0", - "phpunit/phpunit": "^9.5.0|^10.1.0" + "phpunit/phpunit": "^10.1.0" }, "autoload": { "psr-4": { diff --git a/packages/eloquent/composer.json b/packages/eloquent/composer.json index d889452e5..7b6f9cc20 100644 --- a/packages/eloquent/composer.json +++ b/packages/eloquent/composer.json @@ -26,7 +26,7 @@ "ext-pdo_sqlite": "*", "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0", - "phpunit/phpunit": "^9.5.0|^10.1.0" + "phpunit/phpunit": "^10.1.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem" diff --git a/packages/formatter/composer.json b/packages/formatter/composer.json index 18b594540..c0ca71905 100644 --- a/packages/formatter/composer.json +++ b/packages/formatter/composer.json @@ -29,7 +29,7 @@ "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0", - "phpunit/phpunit": "^9.5.0|^10.1.0" + "phpunit/phpunit": "^10.1.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem" diff --git a/packages/graphql-printer/composer.json b/packages/graphql-printer/composer.json index ebd172a8a..622135981 100644 --- a/packages/graphql-printer/composer.json +++ b/packages/graphql-printer/composer.json @@ -24,7 +24,7 @@ }, "require-dev": { "composer/class-map-generator": "^1.0", - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", "mockery/mockery": "^1.6.2" }, diff --git a/packages/graphql/composer.json b/packages/graphql/composer.json index 8e913ae6a..e2fd4ae81 100644 --- a/packages/graphql/composer.json +++ b/packages/graphql/composer.json @@ -33,7 +33,7 @@ "ext-pdo_sqlite": "*", "laravel/scout": "^9.8.0|^10.0.0", "mockery/mockery": "^1.6.2", - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0" }, diff --git a/packages/migrator/composer.json b/packages/migrator/composer.json index 9c2fc17d8..b7f7f8312 100644 --- a/packages/migrator/composer.json +++ b/packages/migrator/composer.json @@ -35,7 +35,7 @@ "lastdragon-ru/lara-asp-testing": "self.version", "mockery/mockery": "^1.6.2", "orchestra/testbench": "^7.0.0|^8.0.0", - "phpunit/phpunit": "^9.5.0|^10.1.0" + "phpunit/phpunit": "^10.1.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem" diff --git a/packages/serializer/composer.json b/packages/serializer/composer.json index 18a886081..9c2eac1a3 100644 --- a/packages/serializer/composer.json +++ b/packages/serializer/composer.json @@ -30,7 +30,7 @@ "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^7.0.0|^8.0.0", - "phpunit/phpunit": "^9.5.0|^10.1.0" + "phpunit/phpunit": "^10.1.0" }, "autoload": { "psr-4": { diff --git a/packages/spa/composer.json b/packages/spa/composer.json index d7758e31b..ba0e2eeea 100644 --- a/packages/spa/composer.json +++ b/packages/spa/composer.json @@ -26,7 +26,7 @@ "symfony/polyfill-php83": "^1.28" }, "require-dev": { - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", "symfony/filesystem": "^6.3.0", "orchestra/testbench": "^7.0.0|^8.0.0" diff --git a/packages/testing/composer.json b/packages/testing/composer.json index a9ac41b0f..ffb8c4dda 100644 --- a/packages/testing/composer.json +++ b/packages/testing/composer.json @@ -40,7 +40,7 @@ }, "require-dev": { "guzzlehttp/psr7": "^1.9.1|^2.4.5", - "phpunit/phpunit": "^9.5.0|^10.1.0", + "phpunit/phpunit": "^10.1.0", "orchestra/testbench": "^7.0.0|^8.0.0" }, "conflict": { diff --git a/packages/testing/src/Comparators/DatabaseQueryComparator.php b/packages/testing/src/Comparators/DatabaseQueryComparator.php index 7e417cc27..24b98e4b8 100644 --- a/packages/testing/src/Comparators/DatabaseQueryComparator.php +++ b/packages/testing/src/Comparators/DatabaseQueryComparator.php @@ -13,9 +13,6 @@ use function array_flip; use function array_unique; use function array_values; -use function assert; -use function is_bool; -use function is_float; use function natsort; use function preg_match_all; use function str_replace; @@ -35,24 +32,17 @@ public function accepts(mixed $expected, mixed $actual): bool { } /** - * @inheritDoc - * * @param array $processed */ #[Override] public function assertEquals( mixed $expected, mixed $actual, - mixed $delta = 0.0, - mixed $canonicalize = false, - mixed $ignoreCase = false, + float $delta = 0.0, + bool $canonicalize = false, + bool $ignoreCase = false, array &$processed = [], ): void { - // todo(testing): Update method signature after PHPUnit v9.5 removal. - assert(is_float($delta)); - assert(is_bool($canonicalize)); - assert(is_bool($ignoreCase)); - // If classes different we just call parent to fail if (!($actual instanceof Query) || !($expected instanceof Query) || $actual::class !== $expected::class) { parent::assertEquals($expected, $actual, $delta, $canonicalize, $ignoreCase, $processed); diff --git a/packages/testing/src/Comparators/EloquentModelComparator.php b/packages/testing/src/Comparators/EloquentModelComparator.php index 4164f33b2..4ad026150 100644 --- a/packages/testing/src/Comparators/EloquentModelComparator.php +++ b/packages/testing/src/Comparators/EloquentModelComparator.php @@ -7,9 +7,6 @@ use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\ObjectComparator; -use function assert; -use function is_bool; -use function is_float; use function substr_replace; /** @@ -31,24 +28,17 @@ public function accepts(mixed $expected, mixed $actual): bool { } /** - * @inheritDoc - * * @param array $processed */ #[Override] public function assertEquals( mixed $expected, mixed $actual, - mixed $delta = 0.0, - mixed $canonicalize = false, - mixed $ignoreCase = false, + float $delta = 0.0, + bool $canonicalize = false, + bool $ignoreCase = false, array &$processed = [], ): void { - // todo(testing): Update method signature after PHPUnit v9.5 removal. - assert(is_float($delta)); - assert(is_bool($canonicalize)); - assert(is_bool($ignoreCase)); - // If classes different we just call parent to fail if (!($actual instanceof Model) || !($expected instanceof Model) || $actual::class !== $expected::class) { parent::assertEquals($expected, $actual, $delta, $canonicalize, $ignoreCase, $processed); diff --git a/packages/testing/src/Comparators/ScalarStrictComparator.php b/packages/testing/src/Comparators/ScalarStrictComparator.php index 8e25cf8dd..34f7abe79 100644 --- a/packages/testing/src/Comparators/ScalarStrictComparator.php +++ b/packages/testing/src/Comparators/ScalarStrictComparator.php @@ -7,24 +7,19 @@ use SebastianBergmann\Comparator\ScalarComparator; use SebastianBergmann\Exporter\Exporter; -use function assert; -use function is_bool; -use function is_float; - class ScalarStrictComparator extends ScalarComparator { + /** + * @param array $processed + */ #[Override] public function assertEquals( mixed $expected, mixed $actual, - mixed $delta = 0.0, - mixed $canonicalize = false, - mixed $ignoreCase = false, + float $delta = 0.0, + bool $canonicalize = false, + bool $ignoreCase = false, + array &$processed = [], ): void { - // todo(testing): Update method signature after PHPUnit v9.5 removal. - assert(is_float($delta)); - assert(is_bool($canonicalize)); - assert(is_bool($ignoreCase)); - // Same? if ($expected === $actual) { return; From da324e46681eebb4d7dab2175bfff0cf5fb7a7fa Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:37:57 +0400 Subject: [PATCH 5/9] Removed "orchestra/testbench" v7 support. --- composer.json | 2 +- packages/core/composer.json | 2 +- packages/documentator/composer.json | 2 +- packages/eloquent/composer.json | 2 +- packages/formatter/composer.json | 2 +- packages/graphql/composer.json | 2 +- packages/migrator/composer.json | 2 +- packages/serializer/composer.json | 2 +- packages/spa/composer.json | 2 +- packages/testing/composer.json | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 7bb07444c..0a84a778e 100644 --- a/composer.json +++ b/composer.json @@ -74,7 +74,7 @@ "mockery/mockery": "^1.6.2", "nikic/php-parser": "^4.15", "larastan/larastan": "2.7.0", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpstan/phpstan": "1.10.50", "phpstan/phpstan-mockery": "^1.0.0", "phpstan/phpstan-phpunit": "^1.0.0", diff --git a/packages/core/composer.json b/packages/core/composer.json index 06b1904ff..eb335ab00 100644 --- a/packages/core/composer.json +++ b/packages/core/composer.json @@ -26,7 +26,7 @@ "require-dev": { "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0" + "orchestra/testbench": "^8.0.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem" diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index 4e1a01f66..1e260b13b 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -33,7 +33,7 @@ }, "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpunit/phpunit": "^10.1.0" }, "autoload": { diff --git a/packages/eloquent/composer.json b/packages/eloquent/composer.json index 7b6f9cc20..ce6022b82 100644 --- a/packages/eloquent/composer.json +++ b/packages/eloquent/composer.json @@ -25,7 +25,7 @@ "require-dev": { "ext-pdo_sqlite": "*", "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpunit/phpunit": "^10.1.0" }, "suggest": { diff --git a/packages/formatter/composer.json b/packages/formatter/composer.json index c0ca71905..908dfcc6a 100644 --- a/packages/formatter/composer.json +++ b/packages/formatter/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpunit/phpunit": "^10.1.0" }, "suggest": { diff --git a/packages/graphql/composer.json b/packages/graphql/composer.json index e2fd4ae81..607a1585c 100644 --- a/packages/graphql/composer.json +++ b/packages/graphql/composer.json @@ -35,7 +35,7 @@ "mockery/mockery": "^1.6.2", "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0" + "orchestra/testbench": "^8.0.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem", diff --git a/packages/migrator/composer.json b/packages/migrator/composer.json index b7f7f8312..1c32dad89 100644 --- a/packages/migrator/composer.json +++ b/packages/migrator/composer.json @@ -34,7 +34,7 @@ "ext-pdo_sqlite": "*", "lastdragon-ru/lara-asp-testing": "self.version", "mockery/mockery": "^1.6.2", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpunit/phpunit": "^10.1.0" }, "suggest": { diff --git a/packages/serializer/composer.json b/packages/serializer/composer.json index 9c2eac1a3..a33c61e70 100644 --- a/packages/serializer/composer.json +++ b/packages/serializer/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", - "orchestra/testbench": "^7.0.0|^8.0.0", + "orchestra/testbench": "^8.0.0", "phpunit/phpunit": "^10.1.0" }, "autoload": { diff --git a/packages/spa/composer.json b/packages/spa/composer.json index ba0e2eeea..e7406de79 100644 --- a/packages/spa/composer.json +++ b/packages/spa/composer.json @@ -29,7 +29,7 @@ "phpunit/phpunit": "^10.1.0", "lastdragon-ru/lara-asp-testing": "self.version", "symfony/filesystem": "^6.3.0", - "orchestra/testbench": "^7.0.0|^8.0.0" + "orchestra/testbench": "^8.0.0" }, "suggest": { "ext-fileinfo": "Required for league/flysystem" diff --git a/packages/testing/composer.json b/packages/testing/composer.json index ffb8c4dda..221663699 100644 --- a/packages/testing/composer.json +++ b/packages/testing/composer.json @@ -41,7 +41,7 @@ "require-dev": { "guzzlehttp/psr7": "^1.9.1|^2.4.5", "phpunit/phpunit": "^10.1.0", - "orchestra/testbench": "^7.0.0|^8.0.0" + "orchestra/testbench": "^8.0.0" }, "conflict": { "phpunit/phpunit": "<9.0" From 6e2939751876584610c1a29a1165c064376f6bb6 Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:41:19 +0400 Subject: [PATCH 6/9] Docs rebuild. --- README.md | 2 +- metadata.json | 3 +-- packages/core/README.md | 2 +- packages/core/metadata.json | 3 +-- packages/documentator/README.md | 2 +- packages/documentator/metadata.json | 3 +-- packages/eloquent/README.md | 2 +- packages/eloquent/metadata.json | 3 +-- packages/formatter/README.md | 2 +- packages/formatter/metadata.json | 3 +-- packages/graphql/README.md | 4 +--- packages/graphql/metadata.json | 3 +-- packages/migrator/README.md | 2 +- packages/migrator/metadata.json | 3 +-- packages/serializer/README.md | 2 +- packages/serializer/metadata.json | 3 +-- packages/spa/README.md | 2 +- packages/spa/metadata.json | 3 +-- packages/testing/README.md | 2 +- packages/testing/metadata.json | 3 +-- 20 files changed, 20 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 3a8353240..de02936ae 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The set provides best practices to make development more fun and classes/service | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | diff --git a/metadata.json b/metadata.json index b85794e1b..ec4eed43b 100644 --- a/metadata.json +++ b/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/core/README.md b/packages/core/README.md index 7bd69d4d7..e6545e89c 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -18,7 +18,7 @@ This package contains useful utilities and classes. | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.4.0` | diff --git a/packages/core/metadata.json b/packages/core/metadata.json index badf09c44..a76b46c3d 100644 --- a/packages/core/metadata.json +++ b/packages/core/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/documentator/README.md b/packages/documentator/README.md index cac200d09..19903382f 100644 --- a/packages/documentator/README.md +++ b/packages/documentator/README.md @@ -14,7 +14,7 @@ This package provides various utilities for documentation generation. | | `^8.2` | `HEAD ⋯ 5.0.0-beta.1` | | | `^8.1` | `HEAD ⋯ 5.0.0-beta.1` | | Laravel | `^10.0.0` | `HEAD ⋯ 5.0.0-beta.1` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | [//]: # (end: 876a9177c0e8e3722ac84e8f3888245fc9070a64a87dedfe7c9d9ba2a13b374b) diff --git a/packages/documentator/metadata.json b/packages/documentator/metadata.json index 3c1ff5126..120a1e4d1 100644 --- a/packages/documentator/metadata.json +++ b/packages/documentator/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/eloquent/README.md b/packages/eloquent/README.md index ee6a87a3d..c93d4e85e 100644 --- a/packages/eloquent/README.md +++ b/packages/eloquent/README.md @@ -18,7 +18,7 @@ This package contains useful extensions and mixins for [Eloquent](https://larave | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | diff --git a/packages/eloquent/metadata.json b/packages/eloquent/metadata.json index b85794e1b..ec4eed43b 100644 --- a/packages/eloquent/metadata.json +++ b/packages/eloquent/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/formatter/README.md b/packages/formatter/README.md index 0a1b01c2e..4f2bd00a4 100644 --- a/packages/formatter/README.md +++ b/packages/formatter/README.md @@ -18,7 +18,7 @@ This package provides a customizable wrapper around [Intl](https://www.php.net/m | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | diff --git a/packages/formatter/metadata.json b/packages/formatter/metadata.json index b85794e1b..ec4eed43b 100644 --- a/packages/formatter/metadata.json +++ b/packages/formatter/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/graphql/README.md b/packages/graphql/README.md index f81b783f9..550e4e955 100644 --- a/packages/graphql/README.md +++ b/packages/graphql/README.md @@ -17,7 +17,7 @@ This package provides highly powerful `@searchBy` and `@sortBy` directives for | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.5.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.5.0` | | Lighthouse | `^6.5.0` | `HEAD ⋯ 5.0.0-beta.0` | @@ -173,8 +173,6 @@ class CustomDirective implements Directive, BuilderInfoProvider { } public function __invoke(): mixed { - // TODO: Implement __invoke() method. - return null; } } diff --git a/packages/graphql/metadata.json b/packages/graphql/metadata.json index da1d05c15..01bc98ccc 100644 --- a/packages/graphql/metadata.json +++ b/packages/graphql/metadata.json @@ -8,8 +8,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "nuwave/lighthouse": [ "^6.5.0" diff --git a/packages/migrator/README.md b/packages/migrator/README.md index b09a361bf..b6834ddd4 100644 --- a/packages/migrator/README.md +++ b/packages/migrator/README.md @@ -21,7 +21,7 @@ This package improves standard laravel migrations to add support for raw SQL fil | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | diff --git a/packages/migrator/metadata.json b/packages/migrator/metadata.json index b85794e1b..ec4eed43b 100644 --- a/packages/migrator/metadata.json +++ b/packages/migrator/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/serializer/README.md b/packages/serializer/README.md index 372c5e978..7d22de9a5 100644 --- a/packages/serializer/README.md +++ b/packages/serializer/README.md @@ -14,7 +14,7 @@ This package provides a customizable wrapper around the [Symfony Serializer Comp | | `^8.2` | `HEAD ⋯ 5.0.0-beta.0` | | | `^8.1` | `HEAD ⋯ 5.0.0-beta.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 5.0.0-beta.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0` | [//]: # (end: 876a9177c0e8e3722ac84e8f3888245fc9070a64a87dedfe7c9d9ba2a13b374b) diff --git a/packages/serializer/metadata.json b/packages/serializer/metadata.json index 811471386..f43e87640 100644 --- a/packages/serializer/metadata.json +++ b/packages/serializer/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/spa/README.md b/packages/spa/README.md index f3862e2d2..cf5e3a01b 100644 --- a/packages/spa/README.md +++ b/packages/spa/README.md @@ -15,7 +15,7 @@ | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.4.0` | diff --git a/packages/spa/metadata.json b/packages/spa/metadata.json index c7f56a558..8ffe1fbd3 100644 --- a/packages/spa/metadata.json +++ b/packages/spa/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", diff --git a/packages/testing/README.md b/packages/testing/README.md index 8a016a11a..f9d3bd509 100644 --- a/packages/testing/README.md +++ b/packages/testing/README.md @@ -18,7 +18,7 @@ This package provides various useful asserts for [PHPUnit](https://phpunit.de/) | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | | | `>=7.4.0` | `0.3.0 ⋯ 0.1.0` | | Laravel | `^10.0.0` | `HEAD ⋯ 2.1.0` | -| | `^9.21.0` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^9.21.0` | `5.4.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | diff --git a/packages/testing/metadata.json b/packages/testing/metadata.json index b85794e1b..ec4eed43b 100644 --- a/packages/testing/metadata.json +++ b/packages/testing/metadata.json @@ -4,8 +4,7 @@ "requirements": { "HEAD": { "laravel/framework": [ - "^10.0.0", - "^9.21.0" + "^10.0.0" ], "php": [ "^8.3", From 2f110804009d9471b4d7938bf45024e7d83e95fb Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 13:51:08 +0400 Subject: [PATCH 7/9] `LastDragon_ru\LaraASP\Documentator\Utils\Process` helper replaced by `Illuminate\Support\Facades\Process`. --- .../Instructions/IncludeExample.php | 15 +-- .../Instructions/IncludeExampleTest.php | 96 ++++++++++--------- .../Preprocessor/Instructions/IncludeExec.php | 9 +- .../Instructions/IncludeExecTest.php | 21 ++-- packages/documentator/src/Utils/Git.php | 26 +++-- packages/documentator/src/Utils/Process.php | 32 ------- 6 files changed, 90 insertions(+), 109 deletions(-) delete mode 100644 packages/documentator/src/Utils/Process.php diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExample.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExample.php index 693fb0f06..f4322b7da 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExample.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExample.php @@ -3,11 +3,11 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions; use Exception; +use Illuminate\Support\Facades\Process; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\ProcessableInstruction; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetExecFailed; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetIsNotFile; use LastDragon_ru\LaraASP\Documentator\Utils\Path; -use LastDragon_ru\LaraASP\Documentator\Utils\Process; use Override; use function dirname; @@ -26,9 +26,7 @@ class IncludeExample implements ProcessableInstruction { public const Limit = 50; protected const MarkdownRegexp = '/^\<(?Pmarkdown)\>(?P.*?)\<\/(?P=tag)\>$/msu'; - public function __construct( - protected readonly Process $process, - ) { + public function __construct() { // empty } @@ -78,7 +76,7 @@ public function process(string $path, string $target): string { if ($command) { // Call try { - $output = $this->process->run($command, dirname($path)); + $output = Process::path(dirname($path))->run($command)->throw()->output(); $output = trim($output); } catch (Exception $exception) { throw new TargetExecFailed($path, $target, $exception); @@ -144,16 +142,13 @@ protected function getLanguage(string $path, string $target): string { return pathinfo($target, PATHINFO_EXTENSION); } - /** - * @return list - */ - protected function getCommand(string $path, string $target): ?array { + protected function getCommand(string $path, string $target): ?string { $info = pathinfo($target); $file = isset($info['dirname']) ? Path::join($info['dirname'], "{$info['filename']}.run") : "{$info['filename']}.run"; $command = Path::getPath(dirname($path), $file); - $command = is_file($command) ? [$command] : null; + $command = is_file($command) ? $command : null; return $command; } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php index 58c98c64b..ad28a8008 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php @@ -3,9 +3,9 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions; use Illuminate\Container\Container; +use Illuminate\Process\PendingProcess; +use Illuminate\Support\Facades\Process; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; -use LastDragon_ru\LaraASP\Documentator\Utils\Process; -use Mockery; use PHPUnit\Framework\Attributes\CoversClass; use function basename; @@ -23,14 +23,10 @@ public function testProcessNoRun(): void { $path = self::getTestData()->path('~example.md'); $file = basename(self::getTestData()->path('~example.md')); $expected = trim(self::getTestData()->content('~example.md')); - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->never(); + $instance = Container::getInstance()->make(IncludeExample::class); - $instance = Container::getInstance()->make(IncludeExample::class, [ - 'process' => $process, - ]); + Process::preventStrayProcesses(); + Process::fake(); self::assertEquals( <<process($path, $file), ); + + Process::assertNothingRan(); } public function testProcess(): void { $path = self::getTestData()->path('~runnable.md'); $file = basename(self::getTestData()->path('~runnable.md')); + $command = self::getTestData()->path('~runnable.run'); $expected = trim(self::getTestData()->content('~runnable.md')); $output = 'command output'; - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->with([self::getTestData()->path('~runnable.run')], dirname($path)) - ->once() - ->andReturn($output); - - $instance = Container::getInstance()->make(IncludeExample::class, [ - 'process' => $process, + $instance = Container::getInstance()->make(IncludeExample::class); + + Process::preventStrayProcesses(); + Process::fake([ + $command => Process::result($output), ]); self::assertEquals( @@ -72,22 +67,24 @@ public function testProcess(): void { EXPECTED, $instance->process($path, $file), ); + + Process::assertRan(static function (PendingProcess $process) use ($path, $command): bool { + return $process->path === dirname($path) + && $process->command === $command; + }); } public function testProcessLongOutput(): void { $path = self::getTestData()->path('~runnable.md'); $file = self::getTestData()->path('~runnable.md'); + $command = self::getTestData()->path('~runnable.run'); $expected = trim(self::getTestData()->content('~runnable.md')); $output = implode("\n", range(0, IncludeExample::Limit + 1)); - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->with([self::getTestData()->path('~runnable.run')], dirname($path)) - ->once() - ->andReturn($output); - - $instance = Container::getInstance()->make(IncludeExample::class, [ - 'process' => $process, + $instance = Container::getInstance()->make(IncludeExample::class); + + Process::preventStrayProcesses(); + Process::fake([ + $command => Process::result($output), ]); self::assertEquals( @@ -106,22 +103,24 @@ public function testProcessLongOutput(): void { EXPECTED, $instance->process($path, $file), ); + + Process::assertRan(static function (PendingProcess $process) use ($path, $command): bool { + return $process->path === dirname($path) + && $process->command === $command; + }); } public function testProcessMarkdown(): void { $path = self::getTestData()->path('~runnable.md'); $file = basename(self::getTestData()->path('~runnable.md')); + $command = self::getTestData()->path('~runnable.run'); $expected = trim(self::getTestData()->content('~runnable.md')); $output = 'command output'; - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->with([self::getTestData()->path('~runnable.run')], dirname($path)) - ->once() - ->andReturn("{$output}"); - - $instance = Container::getInstance()->make(IncludeExample::class, [ - 'process' => $process, + $instance = Container::getInstance()->make(IncludeExample::class); + + Process::preventStrayProcesses(); + Process::fake([ + $command => Process::result("{$output}"), ]); self::assertEquals( @@ -134,22 +133,24 @@ public function testProcessMarkdown(): void { EXPECTED, $instance->process($path, $file), ); + + Process::assertRan(static function (PendingProcess $process) use ($path, $command): bool { + return $process->path === dirname($path) + && $process->command === $command; + }); } public function testProcessMarkdownLongOutput(): void { $path = self::getTestData()->path('~runnable.md'); $file = self::getTestData()->path('~runnable.md'); + $command = self::getTestData()->path('~runnable.run'); $expected = trim(self::getTestData()->content('~runnable.md')); $output = implode("\n", range(0, IncludeExample::Limit + 1)); - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->with([self::getTestData()->path('~runnable.run')], dirname($path)) - ->once() - ->andReturn("{$output}"); - - $instance = Container::getInstance()->make(IncludeExample::class, [ - 'process' => $process, + $instance = Container::getInstance()->make(IncludeExample::class); + + Process::preventStrayProcesses(); + Process::fake([ + $command => Process::result("{$output}"), ]); self::assertEquals( @@ -166,5 +167,10 @@ public function testProcessMarkdownLongOutput(): void { EXPECTED, $instance->process($path, $file), ); + + Process::assertRan(static function (PendingProcess $process) use ($path, $command): bool { + return $process->path === dirname($path) + && $process->command === $command; + }); } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExec.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExec.php index 6d22bda33..471b33b09 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExec.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExec.php @@ -3,17 +3,16 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions; use Exception; +use Illuminate\Support\Facades\Process; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\ProcessableInstruction; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetExecFailed; -use LastDragon_ru\LaraASP\Documentator\Utils\Process; use Override; use function dirname; +use function trim; class IncludeExec implements ProcessableInstruction { - public function __construct( - protected readonly Process $process, - ) { + public function __construct() { // empty } @@ -35,7 +34,7 @@ public static function getTargetDescription(): ?string { #[Override] public function process(string $path, string $target): string { try { - return $this->process->run($target, dirname($path)); + return trim(Process::path(dirname($path))->run($target)->throw()->output()); } catch (Exception $exception) { throw new TargetExecFailed($path, $target, $exception); } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php index 271052a7d..0a6cd954d 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php @@ -3,9 +3,9 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions; use Illuminate\Container\Container; +use Illuminate\Process\PendingProcess; +use Illuminate\Support\Facades\Process; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; -use LastDragon_ru\LaraASP\Documentator\Utils\Process; -use Mockery; use PHPUnit\Framework\Attributes\CoversClass; use function dirname; @@ -19,17 +19,18 @@ public function testProcess(): void { $path = 'current/working/directory/file.md'; $expected = 'result'; $command = 'command to execute'; - $process = Mockery::mock(Process::class); - $process - ->shouldReceive('run') - ->with('command to execute', dirname($path)) - ->once() - ->andReturn($expected); + $instance = Container::getInstance()->make(IncludeExec::class); - $instance = Container::getInstance()->make(IncludeExec::class, [ - 'process' => $process, + Process::preventStrayProcesses(); + Process::fake([ + $command => Process::result($expected), ]); self::assertEquals($expected, $instance->process($path, $command)); + + Process::assertRan(static function (PendingProcess $process) use ($path, $command): bool { + return $process->path === dirname($path) + && $process->command === $command; + }); } } diff --git a/packages/documentator/src/Utils/Git.php b/packages/documentator/src/Utils/Git.php index 9cc473018..b7bc24d10 100644 --- a/packages/documentator/src/Utils/Git.php +++ b/packages/documentator/src/Utils/Git.php @@ -2,14 +2,15 @@ namespace LastDragon_ru\LaraASP\Documentator\Utils; +use Illuminate\Support\Facades\Process; + use function array_filter; use function array_values; use function explode; +use function trim; class Git { - public function __construct( - protected readonly Process $process, - ) { + public function __construct() { // empty } @@ -19,7 +20,7 @@ public function __construct( * @return list */ public function getTags(callable $filter = null, string $root = null): array { - $tags = $this->process->run(['git', 'tag', '--list'], $root); + $tags = $this->run(['git', 'tag', '--list'], $root); $tags = explode("\n", $tags); $tags = $filter ? array_filter($tags, $filter) : $tags; $tags = array_values($tags); @@ -28,14 +29,25 @@ public function getTags(callable $filter = null, string $root = null): array { } public function getFile(string $path, string $revision = 'HEAD', string $root = null): string { - return $this->process->run(['git', 'show', "{$revision}:{$path}"], $root); + return $this->run(['git', 'show', "{$revision}:{$path}"], $root); } public function getBranch(string $root = null): string { - return $this->process->run(['git', 'rev-parse', '--abbrev-ref=HEAD'], $root); + return $this->run(['git', 'rev-parse', '--abbrev-ref=HEAD'], $root); } public function getRoot(string $root = null): string { - return $this->process->run(['git', 'rev-parse', '--show-toplevel'], $root); + return $this->run(['git', 'rev-parse', '--show-toplevel'], $root); + } + + /** + * @param array|string $command + */ + private function run(array|string $command, string $root = null): string { + $process = $root !== null ? Process::path($root) : Process::command(''); + $output = $process->run($command)->throw()->output(); + $output = trim($output); + + return $output; } } diff --git a/packages/documentator/src/Utils/Process.php b/packages/documentator/src/Utils/Process.php deleted file mode 100644 index 8b621f196..000000000 --- a/packages/documentator/src/Utils/Process.php +++ /dev/null @@ -1,32 +0,0 @@ -|string $command - */ - public function run(array|string $command, string $cwd = null): string { - $process = is_string($command) - ? SymfonyProcess::fromShellCommandline($command, $cwd) - : new SymfonyProcess($command, $cwd); - - $process->run(); - - if (!$process->isSuccessful()) { - throw new ProcessFailedException($process); - } - - return trim($process->getOutput()); - } -} From e97041aeeb9f1e8f8dd11d51f0297c8f7b33998a Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:00:23 +0400 Subject: [PATCH 8/9] Removed dependency `symfony/process`. --- composer.json | 1 - packages/documentator/composer.json | 1 - 2 files changed, 2 deletions(-) diff --git a/composer.json b/composer.json index 0a84a778e..2d51362fc 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,6 @@ "symfony/http-foundation": "^6.3.0", "symfony/mime": "^6.3.0", "symfony/polyfill-php83": "^1.28", - "symfony/process": "^6.3.0", "symfony/property-access": "^6.3.0", "symfony/property-info": "^6.3.9", "symfony/psr-http-message-bridge": "^2.0.0|^6.4.0", diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index 1e260b13b..0ddbd02c6 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -26,7 +26,6 @@ "phpdocumentor/reflection-docblock": "^5.2", "symfony/filesystem": "^6.3.0", "symfony/finder": "^6.3.0", - "symfony/process": "^6.3.0", "symfony/polyfill-php83": "^1.28", "lastdragon-ru/lara-asp-core": "self.version", "lastdragon-ru/lara-asp-serializer": "self.version" From 4ff46c3aecf896f772d9cbccaba8c7f703f699e5 Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:12:02 +0400 Subject: [PATCH 9/9] The `composer/semver` dependency moved to `require-dev`. --- packages/migrator/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/migrator/composer.json b/packages/migrator/composer.json index 1c32dad89..8b7eddb85 100644 --- a/packages/migrator/composer.json +++ b/packages/migrator/composer.json @@ -22,7 +22,6 @@ "require": { "php": "^8.1|^8.2|^8.3", "ext-json": "*", - "composer/semver": "^3.2", "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "symfony/filesystem": "^6.3.0", @@ -32,6 +31,7 @@ }, "require-dev": { "ext-pdo_sqlite": "*", + "composer/semver": "^3.2", "lastdragon-ru/lara-asp-testing": "self.version", "mockery/mockery": "^1.6.2", "orchestra/testbench": "^8.0.0",