diff --git a/README.md b/README.md index a9108b573..aedbe36e2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The set provides best practices to make development more fun and classes/service |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/composer.json b/composer.json index 79ed4d573..953243f12 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-bcmath": "*", "ext-dom": "*", "ext-filter": "*", @@ -43,7 +43,7 @@ "ext-xmlreader": "*", "composer/semver": "^3.2", "doctrine/sql-formatter": "^1.1", - "guzzlehttp/psr7": "^1.9.1|^2.4.5", + "guzzlehttp/psr7": "^2.4.5", "http-interop/http-factory-guzzle": "^1.0.0", "illuminate/collections": "^10.34.0|^11.0.0", "illuminate/conditionable": "^10.34.0|^11.0.0", @@ -62,7 +62,7 @@ "illuminate/translation": "^10.34.0|^11.0.0", "illuminate/validation": "^10.34.0|^11.0.0", "league/commonmark": "^2.4", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "nikic/php-parser": "^4.18|^5.0", "nuwave/lighthouse": "^6.5.0", "opis/json-schema": "^2.3.0", diff --git a/docs/Shared/Upgrade/FromV6.md b/docs/Shared/Upgrade/FromV6.md index 922f296b9..26a98d7d7 100644 --- a/docs/Shared/Upgrade/FromV6.md +++ b/docs/Shared/Upgrade/FromV6.md @@ -1 +1,3 @@ +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). diff --git a/metadata.json b/metadata.json index 530d7f675..900dc785b 100644 --- a/metadata.json +++ b/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/core/README.md b/packages/core/README.md index f10ef56b7..272bdfaf2 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -12,7 +12,7 @@ This package contains useful utilities and classes. |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/core/UPGRADE.md b/packages/core/UPGRADE.md index 98d80eb36..cdcff5e1c 100644 --- a/packages/core/UPGRADE.md +++ b/packages/core/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/core/composer.json b/packages/core/composer.json index c995588e5..b12b3083d 100644 --- a/packages/core/composer.json +++ b/packages/core/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "illuminate/console": "^10.34.0|^11.0.0", "illuminate/container": "^10.34.0|^11.0.0", "illuminate/contracts": "^10.34.0|^11.0.0", @@ -30,7 +30,7 @@ "require-dev": { "phpunit/phpunit": "^10.1.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0" }, "autoload": { diff --git a/packages/core/metadata.json b/packages/core/metadata.json index c3be8eef1..fe1afa2bd 100644 --- a/packages/core/metadata.json +++ b/packages/core/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/core/src/Helpers/Translator.php b/packages/core/src/Helpers/Translator.php index f274c8ca2..332f7d06b 100644 --- a/packages/core/src/Helpers/Translator.php +++ b/packages/core/src/Helpers/Translator.php @@ -29,7 +29,7 @@ abstract protected function getName(): string; * @param list|string $key * @param array $replace */ - public function get(array|string $key, array $replace = [], string $locale = null): string { + public function get(array|string $key, array $replace = [], ?string $locale = null): string { return $this->translate($key, function (string $key) use ($replace, $locale): string { return Cast::toString($this->translator->get($this->key($key), $replace, $locale)); }); @@ -44,7 +44,7 @@ public function choice( array|string $key, Countable|array|int $number, array $replace = [], - string $locale = null, + ?string $locale = null, ): string { return $this->translate($key, function (string $key) use ($number, $replace, $locale): string { return $this->translator->choice($this->key($key), $number, $replace, $locale); diff --git a/packages/dev/README.md b/packages/dev/README.md index f93ee188a..374d91373 100644 --- a/packages/dev/README.md +++ b/packages/dev/README.md @@ -12,7 +12,7 @@ Various internal tools and helpers to develop the package itself. |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 6.2.0` | | | `^8.2` | `HEAD ⋯ 6.2.0` | -| | `^8.1` | `HEAD ⋯ 6.2.0` | +| | `^8.1` | `6.4.1 ⋯ 6.2.0` | | PHPStan | `^1.10` | `HEAD ⋯ 6.2.0` | [//]: # (end: 0f999169cbabc32d4f47c79c31d74f8b4066c685962719bae5df3c63a08ea382) diff --git a/packages/dev/UPGRADE.md b/packages/dev/UPGRADE.md index 42f6c1f83..b28416758 100644 --- a/packages/dev/UPGRADE.md +++ b/packages/dev/UPGRADE.md @@ -26,3 +26,15 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) |:--:|:--------------------------------------------------------------------------------------------------------------------| [//]: # (end: 8e89e65b3785cb5b41f28a4f3c5b7e0db0110d8047852d71cd99b2cdffd8f57c) + +# Upgrade from v6 + +[include:file]: ../../docs/Shared/Upgrade/FromV6.md +[//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) +[//]: # (warning: Generated automatically. Do not edit.) + +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + +* [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). + +[//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/dev/composer.json b/packages/dev/composer.json index 4038fe629..0d92b6325 100644 --- a/packages/dev/composer.json +++ b/packages/dev/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "illuminate/contracts": "^10.34.0|^11.0.0", "illuminate/support": "^10.34.0|^11.0.0", "larastan/larastan": "^2.8.1", diff --git a/packages/dev/metadata.json b/packages/dev/metadata.json index a22b386fc..8677a03df 100644 --- a/packages/dev/metadata.json +++ b/packages/dev/metadata.json @@ -9,8 +9,7 @@ "HEAD": { "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ], "phpstan/phpstan": [ "^1.10" diff --git a/packages/dev/src/App/Example.php b/packages/dev/src/App/Example.php index 6d7d5c266..e51b937ef 100644 --- a/packages/dev/src/App/Example.php +++ b/packages/dev/src/App/Example.php @@ -91,11 +91,11 @@ public function __invoke(File $file): ?string { return $result; } - public static function dump(mixed $value, string $expression = null): void { + public static function dump(mixed $value, ?string $expression = null): void { self::getDumper()->dump($value, $expression ?? self::getExpression(__FUNCTION__)); } - public static function raw(Stringable|string $value, string $type, string $expression = null): void { + public static function raw(Stringable|string $value, string $type, ?string $expression = null): void { self::getDumper()->raw($value, $expression ?? self::getExpression(__FUNCTION__), $type); } diff --git a/packages/documentator/README.md b/packages/documentator/README.md index b1e9ed076..7a433936c 100644 --- a/packages/documentator/README.md +++ b/packages/documentator/README.md @@ -12,7 +12,7 @@ This package provides various utilities for documentation generation such as Mar |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 5.0.0-beta.1` | -| | `^8.1` | `HEAD ⋯ 5.0.0-beta.1` | +| | `^8.1` | `6.4.1 ⋯ 5.0.0-beta.1` | | Laravel | `^11.0.0` | `HEAD ⋯ 6.2.0` | | | `^10.34.0` | `HEAD ⋯ 6.2.0` | | | `^10.0.0` | `6.1.0 ⋯ 5.0.0-beta.1` | diff --git a/packages/documentator/UPGRADE.md b/packages/documentator/UPGRADE.md index c66b54401..b2a67ddc8 100644 --- a/packages/documentator/UPGRADE.md +++ b/packages/documentator/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index a147832d8..89d537803 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-mbstring": "*", "composer/semver": "^3.2", "illuminate/contracts": "^10.34.0|^11.0.0", @@ -41,7 +41,7 @@ }, "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0", "phpunit/phpunit": "^10.1.0|^11.0.0", "webonyx/graphql-php": "^15.4.0" diff --git a/packages/documentator/metadata.json b/packages/documentator/metadata.json index b67f6001c..c564d1c68 100644 --- a/packages/documentator/metadata.json +++ b/packages/documentator/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/documentator/src/PackageException.php b/packages/documentator/src/PackageException.php index 0c113a042..91165bda9 100644 --- a/packages/documentator/src/PackageException.php +++ b/packages/documentator/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message, Throwable $previous = null) { + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/documentator/src/Processor/Exceptions/CircularDependency.php b/packages/documentator/src/Processor/Exceptions/CircularDependency.php index a8d87f61f..532f8d926 100644 --- a/packages/documentator/src/Processor/Exceptions/CircularDependency.php +++ b/packages/documentator/src/Processor/Exceptions/CircularDependency.php @@ -19,7 +19,7 @@ public function __construct( protected readonly File $target, protected readonly File $dependency, protected readonly array $stack, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/documentator/src/Processor/Exceptions/DependencyNotFound.php b/packages/documentator/src/Processor/Exceptions/DependencyNotFound.php index 28e0a832b..e07b400cc 100644 --- a/packages/documentator/src/Processor/Exceptions/DependencyNotFound.php +++ b/packages/documentator/src/Processor/Exceptions/DependencyNotFound.php @@ -18,7 +18,7 @@ public function __construct( * @var Dependency<*> */ protected readonly Dependency $dependency, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/documentator/src/Processor/Exceptions/FileSaveFailed.php b/packages/documentator/src/Processor/Exceptions/FileSaveFailed.php index 6da9ad8bb..2390507fc 100644 --- a/packages/documentator/src/Processor/Exceptions/FileSaveFailed.php +++ b/packages/documentator/src/Processor/Exceptions/FileSaveFailed.php @@ -12,7 +12,7 @@ class FileSaveFailed extends ProcessorError { public function __construct( protected Directory $root, protected readonly File $target, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/documentator/src/Processor/Exceptions/FileTaskFailed.php b/packages/documentator/src/Processor/Exceptions/FileTaskFailed.php index 9e0ab5d94..b47f252c0 100644 --- a/packages/documentator/src/Processor/Exceptions/FileTaskFailed.php +++ b/packages/documentator/src/Processor/Exceptions/FileTaskFailed.php @@ -14,7 +14,7 @@ public function __construct( protected Directory $root, protected readonly File $target, protected readonly Task $task, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/documentator/src/Processor/Exceptions/ProcessingFailed.php b/packages/documentator/src/Processor/Exceptions/ProcessingFailed.php index 644c8b4ec..75d0c5ad5 100644 --- a/packages/documentator/src/Processor/Exceptions/ProcessingFailed.php +++ b/packages/documentator/src/Processor/Exceptions/ProcessingFailed.php @@ -10,7 +10,7 @@ class ProcessingFailed extends ProcessorError { public function __construct( protected Directory $root, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/DependencyIsMissing.php b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/DependencyIsMissing.php index d756bd252..316339fab 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/DependencyIsMissing.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/DependencyIsMissing.php @@ -14,7 +14,7 @@ class DependencyIsMissing extends InstructionFailed { public function __construct( Context $context, private readonly string $class, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/InstructionFailed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/InstructionFailed.php index 0a219666e..e90335055 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/InstructionFailed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/InstructionFailed.php @@ -9,7 +9,7 @@ abstract class InstructionFailed extends PreprocessError { public function __construct( private readonly Context $context, string $message, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct($message, $previous); } diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/PreprocessFailed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/PreprocessFailed.php index 9c580c00d..9af918c3a 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/PreprocessFailed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Exceptions/PreprocessFailed.php @@ -6,7 +6,7 @@ class PreprocessFailed extends PreprocessError { public function __construct( - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( 'Preprocessing failed.', diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandError.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandError.php index 0427eb719..750997303 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandError.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandError.php @@ -11,7 +11,7 @@ class ArtisanCommandError extends InstructionFailed { public function __construct( Context $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandFailed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandFailed.php index edc305773..8ad59f22b 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandFailed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeArtisan/Exceptions/ArtisanCommandFailed.php @@ -12,7 +12,7 @@ class ArtisanCommandFailed extends InstructionFailed { public function __construct( Context $context, private readonly int $result, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php index 9ea966aa9..a5e0aa6b0 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php @@ -9,7 +9,7 @@ use function sprintf; class TargetIsNotValidPhpFile extends InstructionFailed { - public function __construct(Context $context, Throwable $previous = null) { + public function __construct(Context $context, ?Throwable $previous = null) { parent::__construct( $context, sprintf( diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php index 1ab5e31be..3e0cee490 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php @@ -13,7 +13,7 @@ class DocumentTitleIsMissing extends InstructionFailed { public function __construct( Context $context, private readonly File $document, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExample/Exceptions/ExampleFailed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExample/Exceptions/ExampleFailed.php index 5f35216ec..055e68854 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExample/Exceptions/ExampleFailed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExample/Exceptions/ExampleFailed.php @@ -13,7 +13,7 @@ class ExampleFailed extends InstructionFailed { public function __construct( Context $context, private readonly File $example, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExec/Exceptions/TargetExecFailed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExec/Exceptions/TargetExecFailed.php index 4d4679cb6..d618909d9 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExec/Exceptions/TargetExecFailed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeExec/Exceptions/TargetExecFailed.php @@ -9,7 +9,7 @@ use function sprintf; class TargetExecFailed extends InstructionFailed { - public function __construct(Context $context, Throwable $previous = null) { + public function __construct(Context $context, ?Throwable $previous = null) { parent::__construct( $context, sprintf( diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php index a55674c62..4b3bc155b 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php @@ -9,7 +9,7 @@ use function sprintf; class TargetIsNotDirective extends InstructionFailed { - public function __construct(Context $context, Throwable $previous = null) { + public function __construct(Context $context, ?Throwable $previous = null) { parent::__construct( $context, sprintf( diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php index 9b1100c4f..7477bc039 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php @@ -13,7 +13,7 @@ class PackageComposerJsonIsMissing extends InstructionFailed { public function __construct( Context $context, private readonly Directory $package, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php index f2dd5f051..66cb318a2 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php @@ -15,7 +15,7 @@ public function __construct( Context $context, private readonly Directory $package, private readonly File $readme, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php index f53de50ab..f09f77f78 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php @@ -15,7 +15,7 @@ public function __construct( Context $context, private readonly Directory $package, private readonly File $readme, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php index e59cd0138..66f2f3e3f 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php @@ -9,7 +9,7 @@ use function sprintf; class TemplateDataMissed extends InstructionFailed { - public function __construct(Context $context, Throwable $previous = null) { + public function __construct(Context $context, ?Throwable $previous = null) { parent::__construct( $context, sprintf( diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php index e185476a2..9e0128ce3 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php @@ -16,7 +16,7 @@ class TemplateVariablesMissed extends InstructionFailed { public function __construct( Context $context, private readonly array $variables, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php index 6fed4ba94..d8b0c2313 100644 --- a/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php +++ b/packages/documentator/src/Processor/Tasks/Preprocess/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php @@ -16,7 +16,7 @@ class TemplateVariablesUnused extends InstructionFailed { public function __construct( Context $context, private readonly array $variables, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( $context, diff --git a/packages/documentator/src/Utils/Git.php b/packages/documentator/src/Utils/Git.php index a59c44991..f26224bbc 100644 --- a/packages/documentator/src/Utils/Git.php +++ b/packages/documentator/src/Utils/Git.php @@ -21,7 +21,7 @@ public function __construct( * * @return list */ - public function getTags(callable $filter = null, string $root = null): array { + public function getTags(?callable $filter = null, ?string $root = null): array { $tags = $this->run(['git', 'tag', '--list'], $root); $tags = explode("\n", $tags); $tags = $filter ? array_filter($tags, $filter) : $tags; @@ -30,22 +30,22 @@ public function getTags(callable $filter = null, string $root = null): array { return $tags; } - public function getFile(string $path, string $revision = 'HEAD', string $root = null): string { + public function getFile(string $path, string $revision = 'HEAD', ?string $root = null): string { return $this->run(['git', 'show', "{$revision}:{$path}"], $root); } - public function getBranch(string $root = null): string { + public function getBranch(?string $root = null): string { return $this->run(['git', 'rev-parse', '--abbrev-ref=HEAD'], $root); } - public function getRoot(string $root = null): string { + public function getRoot(?string $root = null): string { return $this->run(['git', 'rev-parse', '--show-toplevel'], $root); } /** * @param array|string $command */ - private function run(array|string $command, string $root = null): string { + private function run(array|string $command, ?string $root = null): string { $process = $this->factory->newPendingProcess(); $process = $root !== null ? $process->path($root) : $process->command(''); $output = $process->run($command)->throw()->output(); diff --git a/packages/documentator/src/Utils/Markdown.php b/packages/documentator/src/Utils/Markdown.php index c29c8bba6..e6860f864 100644 --- a/packages/documentator/src/Utils/Markdown.php +++ b/packages/documentator/src/Utils/Markdown.php @@ -112,7 +112,7 @@ protected static function getText(string $string, ?AbstractBlock $node): ?string * * @return ?T */ - protected static function getFirstNode(?Node $node, string $class, callable $filter = null): ?Node { + protected static function getFirstNode(?Node $node, string $class, ?callable $filter = null): ?Node { // Null? if ($node === null) { return null; diff --git a/packages/eloquent/README.md b/packages/eloquent/README.md index b0f121b5e..d8641d144 100644 --- a/packages/eloquent/README.md +++ b/packages/eloquent/README.md @@ -12,7 +12,7 @@ This package contains useful extensions and mixins for [Eloquent](https://larave |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/eloquent/UPGRADE.md b/packages/eloquent/UPGRADE.md index 1f9780e2c..eba885e1b 100644 --- a/packages/eloquent/UPGRADE.md +++ b/packages/eloquent/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/eloquent/composer.json b/packages/eloquent/composer.json index 9de965773..10ed74252 100644 --- a/packages/eloquent/composer.json +++ b/packages/eloquent/composer.json @@ -17,7 +17,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "illuminate/collections": "^10.34.0|^11.0.0", "illuminate/database": "^10.34.0|^11.0.0", "illuminate/support": "^10.34.0|^11.0.0", @@ -26,8 +26,9 @@ }, "require-dev": { "ext-pdo_sqlite": "*", + "illuminate/contracts": "^10.34.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0", "phpunit/phpunit": "^10.1.0|^11.0.0" }, diff --git a/packages/eloquent/metadata.json b/packages/eloquent/metadata.json index 530d7f675..900dc785b 100644 --- a/packages/eloquent/metadata.json +++ b/packages/eloquent/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/eloquent/src/Exceptions/PropertyIsNotRelation.php b/packages/eloquent/src/Exceptions/PropertyIsNotRelation.php index c5531f72c..7b5385b95 100644 --- a/packages/eloquent/src/Exceptions/PropertyIsNotRelation.php +++ b/packages/eloquent/src/Exceptions/PropertyIsNotRelation.php @@ -12,7 +12,7 @@ class PropertyIsNotRelation extends PackageException { public function __construct( protected Model $model, protected string $property, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Property `%s::%s()` is not a relation.', diff --git a/packages/eloquent/src/Iterators/ChunkedChangeSafeIterator.php b/packages/eloquent/src/Iterators/ChunkedChangeSafeIterator.php index 5fa8e35b9..b892601e8 100644 --- a/packages/eloquent/src/Iterators/ChunkedChangeSafeIterator.php +++ b/packages/eloquent/src/Iterators/ChunkedChangeSafeIterator.php @@ -37,7 +37,7 @@ class ChunkedChangeSafeIterator extends IteratorImpl { private string $column; - public function __construct(Builder $builder, string $column = null) { + public function __construct(Builder $builder, ?string $column = null) { parent::__construct($builder); $this->column = $column ?? $this->getDefaultColumn($builder); diff --git a/packages/eloquent/src/Mixins/EloquentBuilderMixin.php b/packages/eloquent/src/Mixins/EloquentBuilderMixin.php index f9aa3f5cd..19735d9fa 100644 --- a/packages/eloquent/src/Mixins/EloquentBuilderMixin.php +++ b/packages/eloquent/src/Mixins/EloquentBuilderMixin.php @@ -36,7 +36,7 @@ public function orderByKeyDesc(): Closure { * @return Closure(int=): ChunkedIterator */ public function getChunkedIterator(): Closure { - return function (int $chunk = null): ChunkedIterator { + return function (?int $chunk = null): ChunkedIterator { /** @var Builder $this */ $iterator = new ChunkedIterator($this); @@ -52,7 +52,7 @@ public function getChunkedIterator(): Closure { * @return Closure(int=,string=): ChunkedChangeSafeIterator */ public function getChangeSafeIterator(): Closure { - return function (int $chunk = null, string $column = null): ChunkedChangeSafeIterator { + return function (?int $chunk = null, ?string $column = null): ChunkedChangeSafeIterator { /** @var Builder $this */ $iterator = new ChunkedChangeSafeIterator($this, $column); diff --git a/packages/eloquent/src/ModelHelperTest.php b/packages/eloquent/src/ModelHelperTest.php index f330e6180..7b26ec546 100644 --- a/packages/eloquent/src/ModelHelperTest.php +++ b/packages/eloquent/src/ModelHelperTest.php @@ -4,6 +4,7 @@ use Closure; use Exception; +use Illuminate\Contracts\Database\Eloquent\Builder as BuilderContract; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -73,7 +74,6 @@ public function testIsSoftDeletable(bool $expected, Closure $model): void { * @return array */ public static function dataProviderGetRelation(): array { - // todo(eloquent): Add tests for Intersection Types (PHP 8.1) return (new CompositeDataProvider( new ArrayDataProvider([ 'model' => [ @@ -106,6 +106,10 @@ static function (): Builder { new PropertyIsNotRelation(new ModelHelperTest__Model(), 'unionNotRelation'), 'unionNotRelation', ], + 'intersection' => [ + BelongsTo::class, + 'intersection', + ], 'ok' => [ BelongsTo::class, 'ok', @@ -195,6 +199,13 @@ public function unionNotRelation(): BelongsTo|stdClass { return $this->belongsTo(self::class); } + /** + * @return BelongsTo&BuilderContract + */ + public function intersection(): BelongsTo&BuilderContract { + return $this->belongsTo(self::class); + } + /** * @return BelongsTo */ diff --git a/packages/eloquent/src/PackageException.php b/packages/eloquent/src/PackageException.php index fe9df5bc0..8854a8ff0 100644 --- a/packages/eloquent/src/PackageException.php +++ b/packages/eloquent/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message = '', Throwable $previous = null) { + public function __construct(string $message = '', ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/formatter/README.md b/packages/formatter/README.md index 85e7e472d..b7f27e1f3 100644 --- a/packages/formatter/README.md +++ b/packages/formatter/README.md @@ -12,7 +12,7 @@ This package provides a customizable wrapper around [Intl](https://www.php.net/m |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/formatter/UPGRADE.md b/packages/formatter/UPGRADE.md index 7ab4d0e63..f57f85208 100644 --- a/packages/formatter/UPGRADE.md +++ b/packages/formatter/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/formatter/composer.json b/packages/formatter/composer.json index fe8d21e9c..f3ae8b831 100644 --- a/packages/formatter/composer.json +++ b/packages/formatter/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-bcmath": "*", "ext-intl": "*", "ext-mbstring": "*", diff --git a/packages/formatter/metadata.json b/packages/formatter/metadata.json index 530d7f675..900dc785b 100644 --- a/packages/formatter/metadata.json +++ b/packages/formatter/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/formatter/src/Exceptions/FailedToCreateDateFormatter.php b/packages/formatter/src/Exceptions/FailedToCreateDateFormatter.php index c4f5d91c3..cba754565 100644 --- a/packages/formatter/src/Exceptions/FailedToCreateDateFormatter.php +++ b/packages/formatter/src/Exceptions/FailedToCreateDateFormatter.php @@ -12,7 +12,7 @@ class FailedToCreateDateFormatter extends PackageException { public function __construct( protected string $type, protected string|int|null $format, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Failed to create instance of `%s` for type `%s` with format `%s`.', diff --git a/packages/formatter/src/Exceptions/FailedToCreateNumberFormatter.php b/packages/formatter/src/Exceptions/FailedToCreateNumberFormatter.php index 6849b24f7..50fafef56 100644 --- a/packages/formatter/src/Exceptions/FailedToCreateNumberFormatter.php +++ b/packages/formatter/src/Exceptions/FailedToCreateNumberFormatter.php @@ -11,7 +11,7 @@ class FailedToCreateNumberFormatter extends PackageException { public function __construct( protected string $type, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Failed to create instance of `%s` for type `%s`.', diff --git a/packages/formatter/src/Exceptions/FailedToFormatValue.php b/packages/formatter/src/Exceptions/FailedToFormatValue.php index fe5ee8f00..4f6653511 100644 --- a/packages/formatter/src/Exceptions/FailedToFormatValue.php +++ b/packages/formatter/src/Exceptions/FailedToFormatValue.php @@ -12,7 +12,7 @@ public function __construct( protected string $type, protected int $errorCode, protected string $errorMessage, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Formatting for type `%s` failed: `%s` (`%s`).', diff --git a/packages/formatter/src/Formatter.php b/packages/formatter/src/Formatter.php index 84fe9c7e8..c97edd64e 100644 --- a/packages/formatter/src/Formatter.php +++ b/packages/formatter/src/Formatter.php @@ -280,13 +280,13 @@ public function integer(int|float|null $value): string { return $this->formatValue(static::Integer, $value); } - public function decimal(float|int|null $value, int $decimals = null): string { + public function decimal(float|int|null $value, ?int $decimals = null): string { return $this->formatValue(static::Decimal, $value, $decimals, function () use ($decimals): int { return $decimals ?: Cast::toInt($this->getOptions(static::Decimal, 2)); }); } - public function currency(?float $value, string $currency = null): string { + public function currency(?float $value, ?string $currency = null): string { $type = static::Currency; $value = (float) $value; $currency = $currency ?: Cast::toString($this->getOptions($type, 'USD')); @@ -303,7 +303,7 @@ public function currency(?float $value, string $currency = null): string { /** * @param float|null $value must be between 0-100 */ - public function percent(?float $value, int $decimals = null): string { + public function percent(?float $value, ?int $decimals = null): string { return $this->formatValue(static::Percent, (float) $value / 100, $decimals, function () use ($decimals): int { return $decimals ?: Cast::toInt($this->getOptions(static::Percent, 0)); }); @@ -321,7 +321,7 @@ public function ordinal(?int $value): string { return $this->formatValue(static::Ordinal, $value); } - public function duration(DateInterval|float|int|null $value, string $format = null): string { + public function duration(DateInterval|float|int|null $value, ?string $format = null): string { $type = static::Duration; $format = $format ?: $this->getOptions($type); $format = is_string($format) @@ -341,24 +341,24 @@ public function duration(DateInterval|float|int|null $value, string $format = nu public function time( ?DateTimeInterface $value, - string $format = null, - IntlTimeZone|DateTimeZone|string $timezone = null, + ?string $format = null, + IntlTimeZone|DateTimeZone|string|null $timezone = null, ): string { return $this->formatDateTime(self::Time, $value, $format, $timezone); } public function date( ?DateTimeInterface $value, - string $format = null, - IntlTimeZone|DateTimeZone|string $timezone = null, + ?string $format = null, + IntlTimeZone|DateTimeZone|string|null $timezone = null, ): string { return $this->formatDateTime(self::Date, $value, $format, $timezone); } public function datetime( ?DateTimeInterface $value, - string $format = null, - IntlTimeZone|DateTimeZone|string $timezone = null, + ?string $format = null, + IntlTimeZone|DateTimeZone|string|null $timezone = null, ): string { return $this->formatDateTime(self::DateTime, $value, $format, $timezone); } @@ -368,7 +368,7 @@ public function datetime( * * @param numeric-string|float|int<0, max>|null $bytes */ - public function filesize(string|float|int|null $bytes, int $decimals = null): string { + public function filesize(string|float|int|null $bytes, ?int $decimals = null): string { return $this->formatFilesize( $bytes, $decimals ?: Cast::toInt($this->getOptions(static::Filesize, 2)), @@ -394,7 +394,7 @@ public function filesize(string|float|int|null $bytes, int $decimals = null): st * * @param numeric-string|float|int<0, max>|null $bytes */ - public function disksize(string|float|int|null $bytes, int $decimals = null): string { + public function disksize(string|float|int|null $bytes, ?int $decimals = null): string { return $this->formatFilesize( $bytes, $decimals ?: Cast::toInt($this->getOptions(static::Disksize, 2)), @@ -415,7 +415,7 @@ public function disksize(string|float|int|null $bytes, int $decimals = null): st ); } - public function secret(?string $value, int $show = null): string { + public function secret(?string $value, ?int $show = null): string { if (is_null($value)) { return ''; } @@ -487,8 +487,8 @@ protected function getTranslation(array|string $key, array $replace = []): strin protected function formatValue( string $type, float|int|null $value, - int $decimals = null, - Closure $closure = null, + ?int $decimals = null, + ?Closure $closure = null, ): string { $value = (float) $value; $formatter = $this->getIntlNumberFormatter($type, $decimals, $closure); @@ -504,8 +504,8 @@ protected function formatValue( protected function formatDateTime( string $type, ?DateTimeInterface $value, - string $format = null, - IntlTimeZone|DateTimeZone|string $timezone = null, + ?string $format = null, + IntlTimeZone|DateTimeZone|string|null $timezone = null, ): string { if (is_null($value)) { return ''; @@ -551,7 +551,7 @@ protected function formatFilesize(string|float|int|null $bytes, int $decimals, i // // ========================================================================= - private function getIntlDateFormatter(string $type, string $format = null): IntlDateFormatter { + private function getIntlDateFormatter(string $type, ?string $format = null): IntlDateFormatter { $key = json_encode([$type, $format], JSON_THROW_ON_ERROR); $formatter = $this->dateFormatters[$key] ?? $this->createIntlDateFormatter($type, $format); @@ -564,7 +564,7 @@ private function getIntlDateFormatter(string $type, string $format = null): Intl return $formatter; } - private function createIntlDateFormatter(string $type, string $format = null): ?IntlDateFormatter { + private function createIntlDateFormatter(string $type, ?string $format = null): ?IntlDateFormatter { $formatter = null; $pattern = ''; $default = IntlDateFormatter::SHORT; @@ -624,8 +624,8 @@ private function createIntlDateFormatter(string $type, string $format = null): ? */ private function getIntlNumberFormatter( string $type, - int $decimals = null, - Closure $closure = null, + ?int $decimals = null, + ?Closure $closure = null, ): NumberFormatter { $key = json_encode([$type, $decimals], JSON_THROW_ON_ERROR); $formatter = $this->numbersFormatters[$key] ?? $this->createIntlNumberFormatter($type, $decimals, $closure); @@ -644,8 +644,8 @@ private function getIntlNumberFormatter( */ private function createIntlNumberFormatter( string $type, - int $decimals = null, - Closure $closure = null, + ?int $decimals = null, + ?Closure $closure = null, ): ?NumberFormatter { $formatter = null; $attributes = []; diff --git a/packages/formatter/src/PackageException.php b/packages/formatter/src/PackageException.php index b84800985..bdd5a1798 100644 --- a/packages/formatter/src/PackageException.php +++ b/packages/formatter/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message, Throwable $previous = null) { + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/graphql-printer/README.md b/packages/graphql-printer/README.md index 38e0a64e4..d87ed57a0 100644 --- a/packages/graphql-printer/README.md +++ b/packages/graphql-printer/README.md @@ -12,7 +12,7 @@ Independent (from Laravel and Lighthouse) package that allow you to print GraphQ |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 3.0.0` | -| | `^8.1` | `HEAD ⋯ 3.0.0` | +| | `^8.1` | `6.4.1 ⋯ 3.0.0` | | | `^8.0` | `4.6.0 ⋯ 3.0.0` | | `webonyx/graphql-php` | `^15.4.0` | `HEAD ⋯ 4.2.1` | | | `^15.2.4` | `4.2.0 ⋯ 4.0.0` | diff --git a/packages/graphql-printer/UPGRADE.md b/packages/graphql-printer/UPGRADE.md index 42f6c1f83..b28416758 100644 --- a/packages/graphql-printer/UPGRADE.md +++ b/packages/graphql-printer/UPGRADE.md @@ -26,3 +26,15 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) |:--:|:--------------------------------------------------------------------------------------------------------------------| [//]: # (end: 8e89e65b3785cb5b41f28a4f3c5b7e0db0110d8047852d71cd99b2cdffd8f57c) + +# Upgrade from v6 + +[include:file]: ../../docs/Shared/Upgrade/FromV6.md +[//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) +[//]: # (warning: Generated automatically. Do not edit.) + +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + +* [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). + +[//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/graphql-printer/composer.json b/packages/graphql-printer/composer.json index d9b6d1643..545f612d1 100644 --- a/packages/graphql-printer/composer.json +++ b/packages/graphql-printer/composer.json @@ -17,7 +17,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-mbstring": "*", "webonyx/graphql-php": "^15.4.0", "symfony/polyfill-php83": "^1.28" @@ -26,7 +26,7 @@ "composer/class-map-generator": "^1.0", "phpunit/phpunit": "^10.1.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2" + "mockery/mockery": "^1.6.5" }, "autoload": { "psr-4": { diff --git a/packages/graphql-printer/metadata.json b/packages/graphql-printer/metadata.json index e24ab7e6f..26b0e1865 100644 --- a/packages/graphql-printer/metadata.json +++ b/packages/graphql-printer/metadata.json @@ -9,8 +9,7 @@ "HEAD": { "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ], "webonyx/graphql-php": [ "^15.4.0" diff --git a/packages/graphql-printer/src/Blocks/Block.php b/packages/graphql-printer/src/Blocks/Block.php index 3ba5ea4a7..ee603593d 100644 --- a/packages/graphql-printer/src/Blocks/Block.php +++ b/packages/graphql-printer/src/Blocks/Block.php @@ -97,24 +97,15 @@ protected function isStringMultiline(string $string): bool { // // ========================================================================= - /** - * @param (TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string|null $type - */ - public function isTypeAllowed(TypeDefinitionNode|TypeNode|Type|string|null $type): bool { + public function isTypeAllowed((TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string|null $type): bool { return $type === null || $this->getContext()->isTypeAllowed($this->getTypeName($type)); } - /** - * @param (TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string|null $type - */ - public function isTypeDefinitionAllowed(TypeDefinitionNode|TypeNode|Type|string|null $type): bool { + public function isTypeDefinitionAllowed((TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string|null $type): bool { return $type === null || $this->getContext()->isTypeDefinitionAllowed($this->getTypeName($type)); } - /** - * @param (TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string $type - */ - protected function getTypeName(TypeDefinitionNode|TypeNode|Type|string $type): string { + protected function getTypeName((TypeDefinitionNode&Node)|(TypeNode&Node)|Type|string $type): string { return is_object($type) ? $this->getContext()->getTypeName($type) : $type; diff --git a/packages/graphql-printer/src/Blocks/Document/Argument.php b/packages/graphql-printer/src/Blocks/Document/Argument.php index c64f5e3e4..69672f690 100644 --- a/packages/graphql-printer/src/Blocks/Document/Argument.php +++ b/packages/graphql-printer/src/Blocks/Document/Argument.php @@ -19,13 +19,10 @@ */ #[GraphQLAstNode(ArgumentNode::class)] class Argument extends Block implements NamedBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, private ArgumentNode $argument, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context); } diff --git a/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php b/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php index 70326bf27..43d70e737 100644 --- a/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php +++ b/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php @@ -30,7 +30,7 @@ public function testSerialize( int $level, int $used, array $directives, - string $reason = null, + ?string $reason = null, ): void { $collector = new Collector(); $context = new Context($settings, null, null); diff --git a/packages/graphql-printer/src/Blocks/Document/Field.php b/packages/graphql-printer/src/Blocks/Document/Field.php index 57a48e00e..acdb175a6 100644 --- a/packages/graphql-printer/src/Blocks/Document/Field.php +++ b/packages/graphql-printer/src/Blocks/Document/Field.php @@ -22,13 +22,10 @@ */ #[GraphQLAstNode(FieldNode::class)] class Field extends DefinitionBlock implements ExecutableDefinitionBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, FieldNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition); } diff --git a/packages/graphql-printer/src/Blocks/Document/FieldDefinition.php b/packages/graphql-printer/src/Blocks/Document/FieldDefinition.php index a103df74a..fe7f91229 100644 --- a/packages/graphql-printer/src/Blocks/Document/FieldDefinition.php +++ b/packages/graphql-printer/src/Blocks/Document/FieldDefinition.php @@ -60,10 +60,7 @@ protected function arguments(bool $multiline): ?Block { return $arguments; } - /** - * @return (TypeNode&Node)|(GraphQLType&(OutputType|InputType)) - */ - private function getType(): TypeNode|GraphQLType { + private function getType(): (TypeNode&Node)|(GraphQLType&OutputType)|(GraphQLType&InputType) { $definition = $this->getDefinition(); $type = $definition instanceof FieldDefinitionNode ? $definition->type diff --git a/packages/graphql-printer/src/Blocks/Document/FieldTest.php b/packages/graphql-printer/src/Blocks/Document/FieldTest.php index ee449a058..cb780b3d2 100644 --- a/packages/graphql-printer/src/Blocks/Document/FieldTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FieldTest.php @@ -24,9 +24,6 @@ final class FieldTest extends TestCase { // // ========================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ #[DataProvider('dataProviderSerialize')] public function testSerialize( string $expected, @@ -34,7 +31,7 @@ public function testSerialize( int $level, int $used, FieldNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); diff --git a/packages/graphql-printer/src/Blocks/Document/FragmentSpread.php b/packages/graphql-printer/src/Blocks/Document/FragmentSpread.php index b14b6b073..dc0f25ce2 100644 --- a/packages/graphql-printer/src/Blocks/Document/FragmentSpread.php +++ b/packages/graphql-printer/src/Blocks/Document/FragmentSpread.php @@ -20,13 +20,10 @@ */ #[GraphQLAstNode(FragmentSpreadNode::class)] class FragmentSpread extends DefinitionBlock implements ExecutableDefinitionBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, FragmentSpreadNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition); } diff --git a/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php b/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php index d05386189..2c23a6757 100644 --- a/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php @@ -25,9 +25,6 @@ final class FragmentSpreadTest extends TestCase { // // ========================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ #[DataProvider('dataProviderSerialize')] public function testSerialize( string $expected, @@ -35,7 +32,7 @@ public function testSerialize( int $level, int $used, FragmentSpreadNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); @@ -51,13 +48,12 @@ public function testSerialize( /** * @param array{types: array, directives: array} $expected - * @param (TypeNode&Node)|Type|null $type */ #[DataProvider('dataProviderStatistics')] public function testStatistics( array $expected, FragmentSpreadNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); diff --git a/packages/graphql-printer/src/Blocks/Document/InlineFragment.php b/packages/graphql-printer/src/Blocks/Document/InlineFragment.php index 4da99c34d..2d8a39560 100644 --- a/packages/graphql-printer/src/Blocks/Document/InlineFragment.php +++ b/packages/graphql-printer/src/Blocks/Document/InlineFragment.php @@ -21,13 +21,10 @@ */ #[GraphQLAstNode(InlineFragmentNode::class)] class InlineFragment extends DefinitionBlock implements ExecutableDefinitionBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, InlineFragmentNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition); diff --git a/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php b/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php index 8a3d60ce5..0443b94f2 100644 --- a/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php @@ -25,9 +25,6 @@ final class InlineFragmentTest extends TestCase { // // ========================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ #[DataProvider('dataProviderSerialize')] public function testSerialize( string $expected, @@ -35,7 +32,7 @@ public function testSerialize( int $level, int $used, InlineFragmentNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); @@ -51,13 +48,12 @@ public function testSerialize( /** * @param array{types: array, directives: array} $expected - * @param (TypeNode&Node)|Type|null $type */ #[DataProvider('dataProviderStatistics')] public function testStatistics( array $expected, InlineFragmentNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); diff --git a/packages/graphql-printer/src/Blocks/Document/InputValueDefinition.php b/packages/graphql-printer/src/Blocks/Document/InputValueDefinition.php index ca8b35397..818891767 100644 --- a/packages/graphql-printer/src/Blocks/Document/InputValueDefinition.php +++ b/packages/graphql-printer/src/Blocks/Document/InputValueDefinition.php @@ -79,10 +79,7 @@ protected function value(bool $multiline): ?Block { return $value; } - /** - * @return (TypeNode&Node)|(GraphQLType&(OutputType|InputType)) - */ - private function getType(): TypeNode|GraphQLType { + private function getType(): (TypeNode&Node)|(GraphQLType&OutputType)|(GraphQLType&InputType) { $definition = $this->getDefinition(); $type = $definition instanceof InputValueDefinitionNode ? $definition->type diff --git a/packages/graphql-printer/src/Blocks/Document/OperationDefinition.php b/packages/graphql-printer/src/Blocks/Document/OperationDefinition.php index a07b2c164..2cd520097 100644 --- a/packages/graphql-printer/src/Blocks/Document/OperationDefinition.php +++ b/packages/graphql-printer/src/Blocks/Document/OperationDefinition.php @@ -21,13 +21,10 @@ */ #[GraphQLAstNode(OperationDefinitionNode::class)] class OperationDefinition extends DefinitionBlock implements ExecutableDefinitionBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, OperationDefinitionNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition); } @@ -75,10 +72,7 @@ protected function fields(bool $multiline): ?Block { ); } - /** - * @return (TypeNode&Node)|Type|null - */ - private function getType(): TypeNode|Type|null { + private function getType(): (TypeNode&Node)|Type|null { $definition = $this->getDefinition(); $type = $this->type ?? $this->getContext()->getOperationType($definition->operation); diff --git a/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php index 2eb80ec62..b8844b358 100644 --- a/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php @@ -24,9 +24,6 @@ final class OperationDefinitionTest extends TestCase { // // ========================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ #[DataProvider('dataProviderSerialize')] public function testSerialize( string $expected, @@ -34,7 +31,7 @@ public function testSerialize( int $level, int $used, OperationDefinitionNode $definition, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ?Schema $schema, ): void { $collector = new Collector(); diff --git a/packages/graphql-printer/src/Blocks/Document/SelectionSet.php b/packages/graphql-printer/src/Blocks/Document/SelectionSet.php index 52b9b4aa1..0ebc4977e 100644 --- a/packages/graphql-printer/src/Blocks/Document/SelectionSet.php +++ b/packages/graphql-printer/src/Blocks/Document/SelectionSet.php @@ -24,13 +24,10 @@ */ #[GraphQLAstNode(SelectionSetNode::class)] class SelectionSet extends ListBlock implements ExecutableDefinitionBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, SelectionSetNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition->selections); } diff --git a/packages/graphql-printer/src/Blocks/Document/Type.php b/packages/graphql-printer/src/Blocks/Document/Type.php index de44c78bb..bf9763572 100644 --- a/packages/graphql-printer/src/Blocks/Document/Type.php +++ b/packages/graphql-printer/src/Blocks/Document/Type.php @@ -33,11 +33,11 @@ #[GraphQLDefinition(NonNull::class)] class Type extends Block implements NamedBlock { /** - * @param (TypeNode&Node)|(GraphQLType&(OutputType|InputType)) $definition + * @param (TypeNode&Node)|(GraphQLType&InputType)|(GraphQLType&OutputType) $definition fixme(phpcs): https://github.com/slevomat/coding-standard/issues/1690 */ public function __construct( Context $context, - private TypeNode|GraphQLType $definition, + private (TypeNode&Node)|(GraphQLType&OutputType)|(GraphQLType&InputType) $definition, ) { parent::__construct($context); } @@ -47,10 +47,7 @@ public function getName(): string { return $this->getTypeName($this->getDefinition()); } - /** - * @return (TypeNode&Node)|(GraphQLType&(OutputType|InputType)) - */ - protected function getDefinition(): TypeNode|GraphQLType { + protected function getDefinition(): (TypeNode&Node)|(GraphQLType&OutputType)|(GraphQLType&InputType) { return $this->definition; } @@ -69,10 +66,7 @@ protected function content(Collector $collector, int $level, int $used): string return $type; } - /** - * @param (TypeNode&Node)|GraphQLType $definition - */ - private function name(Node|GraphQLType $definition): string { + private function name((TypeNode&Node)|GraphQLType $definition): string { return match (true) { $definition instanceof NameNode => $definition->value, $definition instanceof NamedTypeNode => $this->name($definition->name), diff --git a/packages/graphql-printer/src/Blocks/Document/TypeTest.php b/packages/graphql-printer/src/Blocks/Document/TypeTest.php index 7fd84744c..6b3435110 100644 --- a/packages/graphql-printer/src/Blocks/Document/TypeTest.php +++ b/packages/graphql-printer/src/Blocks/Document/TypeTest.php @@ -29,7 +29,7 @@ final class TypeTest extends TestCase { // // ========================================================================= /** - * @param (TypeNode&Node)|(GraphQLType&(OutputType|InputType)) $type + * @param (TypeNode&Node)|(GraphQLType&InputType)|(GraphQLType&OutputType) $type fixme(phpcs): https://github.com/slevomat/coding-standard/issues/1690 */ #[DataProvider('dataProviderSerialize')] public function testSerialize( @@ -37,7 +37,7 @@ public function testSerialize( Settings $settings, int $level, int $used, - TypeNode|GraphQLType $type, + (TypeNode&Node)|(GraphQLType&OutputType)|(GraphQLType&InputType) $type, ?Schema $schema, ): void { $collector = new Collector(); diff --git a/packages/graphql-printer/src/Blocks/Document/Value.php b/packages/graphql-printer/src/Blocks/Document/Value.php index af022a05b..9395d4cfd 100644 --- a/packages/graphql-printer/src/Blocks/Document/Value.php +++ b/packages/graphql-printer/src/Blocks/Document/Value.php @@ -46,14 +46,10 @@ #[GraphQLAstNode(BooleanValueNode::class)] #[GraphQLAstNode(EnumValueNode::class)] class Value extends Block { - /** - * @param ValueNode&Node $node - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, - private ValueNode $node, - private TypeNode|Type|null $type, + private ValueNode&Node $node, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context); } diff --git a/packages/graphql-printer/src/Blocks/Document/ValueTest.php b/packages/graphql-printer/src/Blocks/Document/ValueTest.php index 3648ee14f..43a1da5da 100644 --- a/packages/graphql-printer/src/Blocks/Document/ValueTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ValueTest.php @@ -37,16 +37,13 @@ final class ValueTest extends TestCase { // // ========================================================================= - /** - * @param ValueNode&Node $node - */ #[DataProvider('dataProviderSerialize')] public function testSerialize( string $expected, Settings $settings, int $level, int $used, - ValueNode $node, + ValueNode&Node $node, ?Schema $schema, ?Type $type, ): void { diff --git a/packages/graphql-printer/src/Blocks/Factory.php b/packages/graphql-printer/src/Blocks/Factory.php index db00654d8..bcfda619d 100644 --- a/packages/graphql-printer/src/Blocks/Factory.php +++ b/packages/graphql-printer/src/Blocks/Factory.php @@ -81,10 +81,7 @@ * @internal */ class Factory { - /** - * @param (TypeNode&Node)|GraphQLType|null $type - */ - public static function create(Context $context, object $definition, TypeNode|GraphQLType|null $type): Block { + public static function create(Context $context, object $definition, (TypeNode&Node)|GraphQLType|null $type): Block { return match (true) { $definition instanceof ObjectTypeDefinitionNode, $definition instanceof ObjectType diff --git a/packages/graphql-printer/src/Blocks/Printer/PrintableBlock.php b/packages/graphql-printer/src/Blocks/Printer/PrintableBlock.php index d19935d74..917df4632 100644 --- a/packages/graphql-printer/src/Blocks/Printer/PrintableBlock.php +++ b/packages/graphql-printer/src/Blocks/Printer/PrintableBlock.php @@ -27,13 +27,12 @@ class PrintableBlock extends Block implements NamedBlock { private Block $block; /** - * @param TDefinition $definition - * @param (TypeNode&Node)|GraphQLType|null $type + * @param TDefinition $definition */ public function __construct( Context $context, private object $definition, - private TypeNode|GraphQLType|null $type = null, + private (TypeNode&Node)|GraphQLType|null $type = null, ) { parent::__construct($context); @@ -59,10 +58,7 @@ public function getDefinition(): object { return $this->definition; } - /** - * @return (TypeNode&Node)|GraphQLType|null - */ - public function getType(): TypeNode|GraphQLType|null { + public function getType(): (TypeNode&Node)|GraphQLType|null { return $this->type; } diff --git a/packages/graphql-printer/src/Blocks/Values/ListValue.php b/packages/graphql-printer/src/Blocks/Values/ListValue.php index de367baf4..efbc64b72 100644 --- a/packages/graphql-printer/src/Blocks/Values/ListValue.php +++ b/packages/graphql-printer/src/Blocks/Values/ListValue.php @@ -18,13 +18,10 @@ * @extends ListBlock */ class ListValue extends ListBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, ListValueNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition->values); } diff --git a/packages/graphql-printer/src/Blocks/Values/ObjectField.php b/packages/graphql-printer/src/Blocks/Values/ObjectField.php index e1a4ccf32..56f4c2096 100644 --- a/packages/graphql-printer/src/Blocks/Values/ObjectField.php +++ b/packages/graphql-printer/src/Blocks/Values/ObjectField.php @@ -19,13 +19,10 @@ * @internal */ class ObjectField extends Block implements NamedBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, private ObjectFieldNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context); } diff --git a/packages/graphql-printer/src/Blocks/Values/ObjectValue.php b/packages/graphql-printer/src/Blocks/Values/ObjectValue.php index bebe95559..debec93ad 100644 --- a/packages/graphql-printer/src/Blocks/Values/ObjectValue.php +++ b/packages/graphql-printer/src/Blocks/Values/ObjectValue.php @@ -17,13 +17,10 @@ * @extends ListBlock */ class ObjectValue extends ListBlock { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( Context $context, ObjectValueNode $definition, - private TypeNode|Type|null $type, + private (TypeNode&Node)|Type|null $type, ) { parent::__construct($context, $definition->fields); } diff --git a/packages/graphql-printer/src/Contracts/Printer.php b/packages/graphql-printer/src/Contracts/Printer.php index a143952eb..ae1b949fd 100644 --- a/packages/graphql-printer/src/Contracts/Printer.php +++ b/packages/graphql-printer/src/Contracts/Printer.php @@ -21,14 +21,12 @@ interface Printer { * - for some AST node types, their type may also be required * * @see self::setSchema() - * - * @param (TypeNode&Node)|Type|null $type */ public function print( Node|Type|Directive|FieldDefinition|Argument|EnumValueDefinition|InputObjectField|Schema $printable, int $level = 0, int $used = 0, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ): Result; /** @@ -42,14 +40,12 @@ public function print( * - for some AST node types, their type may also be required * * @see self::setSchema() - * - * @param (TypeNode&Node)|Type|null $type */ public function export( Node|Type|Directive|FieldDefinition|Argument|EnumValueDefinition|InputObjectField|Schema $printable, int $level = 0, int $used = 0, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ): Result; public function getSettings(): Settings; diff --git a/packages/graphql-printer/src/Exceptions/DirectiveArgumentNotFound.php b/packages/graphql-printer/src/Exceptions/DirectiveArgumentNotFound.php index 4d5192618..f2111992b 100644 --- a/packages/graphql-printer/src/Exceptions/DirectiveArgumentNotFound.php +++ b/packages/graphql-printer/src/Exceptions/DirectiveArgumentNotFound.php @@ -11,7 +11,7 @@ class DirectiveArgumentNotFound extends PackageException { public function __construct( protected string $directive, protected string $argument, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Exceptions/DirectiveDefinitionNotFound.php b/packages/graphql-printer/src/Exceptions/DirectiveDefinitionNotFound.php index cad50defb..ff1ade514 100644 --- a/packages/graphql-printer/src/Exceptions/DirectiveDefinitionNotFound.php +++ b/packages/graphql-printer/src/Exceptions/DirectiveDefinitionNotFound.php @@ -10,7 +10,7 @@ class DirectiveDefinitionNotFound extends PackageException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Exceptions/FieldArgumentNotFound.php b/packages/graphql-printer/src/Exceptions/FieldArgumentNotFound.php index 649a96be6..cb3a1f164 100644 --- a/packages/graphql-printer/src/Exceptions/FieldArgumentNotFound.php +++ b/packages/graphql-printer/src/Exceptions/FieldArgumentNotFound.php @@ -12,7 +12,7 @@ public function __construct( protected string $type, protected string $field, protected string $argument, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Exceptions/FieldNotFound.php b/packages/graphql-printer/src/Exceptions/FieldNotFound.php index 84bc62f46..a544dec0e 100644 --- a/packages/graphql-printer/src/Exceptions/FieldNotFound.php +++ b/packages/graphql-printer/src/Exceptions/FieldNotFound.php @@ -11,7 +11,7 @@ class FieldNotFound extends PackageException { public function __construct( protected string $type, protected string $field, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Exceptions/TypeNotFound.php b/packages/graphql-printer/src/Exceptions/TypeNotFound.php index 74cee7cd0..ea722aa65 100644 --- a/packages/graphql-printer/src/Exceptions/TypeNotFound.php +++ b/packages/graphql-printer/src/Exceptions/TypeNotFound.php @@ -10,7 +10,7 @@ class TypeNotFound extends PackageException { public function __construct( protected string $type, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Exceptions/Unsupported.php b/packages/graphql-printer/src/Exceptions/Unsupported.php index f504608ea..c61a4d550 100644 --- a/packages/graphql-printer/src/Exceptions/Unsupported.php +++ b/packages/graphql-printer/src/Exceptions/Unsupported.php @@ -10,7 +10,7 @@ class Unsupported extends PackageException { public function __construct( protected object $definition, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql-printer/src/Misc/Context.php b/packages/graphql-printer/src/Misc/Context.php index 2aac9951b..1684dfa1b 100644 --- a/packages/graphql-printer/src/Misc/Context.php +++ b/packages/graphql-printer/src/Misc/Context.php @@ -99,10 +99,7 @@ public function getOperationsDefaultTypes(): array { ]; } - /** - * @return (Type&NamedType)|null - */ - public function getOperationType(string $operation): ?Type { + public function getOperationType(string $operation): (Type&NamedType)|null { $type = $this->getSchema()?->getOperationType($operation); if (!$type && $this->getSchema()) { @@ -122,10 +119,7 @@ public function getTypes(): array { return (array) $this->getSchema()?->getTypeMap(); } - /** - * @return (Type&NamedType)|null - */ - public function getType(string $name): ?Type { + public function getType(string $name): (Type&NamedType)|null { $type = $this->getSchema()?->getType($name); if (!$type && $this->getSchema()) { @@ -190,10 +184,7 @@ protected function isTypeBuiltIn(string $type): bool { return array_key_exists($type, Type::builtInTypes()); } - /** - * @param (TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type - */ - public function getTypeName(TypeDefinitionNode|TypeNode|Type $type): string { + public function getTypeName((TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type): string { $name = null; if ($type instanceof WrappingType) { @@ -335,10 +326,7 @@ public function getDirectiveArgument(DirectiveNode $object, string $name): Input // // ========================================================================= - /** - * @param (TypeNode&Node)|Type $object - */ - public function getField(TypeNode|Type $object, string $name): InputObjectField|FieldDefinition|null { + public function getField((TypeNode&Node)|Type $object, string $name): InputObjectField|FieldDefinition|null { $field = null; $type = $this->getTypeName($object); $definition = $this->getType($type); @@ -354,10 +342,7 @@ public function getField(TypeNode|Type $object, string $name): InputObjectField| return $field; } - /** - * @param (TypeNode&Node)|Type $object - */ - public function getFieldArgument(TypeNode|Type $object, string $field, string $name): ?Argument { + public function getFieldArgument((TypeNode&Node)|Type $object, string $field, string $name): ?Argument { $argument = null; $definition = $this->getField($object, $field); diff --git a/packages/graphql-printer/src/Misc/IntrospectionContext.php b/packages/graphql-printer/src/Misc/IntrospectionContext.php index a1d71377b..c97552a78 100644 --- a/packages/graphql-printer/src/Misc/IntrospectionContext.php +++ b/packages/graphql-printer/src/Misc/IntrospectionContext.php @@ -20,11 +20,8 @@ public function getTypes(): array { return Introspection::getTypes(); } - /** - * @return (Type&NamedType)|null - */ #[Override] - public function getType(string $name): ?Type { + public function getType(string $name): (Type&NamedType)|null { return $this->getTypes()[$name] ?? null; } diff --git a/packages/graphql-printer/src/PackageException.php b/packages/graphql-printer/src/PackageException.php index a76ef2042..406ab908c 100644 --- a/packages/graphql-printer/src/PackageException.php +++ b/packages/graphql-printer/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message = '', Throwable $previous = null) { + public function __construct(string $message = '', ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/graphql-printer/src/Printer.php b/packages/graphql-printer/src/Printer.php index 8923fd96e..4e79e768a 100644 --- a/packages/graphql-printer/src/Printer.php +++ b/packages/graphql-printer/src/Printer.php @@ -38,7 +38,7 @@ class Printer implements PrinterContract { private ?Schema $schema = null; public function __construct( - Settings $settings = null, + ?Settings $settings = null, ?DirectiveResolver $directiveResolver = null, ?Schema $schema = null, ) { @@ -88,15 +88,12 @@ public function setSchema(?Schema $schema): static { // // ========================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ #[Override] public function print( Node|Type|Directive|FieldDefinition|Argument|EnumValueDefinition|InputObjectField|Schema $printable, int $level = 0, int $used = 0, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ): Result { // Schema? if ($printable instanceof Schema) { @@ -113,15 +110,12 @@ public function print( return $printed; } - /** - * @param (TypeNode&Node)|Type|null $type - */ #[Override] public function export( Node|Type|Directive|FieldDefinition|Argument|EnumValueDefinition|InputObjectField|Schema $printable, int $level = 0, int $used = 0, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ): Result { // Exportable? if (!$this->isExportable($printable)) { @@ -160,13 +154,10 @@ protected function getContext(?Schema $schema): Context { return new Context($this->getSettings(), $this->getDirectiveResolver(), $schema); } - /** - * @param (TypeNode&Node)|Type|null $type - */ protected function getBlock( Context $context, Node|Type|Directive|FieldDefinition|Argument|EnumValueDefinition|InputObjectField|Schema $definition, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ): Block { return new PrintableBlock($context, $definition, $type); } @@ -174,7 +165,7 @@ protected function getBlock( /** * @return Block&ArrayAccess */ - protected function getList(Context $context, bool $root = false, bool $eof = true): Block { + protected function getList(Context $context, bool $root = false, bool $eof = true): Block&ArrayAccess { return new PrintableList($context, $root, $eof); } @@ -186,10 +177,10 @@ protected function getList(Context $context, bool $root = false, bool $eof = tru protected function process( Collector $collector, Context $context, - Block $root, + Block&ArrayAccess $root, int $level, int $used, - ): Block { + ): Block&ArrayAccess { $root = $this->analyze($collector, $root, $level, $used); $stack = $collector->getUsedDirectives() + $collector->getUsedTypes(); $output = $this->getList($context); diff --git a/packages/graphql-printer/src/PrinterTest.php b/packages/graphql-printer/src/PrinterTest.php index 5fd42802d..fc5bcc312 100644 --- a/packages/graphql-printer/src/PrinterTest.php +++ b/packages/graphql-printer/src/PrinterTest.php @@ -50,7 +50,7 @@ public function testPrint( int $used, Closure $schemaFactory, Closure $printableFactory, - Closure $typeFactory = null, + ?Closure $typeFactory = null, ): void { $schema = $schemaFactory($this); $printer = new Printer($settings, null, $schema); @@ -79,7 +79,7 @@ public function testExport( int $used, Closure $schemaFactory, Closure $exportableFactory, - Closure $typeFactory = null, + ?Closure $typeFactory = null, ): void { $schema = $schemaFactory($this); $printer = new Printer($settings, null, $schema); diff --git a/packages/graphql-printer/src/Testing/GraphQLAssertions.php b/packages/graphql-printer/src/Testing/GraphQLAssertions.php index 472dc4446..b46d206b4 100644 --- a/packages/graphql-printer/src/Testing/GraphQLAssertions.php +++ b/packages/graphql-printer/src/Testing/GraphQLAssertions.php @@ -157,7 +157,7 @@ private function assertGraphQLExpectation( // // ========================================================================= - protected function getGraphQLPrinter(Settings $settings = null): PrinterContract { + protected function getGraphQLPrinter(?Settings $settings = null): PrinterContract { return new Printer($settings ?? new TestSettings()); } // diff --git a/packages/graphql/README.md b/packages/graphql/README.md index a8ca2e598..492d9499e 100644 --- a/packages/graphql/README.md +++ b/packages/graphql/README.md @@ -12,7 +12,7 @@ This package provides highly powerful `@searchBy`, `@sortBy`, `@stream` directiv |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.5.0` | diff --git a/packages/graphql/UPGRADE.md b/packages/graphql/UPGRADE.md index 9e70e0af2..f4ccd8c90 100644 --- a/packages/graphql/UPGRADE.md +++ b/packages/graphql/UPGRADE.md @@ -41,6 +41,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/graphql/composer.json b/packages/graphql/composer.json index daa4bb6f0..cc0aef5bb 100644 --- a/packages/graphql/composer.json +++ b/packages/graphql/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-filter": "*", "ext-mbstring": "*", "composer/semver": "^3.2", @@ -40,7 +40,7 @@ "ext-pdo_sqlite": "*", "illuminate/cache": "^10.34.0|^11.0.0", "laravel/scout": "^9.8.0|^10.0.0", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "phpunit/phpunit": "^10.1.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", "orchestra/testbench": "^8.0.0|^9.0.0" diff --git a/packages/graphql/metadata.json b/packages/graphql/metadata.json index cb92551ba..d3c82a7b9 100644 --- a/packages/graphql/metadata.json +++ b/packages/graphql/metadata.json @@ -17,8 +17,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/graphql/src/Builder/Contracts/Enhancer.php b/packages/graphql/src/Builder/Contracts/Enhancer.php index adb1535ec..301087e6e 100644 --- a/packages/graphql/src/Builder/Contracts/Enhancer.php +++ b/packages/graphql/src/Builder/Contracts/Enhancer.php @@ -17,7 +17,7 @@ interface Enhancer { public function enhance( object $builder, ArgumentSet|Argument $value, - Field $field = null, - Context $context = null, + ?Field $field = null, + ?Context $context = null, ): object; } diff --git a/packages/graphql/src/Builder/Contracts/TypeDefinition.php b/packages/graphql/src/Builder/Contracts/TypeDefinition.php index 261972d38..c3e07a22e 100644 --- a/packages/graphql/src/Builder/Contracts/TypeDefinition.php +++ b/packages/graphql/src/Builder/Contracts/TypeDefinition.php @@ -25,5 +25,5 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null; + ): (TypeDefinitionNode&Node)|string|null; } diff --git a/packages/graphql/src/Builder/Contracts/TypeProvider.php b/packages/graphql/src/Builder/Contracts/TypeProvider.php index 93dec50d6..48b5642cb 100644 --- a/packages/graphql/src/Builder/Contracts/TypeProvider.php +++ b/packages/graphql/src/Builder/Contracts/TypeProvider.php @@ -13,8 +13,5 @@ interface TypeProvider { */ public function getType(string $definition, TypeSource $source, Context $context): string; - /** - * @param (TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type - */ - public function getTypeSource(TypeDefinitionNode|TypeNode|Type $type): TypeSource; + public function getTypeSource((TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type): TypeSource; } diff --git a/packages/graphql/src/Builder/Contracts/TypeSource.php b/packages/graphql/src/Builder/Contracts/TypeSource.php index 37abc563e..e0540cf23 100644 --- a/packages/graphql/src/Builder/Contracts/TypeSource.php +++ b/packages/graphql/src/Builder/Contracts/TypeSource.php @@ -9,17 +9,11 @@ use Stringable; interface TypeSource extends Stringable { - /** - * @return (TypeDefinitionNode&Node)|(TypeNode&Node)|Type - */ - public function getType(): TypeDefinitionNode|TypeNode|Type; + public function getType(): (TypeDefinitionNode&Node)|(TypeNode&Node)|Type; public function getTypeName(): string; - /** - * @return (TypeDefinitionNode&Node)|Type - */ - public function getTypeDefinition(): TypeDefinitionNode|Type; + public function getTypeDefinition(): (TypeDefinitionNode&Node)|Type; public function isNullable(): bool; diff --git a/packages/graphql/src/Builder/Directives/HandlerDirective.php b/packages/graphql/src/Builder/Directives/HandlerDirective.php index b6096a422..64611b957 100644 --- a/packages/graphql/src/Builder/Directives/HandlerDirective.php +++ b/packages/graphql/src/Builder/Directives/HandlerDirective.php @@ -90,8 +90,8 @@ public function handleScoutBuilder(ScoutBuilder $builder, mixed $value): ScoutBu protected function handleAnyBuilder( object $builder, mixed $value, - Field $field = null, - ContextContract $context = null, + ?Field $field = null, + ?ContextContract $context = null, ): object { if ($value !== null && $this->definitionNode instanceof InputValueDefinitionNode) { $argument = !($value instanceof Argument) @@ -107,8 +107,8 @@ protected function handleAnyBuilder( public function enhance( object $builder, ArgumentSet|Argument $value, - Field $field = null, - ContextContract $context = null, + ?Field $field = null, + ?ContextContract $context = null, ): object { $field ??= new Field(); $context ??= new Context(); diff --git a/packages/graphql/src/Builder/Exceptions/BuilderUnknown.php b/packages/graphql/src/Builder/Exceptions/BuilderUnknown.php index 1b07a6f85..81ce10d68 100644 --- a/packages/graphql/src/Builder/Exceptions/BuilderUnknown.php +++ b/packages/graphql/src/Builder/Exceptions/BuilderUnknown.php @@ -10,7 +10,7 @@ class BuilderUnknown extends BuilderException { public function __construct( protected Stringable|string|null $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/Client/ConditionEmpty.php b/packages/graphql/src/Builder/Exceptions/Client/ConditionEmpty.php index c01c59583..58ad45a13 100644 --- a/packages/graphql/src/Builder/Exceptions/Client/ConditionEmpty.php +++ b/packages/graphql/src/Builder/Exceptions/Client/ConditionEmpty.php @@ -5,7 +5,7 @@ use Throwable; class ConditionEmpty extends ClientException { - public function __construct(Throwable $previous = null) { + public function __construct(?Throwable $previous = null) { parent::__construct('Condition cannot be empty.', $previous); } } diff --git a/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyFields.php b/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyFields.php index db8f027d3..107e5b680 100644 --- a/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyFields.php +++ b/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyFields.php @@ -14,7 +14,7 @@ class ConditionTooManyFields extends ClientException { */ public function __construct( protected readonly array $fields, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyOperators.php b/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyOperators.php index 60cad713d..9cb73a56b 100644 --- a/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyOperators.php +++ b/packages/graphql/src/Builder/Exceptions/Client/ConditionTooManyOperators.php @@ -14,7 +14,7 @@ class ConditionTooManyOperators extends ClientException { */ public function __construct( protected array $operators, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionIsNotFake.php b/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionIsNotFake.php index 34f98fbee..d3903c64a 100644 --- a/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionIsNotFake.php +++ b/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionIsNotFake.php @@ -9,7 +9,7 @@ class FakeTypeDefinitionIsNotFake extends BuilderException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionUnknown.php b/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionUnknown.php index 136f3a5db..a8ea3e9cc 100644 --- a/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionUnknown.php +++ b/packages/graphql/src/Builder/Exceptions/FakeTypeDefinitionUnknown.php @@ -9,7 +9,7 @@ class FakeTypeDefinitionUnknown extends BuilderException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/HandlerInvalidConditions.php b/packages/graphql/src/Builder/Exceptions/HandlerInvalidConditions.php index 322472a90..923976d5b 100644 --- a/packages/graphql/src/Builder/Exceptions/HandlerInvalidConditions.php +++ b/packages/graphql/src/Builder/Exceptions/HandlerInvalidConditions.php @@ -10,7 +10,7 @@ class HandlerInvalidConditions extends BuilderException { public function __construct( protected Handler $handler, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/OperatorImpossibleToCreateField.php b/packages/graphql/src/Builder/Exceptions/OperatorImpossibleToCreateField.php index d8d13434a..d328b0744 100644 --- a/packages/graphql/src/Builder/Exceptions/OperatorImpossibleToCreateField.php +++ b/packages/graphql/src/Builder/Exceptions/OperatorImpossibleToCreateField.php @@ -14,7 +14,7 @@ public function __construct( protected Operator $operator, protected Stringable|string $source, protected Context $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/OperatorUnsupportedBuilder.php b/packages/graphql/src/Builder/Exceptions/OperatorUnsupportedBuilder.php index cd649b30c..2ebbdc99b 100644 --- a/packages/graphql/src/Builder/Exceptions/OperatorUnsupportedBuilder.php +++ b/packages/graphql/src/Builder/Exceptions/OperatorUnsupportedBuilder.php @@ -11,7 +11,7 @@ class OperatorUnsupportedBuilder extends BuilderException { public function __construct( protected Operator $operator, protected object $builder, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/TypeDefinitionFieldAlreadyDefined.php b/packages/graphql/src/Builder/Exceptions/TypeDefinitionFieldAlreadyDefined.php index 82ce21f57..cc092027d 100644 --- a/packages/graphql/src/Builder/Exceptions/TypeDefinitionFieldAlreadyDefined.php +++ b/packages/graphql/src/Builder/Exceptions/TypeDefinitionFieldAlreadyDefined.php @@ -9,7 +9,7 @@ class TypeDefinitionFieldAlreadyDefined extends BuilderException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/TypeDefinitionImpossibleToCreateType.php b/packages/graphql/src/Builder/Exceptions/TypeDefinitionImpossibleToCreateType.php index 5a2687abb..993c5046e 100644 --- a/packages/graphql/src/Builder/Exceptions/TypeDefinitionImpossibleToCreateType.php +++ b/packages/graphql/src/Builder/Exceptions/TypeDefinitionImpossibleToCreateType.php @@ -17,7 +17,7 @@ public function __construct( protected string $definition, protected Stringable|string $source, protected Context $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/TypeDefinitionInvalidTypeName.php b/packages/graphql/src/Builder/Exceptions/TypeDefinitionInvalidTypeName.php index 93200bb1f..e05d2a838 100644 --- a/packages/graphql/src/Builder/Exceptions/TypeDefinitionInvalidTypeName.php +++ b/packages/graphql/src/Builder/Exceptions/TypeDefinitionInvalidTypeName.php @@ -17,7 +17,7 @@ public function __construct( protected string $expected, protected string $actual, protected Context $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Exceptions/TypeDefinitionIsNotScalarExtension.php b/packages/graphql/src/Builder/Exceptions/TypeDefinitionIsNotScalarExtension.php index 4d9640660..e0dc3ac07 100644 --- a/packages/graphql/src/Builder/Exceptions/TypeDefinitionIsNotScalarExtension.php +++ b/packages/graphql/src/Builder/Exceptions/TypeDefinitionIsNotScalarExtension.php @@ -10,7 +10,7 @@ class TypeDefinitionIsNotScalarExtension extends BuilderException { public function __construct( protected string $name, protected string $extension, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Builder/Manipulator.php b/packages/graphql/src/Builder/Manipulator.php index a46dad2cb..1675ea208 100644 --- a/packages/graphql/src/Builder/Manipulator.php +++ b/packages/graphql/src/Builder/Manipulator.php @@ -97,7 +97,7 @@ public function getType(string $definition, TypeSource $source, Context $context } #[Override] - public function getTypeSource(TypeDefinitionNode|TypeNode|Type $type): TypeSource { + public function getTypeSource((TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type): TypeSource { $source = null; if ($type instanceof InputObjectTypeDefinitionNode || $type instanceof InputObjectType) { @@ -119,17 +119,16 @@ public function getTypeSource(TypeDefinitionNode|TypeNode|Type $type): TypeSourc /** * @template T of Operator * - * @param Node|(TypeDefinitionNode&Node)|Type|InputObjectField|FieldDefinition|Argument $node - * @param class-string $operator + * @param class-string $operator * * @return (T&Directive)|null */ public function getOperatorDirective( - Node|TypeDefinitionNode|Type|InputObjectField|FieldDefinition|Argument $node, + Node|Type|InputObjectField|FieldDefinition|Argument $node, string $operator, TypeSource $source, Context $context, - ): ?Operator { + ): (Operator&Directive)|null { // Operators? $provider = $context->get(HandlerContextOperators::class)?->value; diff --git a/packages/graphql/src/Builder/Scalars/Internal.php b/packages/graphql/src/Builder/Scalars/Internal.php index ad16e2878..f649d80c0 100644 --- a/packages/graphql/src/Builder/Scalars/Internal.php +++ b/packages/graphql/src/Builder/Scalars/Internal.php @@ -27,7 +27,7 @@ public function parseValue(mixed $value): mixed { * @inheritDoc */ #[Override] - public function parseLiteral(Node $valueNode, array $variables = null): mixed { + public function parseLiteral(Node $valueNode, ?array $variables = null): mixed { $this->error(Error::class); } diff --git a/packages/graphql/src/Builder/Sources/InputFieldSource.php b/packages/graphql/src/Builder/Sources/InputFieldSource.php index b1a460420..9f5373b09 100644 --- a/packages/graphql/src/Builder/Sources/InputFieldSource.php +++ b/packages/graphql/src/Builder/Sources/InputFieldSource.php @@ -21,14 +21,11 @@ class InputFieldSource extends Source { use Field; - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( AstManipulator $manipulator, InputSource $parent, private InputValueDefinitionNode|InputObjectField $field, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ) { parent::__construct( $manipulator, diff --git a/packages/graphql/src/Builder/Sources/InputSource.php b/packages/graphql/src/Builder/Sources/InputSource.php index d682b1a08..d8e8f89ab 100644 --- a/packages/graphql/src/Builder/Sources/InputSource.php +++ b/packages/graphql/src/Builder/Sources/InputSource.php @@ -14,12 +14,9 @@ * @extends Source */ class InputSource extends Source { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function getField( InputValueDefinitionNode|InputObjectField $field, - TypeNode|Type $type = null, + (TypeNode&Node)|Type|null $type = null, ): InputFieldSource { return new InputFieldSource($this->getManipulator(), $this, $field, $type); } diff --git a/packages/graphql/src/Builder/Sources/InterfaceFieldArgumentSource.php b/packages/graphql/src/Builder/Sources/InterfaceFieldArgumentSource.php index 1b9a8c12b..51360e3b6 100644 --- a/packages/graphql/src/Builder/Sources/InterfaceFieldArgumentSource.php +++ b/packages/graphql/src/Builder/Sources/InterfaceFieldArgumentSource.php @@ -20,14 +20,11 @@ class InterfaceFieldArgumentSource extends Source { use FieldArgument; - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( AstManipulator $manipulator, InterfaceFieldSource $parent, private InputValueDefinitionNode|Argument $argument, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ) { parent::__construct( $manipulator, diff --git a/packages/graphql/src/Builder/Sources/InterfaceFieldSource.php b/packages/graphql/src/Builder/Sources/InterfaceFieldSource.php index 9672aaca4..ba7dc998a 100644 --- a/packages/graphql/src/Builder/Sources/InterfaceFieldSource.php +++ b/packages/graphql/src/Builder/Sources/InterfaceFieldSource.php @@ -20,14 +20,11 @@ class InterfaceFieldSource extends Source { use Field; - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( AstManipulator $manipulator, InterfaceSource $parent, private FieldDefinitionNode|FieldDefinition $field, - TypeNode|Type|null $type, + (TypeNode&Node)|Type|null $type, ) { parent::__construct( $manipulator, @@ -49,12 +46,9 @@ public function getField(): FieldDefinition|FieldDefinitionNode { // // ================================================================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ public function getArgument( InputValueDefinitionNode|Argument $argument, - TypeNode|Type $type = null, + (TypeNode&Node)|Type|null $type = null, ): InterfaceFieldArgumentSource { return new InterfaceFieldArgumentSource($this->getManipulator(), $this, $argument, $type); } diff --git a/packages/graphql/src/Builder/Sources/InterfaceSource.php b/packages/graphql/src/Builder/Sources/InterfaceSource.php index d38d5ed21..7b89565b0 100644 --- a/packages/graphql/src/Builder/Sources/InterfaceSource.php +++ b/packages/graphql/src/Builder/Sources/InterfaceSource.php @@ -14,12 +14,9 @@ * @extends Source */ class InterfaceSource extends Source { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function getField( FieldDefinitionNode|FieldDefinition $field, - TypeNode|Type $type = null, + (TypeNode&Node)|Type|null $type = null, ): InterfaceFieldSource { return new InterfaceFieldSource($this->getManipulator(), $this, $field, $type); } diff --git a/packages/graphql/src/Builder/Sources/ObjectFieldArgumentSource.php b/packages/graphql/src/Builder/Sources/ObjectFieldArgumentSource.php index e7dcce0a6..f1dd9b2a5 100644 --- a/packages/graphql/src/Builder/Sources/ObjectFieldArgumentSource.php +++ b/packages/graphql/src/Builder/Sources/ObjectFieldArgumentSource.php @@ -20,14 +20,11 @@ class ObjectFieldArgumentSource extends Source { use FieldArgument; - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( AstManipulator $manipulator, ObjectFieldSource $parent, private InputValueDefinitionNode|Argument $argument, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ) { parent::__construct( $manipulator, diff --git a/packages/graphql/src/Builder/Sources/ObjectFieldSource.php b/packages/graphql/src/Builder/Sources/ObjectFieldSource.php index 34d139cf3..f976dc8ad 100644 --- a/packages/graphql/src/Builder/Sources/ObjectFieldSource.php +++ b/packages/graphql/src/Builder/Sources/ObjectFieldSource.php @@ -20,14 +20,11 @@ class ObjectFieldSource extends Source { use Field; - /** - * @param (TypeNode&Node)|Type|null $type - */ public function __construct( AstManipulator $manipulator, ObjectSource $parent, private FieldDefinitionNode|FieldDefinition $field, - TypeNode|Type|null $type = null, + (TypeNode&Node)|Type|null $type = null, ) { parent::__construct( $manipulator, @@ -49,12 +46,9 @@ public function getField(): FieldDefinition|FieldDefinitionNode { // // ================================================================================================================= - /** - * @param (TypeNode&Node)|Type|null $type - */ public function getArgument( InputValueDefinitionNode|Argument $argument, - TypeNode|Type $type = null, + (TypeNode&Node)|Type|null $type = null, ): ObjectFieldArgumentSource { return new ObjectFieldArgumentSource($this->getManipulator(), $this, $argument, $type); } diff --git a/packages/graphql/src/Builder/Sources/ObjectSource.php b/packages/graphql/src/Builder/Sources/ObjectSource.php index 8bc080d45..0547dfc0d 100644 --- a/packages/graphql/src/Builder/Sources/ObjectSource.php +++ b/packages/graphql/src/Builder/Sources/ObjectSource.php @@ -14,12 +14,9 @@ * @extends Source */ class ObjectSource extends Source { - /** - * @param (TypeNode&Node)|Type|null $type - */ public function getField( FieldDefinitionNode|FieldDefinition $field, - TypeNode|Type $type = null, + (TypeNode&Node)|Type|null $type = null, ): ObjectFieldSource { return new ObjectFieldSource($this->getManipulator(), $this, $field, $type); } diff --git a/packages/graphql/src/Builder/Sources/Source.php b/packages/graphql/src/Builder/Sources/Source.php index db5fe112e..68bc0db9a 100644 --- a/packages/graphql/src/Builder/Sources/Source.php +++ b/packages/graphql/src/Builder/Sources/Source.php @@ -21,7 +21,7 @@ class Source implements TypeSource { */ public function __construct( private AstManipulator $manipulator, - private TypeDefinitionNode|TypeNode|Type $type, + private (TypeDefinitionNode&Node)|(TypeNode&Node)|Type $type, private TypeSource|null $parent = null, ) { // empty @@ -47,7 +47,7 @@ public function getParent(): ?TypeSource { * @return TType */ #[Override] - public function getType(): TypeDefinitionNode|TypeNode|Type { + public function getType(): (TypeDefinitionNode&Node)|(TypeNode&Node)|Type { return $this->type; } @@ -56,11 +56,8 @@ public function getTypeName(): string { return $this->getManipulator()->getTypeName($this->getType()); } - /** - * @return (TypeDefinitionNode&Node)|Type - */ #[Override] - public function getTypeDefinition(): TypeDefinitionNode|Type { + public function getTypeDefinition(): (TypeDefinitionNode&Node)|Type { return $this->getManipulator()->getTypeDefinition($this->getType()); } diff --git a/packages/graphql/src/Builder/Types/InputObject.php b/packages/graphql/src/Builder/Types/InputObject.php index 74131e754..14f06b625 100644 --- a/packages/graphql/src/Builder/Types/InputObject.php +++ b/packages/graphql/src/Builder/Types/InputObject.php @@ -5,6 +5,7 @@ use GraphQL\Language\AST\DirectiveNode; use GraphQL\Language\AST\FieldDefinitionNode; use GraphQL\Language\AST\InputValueDefinitionNode; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\StringValueNode; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\BlockString; @@ -60,7 +61,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { // Source? $source = $manipulator->getTypeSource($source->getTypeDefinition()); diff --git a/packages/graphql/src/Directives/Type.php b/packages/graphql/src/Directives/Type.php index 83e1354e5..db8267e72 100644 --- a/packages/graphql/src/Directives/Type.php +++ b/packages/graphql/src/Directives/Type.php @@ -65,11 +65,8 @@ public static function definition(): string { GRAPHQL; } - /** - * @return GraphQLType&NamedType - */ #[Override] - public function resolveNode(TypeValue $value): GraphQLType { + public function resolveNode(TypeValue $value): GraphQLType&NamedType { // Type? $class = Cast::toString($this->directiveArgValue(self::ArgClass)); $node = Cast::to(ScalarTypeDefinitionNode::class, $value->getTypeDefinition()); diff --git a/packages/graphql/src/Exceptions/ArgumentAlreadyDefined.php b/packages/graphql/src/Exceptions/ArgumentAlreadyDefined.php index 4639ec180..952638437 100644 --- a/packages/graphql/src/Exceptions/ArgumentAlreadyDefined.php +++ b/packages/graphql/src/Exceptions/ArgumentAlreadyDefined.php @@ -10,7 +10,7 @@ class ArgumentAlreadyDefined extends AstException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Exceptions/NotImplemented.php b/packages/graphql/src/Exceptions/NotImplemented.php index 2553214d2..8f528284e 100644 --- a/packages/graphql/src/Exceptions/NotImplemented.php +++ b/packages/graphql/src/Exceptions/NotImplemented.php @@ -11,7 +11,7 @@ class NotImplemented extends PackageException { public function __construct( protected Stringable|string $feature, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Exceptions/TypeDefinitionAlreadyDefined.php b/packages/graphql/src/Exceptions/TypeDefinitionAlreadyDefined.php index 92bd82eeb..691b7b781 100644 --- a/packages/graphql/src/Exceptions/TypeDefinitionAlreadyDefined.php +++ b/packages/graphql/src/Exceptions/TypeDefinitionAlreadyDefined.php @@ -9,7 +9,7 @@ class TypeDefinitionAlreadyDefined extends AstException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Type Definition `%s` already defined.', diff --git a/packages/graphql/src/Exceptions/TypeDefinitionUnknown.php b/packages/graphql/src/Exceptions/TypeDefinitionUnknown.php index 6daa0cfbf..5a5832376 100644 --- a/packages/graphql/src/Exceptions/TypeDefinitionUnknown.php +++ b/packages/graphql/src/Exceptions/TypeDefinitionUnknown.php @@ -9,7 +9,7 @@ class TypeDefinitionUnknown extends AstException { public function __construct( protected string $name, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Type Definition `%s` is not defined.', diff --git a/packages/graphql/src/Exceptions/TypeUnexpected.php b/packages/graphql/src/Exceptions/TypeUnexpected.php index 8c917d552..d110439ae 100644 --- a/packages/graphql/src/Exceptions/TypeUnexpected.php +++ b/packages/graphql/src/Exceptions/TypeUnexpected.php @@ -11,7 +11,7 @@ class TypeUnexpected extends AstException { public function __construct( protected Stringable|string $source, protected Stringable|string $expected, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/PackageException.php b/packages/graphql/src/PackageException.php index 334007e34..8a524c1ee 100644 --- a/packages/graphql/src/PackageException.php +++ b/packages/graphql/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message = '', Throwable $previous = null) { + public function __construct(string $message = '', ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/graphql/src/Printer/DirectiveResolver.php b/packages/graphql/src/Printer/DirectiveResolver.php index 9ad1d0b32..b5613b52f 100644 --- a/packages/graphql/src/Printer/DirectiveResolver.php +++ b/packages/graphql/src/Printer/DirectiveResolver.php @@ -94,10 +94,7 @@ private function getDirectiveClass(string $name): ?string { } } - /** - * @param TypeDefinitionNode&Node $definition - */ - private function registerDirectiveType(TypeDefinitionNode $definition): void { + private function registerDirectiveType(TypeDefinitionNode&Node $definition): void { $name = $definition->getName()->value; $type = null; diff --git a/packages/graphql/src/Printer/PrinterTest.php b/packages/graphql/src/Printer/PrinterTest.php index d5f699095..070ee8f3d 100644 --- a/packages/graphql/src/Printer/PrinterTest.php +++ b/packages/graphql/src/Printer/PrinterTest.php @@ -60,7 +60,7 @@ public function testPrint( int $used, Closure $schemaFactory, Closure $printableFactory, - Closure $typeFactory = null, + ?Closure $typeFactory = null, ): void { $schema = $schemaFactory($this); $schema = $this->useGraphQLSchema($schema)->getGraphQLSchema(); @@ -87,7 +87,7 @@ public function testExport( int $used, Closure $schemaFactory, Closure $exportableFactory, - Closure $typeFactory = null, + ?Closure $typeFactory = null, ): void { $schema = $schemaFactory($this); $schema = $this->useGraphQLSchema($schema)->getGraphQLSchema(); diff --git a/packages/graphql/src/Scalars/JsonStringType.php b/packages/graphql/src/Scalars/JsonStringType.php index 859800a6c..b0e707354 100644 --- a/packages/graphql/src/Scalars/JsonStringType.php +++ b/packages/graphql/src/Scalars/JsonStringType.php @@ -42,7 +42,7 @@ public function parseValue(mixed $value): string { * @inheritDoc */ #[Override] - public function parseLiteral(Node $valueNode, array $variables = null): string { + public function parseLiteral(Node $valueNode, ?array $variables = null): string { if (!($valueNode instanceof StringValueNode)) { throw new Error( sprintf( diff --git a/packages/graphql/src/SearchBy/Directives/DirectiveTest.php b/packages/graphql/src/SearchBy/Directives/DirectiveTest.php index 22733deb9..0bc221ac4 100644 --- a/packages/graphql/src/SearchBy/Directives/DirectiveTest.php +++ b/packages/graphql/src/SearchBy/Directives/DirectiveTest.php @@ -4,6 +4,7 @@ use Closure; use Exception; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use GraphQL\Type\Definition\EnumType; @@ -1620,7 +1621,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return Parser::inputObjectTypeDefinition( <<override(FieldResolver::class, $fieldResolver); diff --git a/packages/graphql/src/SearchBy/Operators/Complex/RelationshipType.php b/packages/graphql/src/SearchBy/Operators/Complex/RelationshipType.php index e77ef6cbc..29f6331ba 100644 --- a/packages/graphql/src/SearchBy/Operators/Complex/RelationshipType.php +++ b/packages/graphql/src/SearchBy/Operators/Complex/RelationshipType.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Operators\Complex; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use GraphQL\Type\Definition\Type; @@ -35,7 +36,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { // Object? if (!$source->isObject()) { return null; diff --git a/packages/graphql/src/SearchBy/Types/Enumeration.php b/packages/graphql/src/SearchBy/Types/Enumeration.php index 8e966e388..d194fea53 100644 --- a/packages/graphql/src/SearchBy/Types/Enumeration.php +++ b/packages/graphql/src/SearchBy/Types/Enumeration.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use LastDragon_ru\LaraASP\GraphQL\Builder\Context\HandlerContextBuilderInfo; @@ -37,7 +38,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { // Enum? if (!$source->isEnum()) { return null; diff --git a/packages/graphql/src/SearchBy/Types/Flag.php b/packages/graphql/src/SearchBy/Types/Flag.php index 895f93406..d17df5da8 100644 --- a/packages/graphql/src/SearchBy/Types/Flag.php +++ b/packages/graphql/src/SearchBy/Types/Flag.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeDefinition; @@ -27,7 +28,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return FlagEnum::class; } } diff --git a/packages/graphql/src/SearchBy/Types/Range.php b/packages/graphql/src/SearchBy/Types/Range.php index 33c0bef34..d8a1a6780 100644 --- a/packages/graphql/src/SearchBy/Types/Range.php +++ b/packages/graphql/src/SearchBy/Types/Range.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SearchBy\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; @@ -30,7 +31,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return Parser::inputObjectTypeDefinition( <<isScalar()) { return null; diff --git a/packages/graphql/src/SortBy/Contracts/Sorter.php b/packages/graphql/src/SortBy/Contracts/Sorter.php index 9ce5eb100..bb01683bf 100644 --- a/packages/graphql/src/SortBy/Contracts/Sorter.php +++ b/packages/graphql/src/SortBy/Contracts/Sorter.php @@ -20,5 +20,5 @@ public function isNullsSupported(): bool; * * @return TBuilder */ - public function sort(object $builder, Field $field, Direction $direction, Nulls $nulls = null): object; + public function sort(object $builder, Field $field, Direction $direction, ?Nulls $nulls = null): object; } diff --git a/packages/graphql/src/SortBy/Exceptions/FailedToCreateSortClause.php b/packages/graphql/src/SortBy/Exceptions/FailedToCreateSortClause.php index ff97f4509..6267f7f1d 100644 --- a/packages/graphql/src/SortBy/Exceptions/FailedToCreateSortClause.php +++ b/packages/graphql/src/SortBy/Exceptions/FailedToCreateSortClause.php @@ -10,7 +10,7 @@ class FailedToCreateSortClause extends SortByException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/SortBy/Exceptions/RelationUnsupported.php b/packages/graphql/src/SortBy/Exceptions/RelationUnsupported.php index d5d29d21a..17d712422 100644 --- a/packages/graphql/src/SortBy/Exceptions/RelationUnsupported.php +++ b/packages/graphql/src/SortBy/Exceptions/RelationUnsupported.php @@ -14,7 +14,7 @@ class RelationUnsupported extends SortByException { */ public function __construct( protected string $class, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/SortBy/Operators/SortTest.php b/packages/graphql/src/SortBy/Operators/SortTest.php index 105f74c0f..b270096b8 100644 --- a/packages/graphql/src/SortBy/Operators/SortTest.php +++ b/packages/graphql/src/SortBy/Operators/SortTest.php @@ -291,7 +291,7 @@ public function sort( object $builder, Field $field, Direction $direction, - Nulls $nulls = null, + ?Nulls $nulls = null, ): object { throw new Exception('Should not be called.'); } diff --git a/packages/graphql/src/SortBy/Sorters/DatabaseSorter.php b/packages/graphql/src/SortBy/Sorters/DatabaseSorter.php index 494ac98af..beb6cf476 100644 --- a/packages/graphql/src/SortBy/Sorters/DatabaseSorter.php +++ b/packages/graphql/src/SortBy/Sorters/DatabaseSorter.php @@ -50,7 +50,7 @@ protected function sortByColumn( EloquentBuilder|QueryBuilder $builder, EloquentBuilder|QueryBuilder|string $column, Direction $direction, - Nulls $nulls = null, + ?Nulls $nulls = null, ): EloquentBuilder|QueryBuilder { // Nulls? if ($nulls !== null && $nulls !== $this->getNullsDefault($builder, $direction)) { diff --git a/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php b/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php index e1ca9258e..46e3b1c4a 100644 --- a/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php +++ b/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php @@ -63,7 +63,7 @@ public function sort( object $builder, Field $field, Direction $direction, - Nulls $nulls = null, + ?Nulls $nulls = null, ): object { throw new Exception('Should not be called.'); } @@ -83,7 +83,7 @@ public function sortByColumn( EloquentBuilder|QueryBuilder $builder, EloquentBuilder|string|QueryBuilder $column, Direction $direction, - Nulls $nulls = null, + ?Nulls $nulls = null, ): EloquentBuilder|QueryBuilder { return parent::sortByColumn($builder, $column, $direction, $nulls); } @@ -101,7 +101,7 @@ public function sort( object $builder, Field $field, Direction $direction, - Nulls $nulls = null, + ?Nulls $nulls = null, ): object { throw new Exception('Should not be called.'); } diff --git a/packages/graphql/src/SortBy/Sorters/EloquentSorter.php b/packages/graphql/src/SortBy/Sorters/EloquentSorter.php index 97aad0a6f..b61e2a260 100644 --- a/packages/graphql/src/SortBy/Sorters/EloquentSorter.php +++ b/packages/graphql/src/SortBy/Sorters/EloquentSorter.php @@ -29,7 +29,7 @@ class EloquentSorter extends DatabaseSorter { // // ========================================================================= #[Override] - public function sort(object $builder, Field $field, Direction $direction, Nulls $nulls = null): object { + public function sort(object $builder, Field $field, Direction $direction, ?Nulls $nulls = null): object { // Column $relation = $field->getParent()->getPath(); diff --git a/packages/graphql/src/SortBy/Sorters/QuerySorter.php b/packages/graphql/src/SortBy/Sorters/QuerySorter.php index 3d7a808c5..3ca56eca6 100644 --- a/packages/graphql/src/SortBy/Sorters/QuerySorter.php +++ b/packages/graphql/src/SortBy/Sorters/QuerySorter.php @@ -13,7 +13,7 @@ */ class QuerySorter extends DatabaseSorter { #[Override] - public function sort(object $builder, Field $field, Direction $direction, Nulls $nulls = null): object { + public function sort(object $builder, Field $field, Direction $direction, ?Nulls $nulls = null): object { $column = $this->resolver->getField($builder, $field); $builder = $this->sortByColumn($builder, $column, $direction, $nulls); diff --git a/packages/graphql/src/SortBy/Sorters/ScoutSorter.php b/packages/graphql/src/SortBy/Sorters/ScoutSorter.php index b4f9a52eb..ef19a9da4 100644 --- a/packages/graphql/src/SortBy/Sorters/ScoutSorter.php +++ b/packages/graphql/src/SortBy/Sorters/ScoutSorter.php @@ -27,7 +27,7 @@ public function isNullsSupported(): bool { } #[Override] - public function sort(object $builder, Field $field, Direction $direction, Nulls $nulls = null): object { + public function sort(object $builder, Field $field, Direction $direction, ?Nulls $nulls = null): object { if ($nulls) { throw new NotImplemented('NULLs ordering'); } diff --git a/packages/graphql/src/SortBy/Types/Direction.php b/packages/graphql/src/SortBy/Types/Direction.php index 0fa835bda..ac4314957 100644 --- a/packages/graphql/src/SortBy/Types/Direction.php +++ b/packages/graphql/src/SortBy/Types/Direction.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SortBy\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeDefinition; @@ -27,7 +28,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return DirectionEnum::class; } } diff --git a/packages/graphql/src/SortBy/Types/Flag.php b/packages/graphql/src/SortBy/Types/Flag.php index aa2de62dc..4092c1fef 100644 --- a/packages/graphql/src/SortBy/Types/Flag.php +++ b/packages/graphql/src/SortBy/Types/Flag.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\SortBy\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeDefinition; @@ -27,7 +28,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return FlagEnum::class; } } diff --git a/packages/graphql/src/Stream/Directives/Directive.php b/packages/graphql/src/Stream/Directives/Directive.php index c61f2423e..3619b47e9 100644 --- a/packages/graphql/src/Stream/Directives/Directive.php +++ b/packages/graphql/src/Stream/Directives/Directive.php @@ -308,7 +308,7 @@ protected function addArgument( string $directive, string $name, string $type, - string $value = null, + ?string $value = null, array $arguments = [], ): void { // Arguments with directive already exists? diff --git a/packages/graphql/src/Stream/Exceptions/ArgumentMissed.php b/packages/graphql/src/Stream/Exceptions/ArgumentMissed.php index 226036d0b..14e215a09 100644 --- a/packages/graphql/src/Stream/Exceptions/ArgumentMissed.php +++ b/packages/graphql/src/Stream/Exceptions/ArgumentMissed.php @@ -16,7 +16,7 @@ class ArgumentMissed extends StreamException { public function __construct( protected Stringable|string $source, protected string $directive, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/BuilderInvalid.php b/packages/graphql/src/Stream/Exceptions/BuilderInvalid.php index 25992e50d..3781dc6f7 100644 --- a/packages/graphql/src/Stream/Exceptions/BuilderInvalid.php +++ b/packages/graphql/src/Stream/Exceptions/BuilderInvalid.php @@ -11,7 +11,7 @@ class BuilderInvalid extends StreamException { public function __construct( protected Stringable|string $source, protected string $type, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/BuilderUnsupported.php b/packages/graphql/src/Stream/Exceptions/BuilderUnsupported.php index 5b302037c..cfbcdc4b1 100644 --- a/packages/graphql/src/Stream/Exceptions/BuilderUnsupported.php +++ b/packages/graphql/src/Stream/Exceptions/BuilderUnsupported.php @@ -14,7 +14,7 @@ class BuilderUnsupported extends StreamException { public function __construct( protected Stringable|string $source, protected string $builder, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/Client/ArgumentsMutuallyExclusive.php b/packages/graphql/src/Stream/Exceptions/Client/ArgumentsMutuallyExclusive.php index 8e41f1405..5d2a7cdee 100644 --- a/packages/graphql/src/Stream/Exceptions/Client/ArgumentsMutuallyExclusive.php +++ b/packages/graphql/src/Stream/Exceptions/Client/ArgumentsMutuallyExclusive.php @@ -15,7 +15,7 @@ class ArgumentsMutuallyExclusive extends ClientException { public function __construct( protected Stringable|string $source, protected array $arguments, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/Client/CursorInvalidPath.php b/packages/graphql/src/Stream/Exceptions/Client/CursorInvalidPath.php index 45ca37e25..f442ad647 100644 --- a/packages/graphql/src/Stream/Exceptions/Client/CursorInvalidPath.php +++ b/packages/graphql/src/Stream/Exceptions/Client/CursorInvalidPath.php @@ -10,7 +10,7 @@ class CursorInvalidPath extends ClientException { public function __construct( protected string $expected, protected string $actual, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/FieldIsNotList.php b/packages/graphql/src/Stream/Exceptions/FieldIsNotList.php index e6e92662e..6b56ea8ce 100644 --- a/packages/graphql/src/Stream/Exceptions/FieldIsNotList.php +++ b/packages/graphql/src/Stream/Exceptions/FieldIsNotList.php @@ -10,7 +10,7 @@ class FieldIsNotList extends StreamException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/FieldIsSubscription.php b/packages/graphql/src/Stream/Exceptions/FieldIsSubscription.php index ff9c444a8..6f3665a45 100644 --- a/packages/graphql/src/Stream/Exceptions/FieldIsSubscription.php +++ b/packages/graphql/src/Stream/Exceptions/FieldIsSubscription.php @@ -10,7 +10,7 @@ class FieldIsSubscription extends StreamException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/FieldIsUnion.php b/packages/graphql/src/Stream/Exceptions/FieldIsUnion.php index e468c1463..413032f0d 100644 --- a/packages/graphql/src/Stream/Exceptions/FieldIsUnion.php +++ b/packages/graphql/src/Stream/Exceptions/FieldIsUnion.php @@ -10,7 +10,7 @@ class FieldIsUnion extends StreamException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Exceptions/KeyUnknown.php b/packages/graphql/src/Stream/Exceptions/KeyUnknown.php index 1f673bf08..b61719842 100644 --- a/packages/graphql/src/Stream/Exceptions/KeyUnknown.php +++ b/packages/graphql/src/Stream/Exceptions/KeyUnknown.php @@ -10,7 +10,7 @@ class KeyUnknown extends StreamException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/Stream/Scalars/Offset.php b/packages/graphql/src/Stream/Scalars/Offset.php index 08a02e7ef..c1fcbfef3 100644 --- a/packages/graphql/src/Stream/Scalars/Offset.php +++ b/packages/graphql/src/Stream/Scalars/Offset.php @@ -91,7 +91,7 @@ public function parseValue(mixed $value): StreamOffset|int { * @return StreamOffset|int<0, max> */ #[Override] - public function parseLiteral(Node $valueNode, array $variables = null): StreamOffset|int { + public function parseLiteral(Node $valueNode, ?array $variables = null): StreamOffset|int { $value = null; if ($valueNode instanceof StringValueNode) { diff --git a/packages/graphql/src/Stream/Types/Navigation.php b/packages/graphql/src/Stream/Types/Navigation.php index 83d47ce0c..f0b6396a6 100644 --- a/packages/graphql/src/Stream/Types/Navigation.php +++ b/packages/graphql/src/Stream/Types/Navigation.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\Stream\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; @@ -27,7 +28,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { $offset = $manipulator->getType(Offset::class, $source, $context); return Parser::objectTypeDefinition( diff --git a/packages/graphql/src/Stream/Types/Offset.php b/packages/graphql/src/Stream/Types/Offset.php index 2f5009ef1..e7fee8d80 100644 --- a/packages/graphql/src/Stream/Types/Offset.php +++ b/packages/graphql/src/Stream/Types/Offset.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\Stream\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeDefinition; @@ -23,7 +24,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { return OffsetScalar::class; } // diff --git a/packages/graphql/src/Stream/Types/Stream.php b/packages/graphql/src/Stream/Types/Stream.php index 12d692694..3d6ada08f 100644 --- a/packages/graphql/src/Stream/Types/Stream.php +++ b/packages/graphql/src/Stream/Types/Stream.php @@ -2,6 +2,7 @@ namespace LastDragon_ru\LaraASP\GraphQL\Stream\Types; +use GraphQL\Language\AST\Node; use GraphQL\Language\AST\TypeDefinitionNode; use GraphQL\Language\Parser; use Illuminate\Support\Str; @@ -40,7 +41,7 @@ public function getTypeDefinition( TypeSource $source, Context $context, string $name, - ): TypeDefinitionNode|string|null { + ): (TypeDefinitionNode&Node)|string|null { $type = $source->getTypeName(); $navigation = $manipulator->getType(Navigation::class, $source, $context); diff --git a/packages/graphql/src/Testing/GraphQLAssertions.php b/packages/graphql/src/Testing/GraphQLAssertions.php index 79c21b1e1..9929116b8 100644 --- a/packages/graphql/src/Testing/GraphQLAssertions.php +++ b/packages/graphql/src/Testing/GraphQLAssertions.php @@ -213,7 +213,7 @@ protected function getGraphQLSchema(): Schema { return $this->getGraphQLSchemaBuilder()->schema(); } - protected function getGraphQLPrinter(Settings $settings = null): Printer { + protected function getGraphQLPrinter(?Settings $settings = null): Printer { return $this->app()->make(Printer::class)->setSettings($settings ?? new TestSettings()); } diff --git a/packages/graphql/src/Testing/Package/Models/Concerns/Concerns.php b/packages/graphql/src/Testing/Package/Models/Concerns/Concerns.php index 9548774a1..b067f8828 100644 --- a/packages/graphql/src/Testing/Package/Models/Concerns/Concerns.php +++ b/packages/graphql/src/Testing/Package/Models/Concerns/Concerns.php @@ -11,7 +11,7 @@ trait Concerns { /** * @param array $attributes */ - public function __construct(string $table, string $id = null, array $attributes = []) { + public function __construct(string $table, ?string $id = null, array $attributes = []) { parent::__construct(); $this->table = $table; diff --git a/packages/graphql/src/Testing/Package/TestCase.php b/packages/graphql/src/Testing/Package/TestCase.php index 78e2ff9b5..600c2e208 100644 --- a/packages/graphql/src/Testing/Package/TestCase.php +++ b/packages/graphql/src/Testing/Package/TestCase.php @@ -55,7 +55,7 @@ protected function getPackageProviders(mixed $app): array { ]); } - protected function getGraphQLPrinter(Settings $settings = null): Printer { + protected function getGraphQLPrinter(?Settings $settings = null): Printer { $settings ??= (new TestSettings()) ->setDirectiveDefinitionFilter($this->app()->make(LighthouseDirectiveFilter::class)); $printer = $this->getDefaultGraphQLPrinter($settings); @@ -66,7 +66,7 @@ protected function getGraphQLPrinter(Settings $settings = null): Printer { protected function getGraphQLArgument( string $type, mixed $value, - Schema|SplFileInfo|string $schema = null, + Schema|SplFileInfo|string|null $schema = null, ): Argument { try { if ($schema) { diff --git a/packages/graphql/src/Utils/AstManipulator.php b/packages/graphql/src/Utils/AstManipulator.php index 71c451b6a..c86b2807a 100644 --- a/packages/graphql/src/Utils/AstManipulator.php +++ b/packages/graphql/src/Utils/AstManipulator.php @@ -101,30 +101,21 @@ protected function getTypes(): TypeRegistry { // // ========================================================================= - /** - * @param Node|Type|InputObjectField|FieldDefinition|Argument|(TypeDefinitionNode&Node)|string $node - */ public function isStandard( - Node|Type|InputObjectField|FieldDefinition|Argument|TypeDefinitionNode|string $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument|string $node, ): bool { return in_array($this->getTypeName($node), Type::STANDARD_TYPE_NAMES, true); } - /** - * @param Node|Type|InputObjectField|FieldDefinition|Argument|(TypeDefinitionNode&Node)|string $node - */ public function isPlaceholder( - Node|Type|InputObjectField|FieldDefinition|Argument|TypeDefinitionNode|string $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument|string $node, ): bool { // Lighthouse uses `_` type as a placeholder for directives like `@orderBy` return $this->getTypeName($node) === static::Placeholder; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|Argument|(TypeDefinitionNode&Node) $node - */ public function isNullable( - Node|Type|InputObjectField|FieldDefinition|Argument|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument $node, ): bool { $type = null; @@ -142,11 +133,8 @@ public function isNullable( && !($type instanceof NonNullTypeNode); } - /** - * @param Node|Type|InputObjectField|FieldDefinition|Argument|(TypeDefinitionNode&Node) $node - */ public function isList( - Node|Type|InputObjectField|FieldDefinition|Argument|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument $node, ): bool { $type = null; @@ -172,11 +160,8 @@ public function isList( || $type instanceof ListTypeNode; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|(TypeDefinitionNode&Node) $node - */ public function isUnion( - Node|Type|InputObjectField|FieldDefinition|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition $node, ): bool { $type = $this->getType($node); @@ -184,11 +169,8 @@ public function isUnion( || $type instanceof UnionType; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|(TypeDefinitionNode&Node) $node - */ public function isObject( - Node|Type|InputObjectField|FieldDefinition|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition $node, ): bool { $type = $this->getType($node); @@ -200,11 +182,8 @@ public function isObject( || $type instanceof InputObjectType; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|(TypeDefinitionNode&Node) $node - */ public function isScalar( - Node|Type|InputObjectField|FieldDefinition|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition $node, ): bool { $type = $this->getType($node); @@ -212,11 +191,8 @@ public function isScalar( || $type instanceof ScalarType; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|(TypeDefinitionNode&Node) $node - */ public function isEnum( - Node|Type|InputObjectField|FieldDefinition|TypeDefinitionNode $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition $node, ): bool { $type = $this->getType($node); @@ -246,12 +222,9 @@ public function isTypeDefinitionExists(string $name): bool { } } - /** - * @return (TypeDefinitionNode&Node)|Type - */ public function getTypeDefinition( - Node|Type|InputObjectField|FieldDefinition|Argument|string $node, - ): TypeDefinitionNode|Type { + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument|string $node, + ): (TypeDefinitionNode&Node)|Type { if ($node instanceof TypeDefinitionNode && $node instanceof Node) { return $node; } @@ -282,7 +255,9 @@ public function getTypeDefinition( * * @return TDefinition */ - public function addTypeDefinition(TypeDefinitionNode|TypeReference $definition): TypeDefinitionNode|TypeReference { + public function addTypeDefinition( + (TypeDefinitionNode&Node)|TypeReference $definition, + ): (TypeDefinitionNode&Node)|TypeReference { $name = $this->getName($definition); if ($this->isTypeDefinitionExists($name)) { @@ -320,12 +295,9 @@ public function removeTypeDefinition(string $name): void { unset($this->getDocument()->types[$name]); } - /** - * @return (TypeNode&Node)|Type - */ public function getOriginType( FieldDefinitionNode|FieldDefinition|InputValueDefinitionNode|InputObjectField $field, - ): TypeNode|Type { + ): (TypeNode&Node)|Type { $directive = $this->getDirective($field, Directive::class, static function (Directive $directive): bool { return $directive instanceof StreamDirective || $directive instanceof PaginateDirective @@ -369,14 +341,13 @@ public function getOriginType( /** * @template T * - * @param Node|(TypeDefinitionNode&Node)|Type|InputObjectField|FieldDefinition|Argument $node - * @param class-string $class - * @param Closure(T): bool|null $callback + * @param class-string $class + * @param Closure(T): bool|null $callback * * @return (T&Directive)|null */ public function getDirective( - Node|TypeDefinitionNode|Type|InputObjectField|FieldDefinition|Argument $node, + Node|Type|InputObjectField|FieldDefinition|Argument $node, string $class, ?Closure $callback = null, ): ?Directive { @@ -407,14 +378,13 @@ public function getDirective( /** * @template T * - * @param Node|(TypeDefinitionNode&Node)|Type|InputObjectField|FieldDefinition|Argument $node - * @param class-string|null $class - * @param Closure(($class is null ? Directive : T&Directive)): bool|null $callback + * @param class-string|null $class + * @param Closure(($class is null ? Directive : T&Directive)): bool|null $callback * * @return ($class is null ? array : array) */ public function getDirectives( - Node|TypeDefinitionNode|Type|InputObjectField|FieldDefinition|Argument $node, + Node|Type|InputObjectField|FieldDefinition|Argument $node, ?string $class = null, ?Closure $callback = null, ): array { @@ -456,11 +426,8 @@ public function getDirectives( return $directives; } - /** - * @param Node|Type|InputObjectField|FieldDefinition|Argument|(TypeDefinitionNode&Node)|string $node - */ public function getTypeName( - Node|Type|InputObjectField|FieldDefinition|Argument|TypeDefinitionNode|string $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|Argument|string $node, ): string { $name = null; @@ -492,11 +459,8 @@ public function getTypeName( return $name; } - /** - * @param InputValueDefinitionNode|(TypeDefinitionNode&Node)|FieldDefinitionNode|InputObjectField|FieldDefinition|Argument|ArgumentNode|Type|TypeReference $node - */ public function getName( - InputValueDefinitionNode|TypeDefinitionNode|FieldDefinitionNode|InputObjectField|FieldDefinition|Argument|ArgumentNode|Type|TypeReference $node, + InputValueDefinitionNode|(TypeDefinitionNode&Node)|FieldDefinitionNode|InputObjectField|FieldDefinition|Argument|ArgumentNode|Type|TypeReference $node, ): string { if ($node instanceof TypeDefinitionNode) { $node = $node->getName(); @@ -524,11 +488,8 @@ public function getName( return $name; } - /** - * @param Node|(TypeDefinitionNode&Node)|Type|InputObjectField|FieldDefinition|string $node - */ public function getTypeFullName( - Node|TypeDefinitionNode|Type|InputObjectField|FieldDefinition|string $node, + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition|string $node, ): string { $name = $this->getTypeName($node); $prefix = null; @@ -716,7 +677,7 @@ public function addArgument( string $name, string $type, mixed $default = null, - string $description = null, + ?string $description = null, ): InputValueDefinitionNode|Argument { // Added? if ($this->getArgument($field, $name)) { @@ -813,15 +774,14 @@ public function addDirective( /** * @template T of FieldDefinitionNode|FieldDefinition * - * @param T $field - * @param NamedTypeNode|ListTypeNode|NonNullTypeNode|(Type&InputType) $type + * @param T $field * * @return T */ public function setFieldType( ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType $definition, FieldDefinitionNode|FieldDefinition $field, - TypeNode|Type $type, + (Type&InputType)|NamedTypeNode|ListTypeNode|NonNullTypeNode $type, ): FieldDefinitionNode|FieldDefinition { // Update $this->setType($field, $type); @@ -849,8 +809,7 @@ public function setFieldType( /** * @template T of InputValueDefinitionNode|Argument * - * @param T $argument - * @param NamedTypeNode|ListTypeNode|NonNullTypeNode|(Type&InputType) $type + * @param T $argument * * @return T */ @@ -858,7 +817,7 @@ public function setArgumentType( ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType $definition, FieldDefinitionNode|FieldDefinition $field, InputValueDefinitionNode|Argument $argument, - TypeNode|Type $type, + (Type&InputType)|NamedTypeNode|ListTypeNode|NonNullTypeNode $type, ): InputValueDefinitionNode|Argument { // Update $this->setType($argument, $type); @@ -894,12 +853,11 @@ public function setArgumentType( /** * @template T * - * @param (TypeNode&Node)|string $name - * @param class-string $expected + * @param class-string $expected * * @return Type&T */ - private function toType(TypeNode|string $name, string $expected): Type { + private function toType((TypeNode&Node)|string $name, string $expected): Type { // todo(graphql): Is there a better way to get Type? $type = null; $node = is_string($name) ? Parser::typeReference($name) : $name; @@ -923,12 +881,9 @@ private function toType(TypeNode|string $name, string $expected): Type { return $type; } - /** - * @param NamedTypeNode|ListTypeNode|NonNullTypeNode|(Type&InputType) $type - */ private function setType( FieldDefinitionNode|FieldDefinition|InputValueDefinitionNode|Argument $node, - TypeNode|Type $type, + (Type&InputType)|NamedTypeNode|ListTypeNode|NonNullTypeNode $type, ): void { // It seems that we can only modify types of AST nodes :( if ($node instanceof Node) { @@ -940,14 +895,9 @@ private function setType( } } - /** - * @param Node|Type|InputObjectField|FieldDefinition|(TypeDefinitionNode&Node) $node - * - * @return (Node&TypeDefinitionNode)|Type|null - */ private function getType( - Node|Type|InputObjectField|FieldDefinition|TypeDefinitionNode $node, - ): TypeDefinitionNode|Type|null { + (TypeDefinitionNode&Node)|(TypeNode&Node)|FieldDefinitionNode|InputValueDefinitionNode|Type|InputObjectField|FieldDefinition $node, + ): (Node&TypeDefinitionNode)|Type|null { if ($node instanceof InputObjectField || $node instanceof FieldDefinition) { $node = $node->getType(); } elseif ($node instanceof Node) { diff --git a/packages/graphql/src/Utils/AstManipulatorTest.php b/packages/graphql/src/Utils/AstManipulatorTest.php index 3eb6add38..3ff9dc481 100644 --- a/packages/graphql/src/Utils/AstManipulatorTest.php +++ b/packages/graphql/src/Utils/AstManipulatorTest.php @@ -13,7 +13,6 @@ use GraphQL\Language\AST\Node; use GraphQL\Language\AST\NonNullTypeNode; use GraphQL\Language\AST\ObjectTypeDefinitionNode; -use GraphQL\Language\AST\TypeNode; use GraphQL\Language\Parser; use GraphQL\Type\Definition\Argument; use GraphQL\Type\Definition\CustomScalarType; @@ -468,7 +467,6 @@ public function testIsDeprecated( /** * @param Closure(AstManipulator): (ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType) $definitionFactory * @param Closure(AstManipulator, ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType): (FieldDefinitionNode|FieldDefinition) $fieldFactory - * @param NamedTypeNode|ListTypeNode|NonNullTypeNode|(Type&InputType) $type */ #[DataProvider('dataProviderSetFieldType')] public function testSetFieldType( @@ -476,7 +474,7 @@ public function testSetFieldType( string $schema, Closure $definitionFactory, Closure $fieldFactory, - TypeNode|Type $type, + (Type&InputType)|NamedTypeNode|ListTypeNode|NonNullTypeNode $type, ): void { if ($expected instanceof Exception) { self::expectExceptionObject($expected); @@ -498,7 +496,6 @@ public function testSetFieldType( * @param Closure(AstManipulator): (ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType) $definitionFactory * @param Closure(AstManipulator, ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType): (FieldDefinitionNode|FieldDefinition) $fieldFactory * @param Closure(AstManipulator, ObjectTypeDefinitionNode|InterfaceTypeDefinitionNode|ObjectType|InterfaceType, FieldDefinitionNode|FieldDefinition): (InputValueDefinitionNode|Argument) $argumentFactory - * @param NamedTypeNode|ListTypeNode|NonNullTypeNode|(Type&InputType) $type */ #[DataProvider('dataProviderSetArgumentType')] public function testSetArgumentType( @@ -507,7 +504,7 @@ public function testSetArgumentType( Closure $definitionFactory, Closure $fieldFactory, Closure $argumentFactory, - TypeNode|Type $type, + (Type&InputType)|NamedTypeNode|ListTypeNode|NonNullTypeNode $type, ): void { if ($expected instanceof Exception) { self::expectExceptionObject($expected); @@ -602,7 +599,7 @@ public function testGetOriginType(string $expected, string $graphql): void { // // ========================================================================= - protected function getManipulator(string $schema = null): AstManipulator { + protected function getManipulator(?string $schema = null): AstManipulator { $document = $schema ? DocumentAST::fromSource($schema) : $this->app()->make(ASTBuilder::class)->documentAST(); diff --git a/packages/migrator/README.md b/packages/migrator/README.md index c32ad82a5..feabcb8fa 100644 --- a/packages/migrator/README.md +++ b/packages/migrator/README.md @@ -16,7 +16,7 @@ This package improves standard Laravel migrations to add support for raw SQL fil |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/migrator/UPGRADE.md b/packages/migrator/UPGRADE.md index b36492602..bea1e5157 100644 --- a/packages/migrator/UPGRADE.md +++ b/packages/migrator/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/migrator/composer.json b/packages/migrator/composer.json index 4746c9a66..4701c577d 100644 --- a/packages/migrator/composer.json +++ b/packages/migrator/composer.json @@ -20,7 +20,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-json": "*", "ext-mbstring": "*", "illuminate/conditionable": "^10.34.0|^11.0.0", @@ -39,7 +39,7 @@ "ext-pdo_sqlite": "*", "illuminate/config": "^10.34.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0", "phpunit/phpunit": "^10.1.0|^11.0.0" }, diff --git a/packages/migrator/metadata.json b/packages/migrator/metadata.json index 530d7f675..900dc785b 100644 --- a/packages/migrator/metadata.json +++ b/packages/migrator/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/migrator/src/Concerns/RawSqlHelper.php b/packages/migrator/src/Concerns/RawSqlHelper.php index 8db803207..45be88564 100644 --- a/packages/migrator/src/Concerns/RawSqlHelper.php +++ b/packages/migrator/src/Concerns/RawSqlHelper.php @@ -20,7 +20,7 @@ * @internal */ trait RawSqlHelper { - protected function runRaw(string $type = null): void { + protected function runRaw(?string $type = null): void { $connection = $this->getConnectionInstance(); $state = $this->getSchemaState($connection); $path = $this->getRawPath($type); @@ -34,7 +34,7 @@ protected function runRaw(string $type = null): void { } } - protected function getRawPath(string $type = null): string { + protected function getRawPath(?string $type = null): string { $path = (string) (new ReflectionClass($this))->getFileName(); $file = basename($path, '.php'); $dir = dirname($path); diff --git a/packages/migrator/src/Exceptions/ConnectionUnknown.php b/packages/migrator/src/Exceptions/ConnectionUnknown.php index 6d3fa6afd..5f8d39017 100644 --- a/packages/migrator/src/Exceptions/ConnectionUnknown.php +++ b/packages/migrator/src/Exceptions/ConnectionUnknown.php @@ -6,7 +6,7 @@ use Throwable; class ConnectionUnknown extends PackageException { - public function __construct(Throwable $previous = null) { + public function __construct(?Throwable $previous = null) { parent::__construct('Unknown connection.', $previous); } } diff --git a/packages/migrator/src/Exceptions/DatabaseSeeded.php b/packages/migrator/src/Exceptions/DatabaseSeeded.php index 990b741e2..5f78c6909 100644 --- a/packages/migrator/src/Exceptions/DatabaseSeeded.php +++ b/packages/migrator/src/Exceptions/DatabaseSeeded.php @@ -14,7 +14,7 @@ class DatabaseSeeded extends PackageException { */ public function __construct( protected readonly string $seeder, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/migrator/src/Exceptions/FileNotFound.php b/packages/migrator/src/Exceptions/FileNotFound.php index 17012d7a5..a29820692 100644 --- a/packages/migrator/src/Exceptions/FileNotFound.php +++ b/packages/migrator/src/Exceptions/FileNotFound.php @@ -10,7 +10,7 @@ class FileNotFound extends PackageException { public function __construct( private readonly string $path, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf('The SQL file `%s` does not exist.', $this->path), diff --git a/packages/migrator/src/Exceptions/SchemaStateUnsupported.php b/packages/migrator/src/Exceptions/SchemaStateUnsupported.php index c756dfc74..3ff459c6e 100644 --- a/packages/migrator/src/Exceptions/SchemaStateUnsupported.php +++ b/packages/migrator/src/Exceptions/SchemaStateUnsupported.php @@ -11,7 +11,7 @@ class SchemaStateUnsupported extends PackageException { public function __construct( private readonly Connection $connection, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/migrator/src/PackageException.php b/packages/migrator/src/PackageException.php index 262853f2d..0a755520f 100644 --- a/packages/migrator/src/PackageException.php +++ b/packages/migrator/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message = '', Throwable $previous = null) { + public function __construct(string $message = '', ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/migrator/src/Seeders/SmartSeeder.php b/packages/migrator/src/Seeders/SmartSeeder.php index 30f098dac..ea688df0f 100644 --- a/packages/migrator/src/Seeders/SmartSeeder.php +++ b/packages/migrator/src/Seeders/SmartSeeder.php @@ -79,7 +79,7 @@ abstract public function seed(): void; /** * Output "skipped" message. */ - protected function skipped(string $reason = null): void { + protected function skipped(?string $reason = null): void { if ($this->command !== null) { $this->command->getOutput() ->writeln(' skipped'.($reason ? " ({$reason})" : '')); diff --git a/packages/serializer/README.md b/packages/serializer/README.md index 7b71c6efb..2f8486b76 100644 --- a/packages/serializer/README.md +++ b/packages/serializer/README.md @@ -12,7 +12,7 @@ This package provides a customizable wrapper around the [Symfony Serializer Comp |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 5.0.0-beta.0` | -| | `^8.1` | `HEAD ⋯ 5.0.0-beta.0` | +| | `^8.1` | `6.4.1 ⋯ 5.0.0-beta.0` | | Laravel | `^11.0.0` | `HEAD ⋯ 6.2.0` | | | `^10.34.0` | `HEAD ⋯ 6.2.0` | | | `^10.0.0` | `6.1.0 ⋯ 5.0.0-beta.0` | diff --git a/packages/serializer/UPGRADE.md b/packages/serializer/UPGRADE.md index 1f9780e2c..eba885e1b 100644 --- a/packages/serializer/UPGRADE.md +++ b/packages/serializer/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/serializer/composer.json b/packages/serializer/composer.json index 33d035c80..e7c3558ed 100644 --- a/packages/serializer/composer.json +++ b/packages/serializer/composer.json @@ -17,7 +17,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "illuminate/container": "^10.34.0|^11.0.0", "illuminate/contracts": "^10.34.0|^11.0.0", "illuminate/database": "^10.34.0|^11.0.0", @@ -33,7 +33,7 @@ }, "require-dev": { "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0", "phpunit/phpunit": "^10.1.0|^11.0.0" }, diff --git a/packages/serializer/metadata.json b/packages/serializer/metadata.json index be7d54439..8252292b3 100644 --- a/packages/serializer/metadata.json +++ b/packages/serializer/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/serializer/src/Casts/AsSerializable.php b/packages/serializer/src/Casts/AsSerializable.php index 1503a8a13..553f8960c 100644 --- a/packages/serializer/src/Casts/AsSerializable.php +++ b/packages/serializer/src/Casts/AsSerializable.php @@ -43,7 +43,7 @@ public function __construct( /** * @param class-string $class */ - public static function using(string $class, string $format = null): string { + public static function using(string $class, ?string $format = null): string { return static::class.':'.$class.($format ? ",{$format}" : ''); } diff --git a/packages/serializer/src/Contracts/Serializer.php b/packages/serializer/src/Contracts/Serializer.php index 2bffa237c..2cf5bb957 100644 --- a/packages/serializer/src/Contracts/Serializer.php +++ b/packages/serializer/src/Contracts/Serializer.php @@ -6,7 +6,7 @@ interface Serializer { /** * @param array $context */ - public function serialize(object $object, string $format = null, array $context = []): string; + public function serialize(object $object, ?string $format = null, array $context = []): string; /** * @template T of object @@ -19,7 +19,7 @@ public function serialize(object $object, string $format = null, array $context public function deserialize( string $object, string $data, - string $format = null, + ?string $format = null, array $context = [], ): object; } diff --git a/packages/serializer/src/Exceptions/FailedToCast.php b/packages/serializer/src/Exceptions/FailedToCast.php index 06bc9b91f..af9fc6084 100644 --- a/packages/serializer/src/Exceptions/FailedToCast.php +++ b/packages/serializer/src/Exceptions/FailedToCast.php @@ -16,7 +16,7 @@ class FailedToCast extends PackageException { public function __construct( private string $target, private mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/serializer/src/Exceptions/FailedToDeserialize.php b/packages/serializer/src/Exceptions/FailedToDeserialize.php index 72ab42281..d386149f8 100644 --- a/packages/serializer/src/Exceptions/FailedToDeserialize.php +++ b/packages/serializer/src/Exceptions/FailedToDeserialize.php @@ -17,7 +17,7 @@ public function __construct( private string $data, private string $format, private array $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/serializer/src/Exceptions/FailedToSerialize.php b/packages/serializer/src/Exceptions/FailedToSerialize.php index f4e8de0e9..9462454de 100644 --- a/packages/serializer/src/Exceptions/FailedToSerialize.php +++ b/packages/serializer/src/Exceptions/FailedToSerialize.php @@ -15,7 +15,7 @@ public function __construct( private object $object, private string $format, private array $context, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/serializer/src/Factory.php b/packages/serializer/src/Factory.php index 35532381c..f05ed778d 100644 --- a/packages/serializer/src/Factory.php +++ b/packages/serializer/src/Factory.php @@ -53,7 +53,7 @@ public function create( array $encoders = [], array $normalizers = [], array $context = [], - string $format = null, + ?string $format = null, ?string $config = Package::Name, ): SerializerContract { $format = $format ?? $this->getConfigFormat($config) ?? JsonEncoder::FORMAT; diff --git a/packages/serializer/src/Normalizers/DateTimeNormalizer.php b/packages/serializer/src/Normalizers/DateTimeNormalizer.php index f92e19efa..271e0c989 100644 --- a/packages/serializer/src/Normalizers/DateTimeNormalizer.php +++ b/packages/serializer/src/Normalizers/DateTimeNormalizer.php @@ -65,7 +65,7 @@ public function getSupportedTypes(?string $format): array { * @param array $context */ #[Override] - public function normalize(mixed $object, string $format = null, array $context = []): string { + public function normalize(mixed $object, ?string $format = null, array $context = []): string { if (!($object instanceof DateTimeInterface)) { throw new InvalidArgumentException( sprintf( @@ -85,7 +85,7 @@ public function normalize(mixed $object, string $format = null, array $context = * @param array $context */ #[Override] - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof DateTimeInterface; } @@ -93,7 +93,7 @@ public function supportsNormalization(mixed $data, string $format = null, array * @param array $context */ #[Override] - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed { + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { // Just for the case if (!is_string($data)) { throw new InvalidArgumentException( @@ -158,7 +158,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar public function supportsDenormalization( mixed $data, string $type, - string $format = null, + ?string $format = null, array $context = [], ): bool { return is_a($type, DateTimeInterface::class, true); diff --git a/packages/serializer/src/Normalizers/SerializableNormalizer.php b/packages/serializer/src/Normalizers/SerializableNormalizer.php index 71e3acc9d..8629ead67 100644 --- a/packages/serializer/src/Normalizers/SerializableNormalizer.php +++ b/packages/serializer/src/Normalizers/SerializableNormalizer.php @@ -77,7 +77,7 @@ public function getSupportedTypes(?string $format): array { * @param array $context */ #[Override] - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed { + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { /** * I'm not sure if it is bug or not, but out the box symfony call * {@see AbstractObjectNormalizer::getMappedClass()} after the @@ -141,7 +141,7 @@ static function (mixed $attribute): string { * @return array */ #[Override] - protected function extractAttributes(object $object, string $format = null, array $context = []): array { + protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return [ /** * The method is never called because the {@see static::$classMetadataFactory} is always defined. @@ -156,7 +156,7 @@ protected function extractAttributes(object $object, string $format = null, arra protected function getAttributeValue( object $object, string $attribute, - string $format = null, + ?string $format = null, array $context = [], ): mixed { return $this->isDiscriminator($object::class, $attribute) @@ -172,7 +172,7 @@ protected function setAttributeValue( object $object, string $attribute, mixed $value, - string $format = null, + ?string $format = null, array $context = [], ): void { if ($this->isAttribute($object::class, $attribute)) { diff --git a/packages/serializer/src/Normalizers/UnitEnumNormalizer.php b/packages/serializer/src/Normalizers/UnitEnumNormalizer.php index 3c0ce61d8..8eb06999b 100644 --- a/packages/serializer/src/Normalizers/UnitEnumNormalizer.php +++ b/packages/serializer/src/Normalizers/UnitEnumNormalizer.php @@ -51,7 +51,7 @@ public function getSupportedTypes(?string $format): array { * @param array $context */ #[Override] - public function normalize(mixed $object, string $format = null, array $context = []): string { + public function normalize(mixed $object, ?string $format = null, array $context = []): string { if (!$this->supportsNormalization($object, $format)) { throw new InvalidArgumentException( sprintf( @@ -71,7 +71,7 @@ public function normalize(mixed $object, string $format = null, array $context = * @phpstan-assert-if-true UnitEnum $data */ #[Override] - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool { + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof UnitEnum && !($data instanceof BackedEnum); } @@ -79,7 +79,7 @@ public function supportsNormalization(mixed $data, string $format = null, array * @param array $context */ #[Override] - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed { + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { // Just for the case if (!is_string($data)) { throw new InvalidArgumentException( @@ -132,7 +132,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar public function supportsDenormalization( mixed $data, string $type, - string $format = null, + ?string $format = null, array $context = [], ): bool { return is_a($type, UnitEnum::class, true) && !is_a($type, BackedEnum::class, true); diff --git a/packages/serializer/src/PackageException.php b/packages/serializer/src/PackageException.php index 768578e35..3d2b373bf 100644 --- a/packages/serializer/src/PackageException.php +++ b/packages/serializer/src/PackageException.php @@ -6,7 +6,7 @@ use Throwable; abstract class PackageException extends Exception { - public function __construct(string $message, Throwable $previous = null) { + public function __construct(string $message, ?Throwable $previous = null) { parent::__construct($message, 0, $previous); } } diff --git a/packages/serializer/src/Serializer.php b/packages/serializer/src/Serializer.php index 0baa433f5..08c5fba89 100644 --- a/packages/serializer/src/Serializer.php +++ b/packages/serializer/src/Serializer.php @@ -25,7 +25,7 @@ public function __construct( * @inheritDoc */ #[Override] - public function serialize(object $object, string $format = null, array $context = []): string { + public function serialize(object $object, ?string $format = null, array $context = []): string { $format ??= $this->format; $context += $this->context; @@ -45,7 +45,7 @@ public function serialize(object $object, string $format = null, array $context public function deserialize( string $object, string $data, - string $format = null, + ?string $format = null, array $context = [], ): object { $format ??= $this->format; diff --git a/packages/spa/README.md b/packages/spa/README.md index d982a19e2..ddef2e828 100644 --- a/packages/spa/README.md +++ b/packages/spa/README.md @@ -10,7 +10,7 @@ |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/spa/UPGRADE.md b/packages/spa/UPGRADE.md index 1f9780e2c..eba885e1b 100644 --- a/packages/spa/UPGRADE.md +++ b/packages/spa/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/spa/composer.json b/packages/spa/composer.json index c5f8b8513..a67ef4e76 100644 --- a/packages/spa/composer.json +++ b/packages/spa/composer.json @@ -18,7 +18,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-mbstring": "*", "illuminate/collections": "^10.34.0|^11.0.0", "illuminate/contracts": "^10.34.0|^11.0.0", @@ -28,7 +28,7 @@ "illuminate/routing": "^10.34.0|^11.0.0", "illuminate/support": "^10.34.0|^11.0.0", "illuminate/validation": "^10.34.0|^11.0.0", - "guzzlehttp/psr7": "^1.9.1|^2.4.5", + "guzzlehttp/psr7": "^2.4.5", "lastdragon-ru/lara-asp-core": "self.version", "symfony/deprecation-contracts": "^3.0.0", "symfony/http-kernel": "^6.3.0|^7.0.0", @@ -37,7 +37,7 @@ "require-dev": { "phpunit/phpunit": "^10.1.0|^11.0.0", "lastdragon-ru/lara-asp-testing": "self.version", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "orchestra/testbench": "^8.0.0|^9.0.0" }, "autoload": { diff --git a/packages/spa/metadata.json b/packages/spa/metadata.json index 7f45518ce..41a272054 100644 --- a/packages/spa/metadata.json +++ b/packages/spa/metadata.json @@ -10,8 +10,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ] }, "6.4.1": { diff --git a/packages/spa/src/Http/Controllers/SpaControllerTest.php b/packages/spa/src/Http/Controllers/SpaControllerTest.php index 25b7da6dd..7a3ad7b17 100644 --- a/packages/spa/src/Http/Controllers/SpaControllerTest.php +++ b/packages/spa/src/Http/Controllers/SpaControllerTest.php @@ -33,7 +33,7 @@ final class SpaControllerTest extends TestCase { public function testSettings( Response $expected, bool $routes = true, - string $prefix = null, + ?string $prefix = null, array $headers = [], array $settings = [], ): void { diff --git a/packages/spa/src/Routing/Resolver.php b/packages/spa/src/Routing/Resolver.php index 6425d3225..a0a03afa7 100644 --- a/packages/spa/src/Routing/Resolver.php +++ b/packages/spa/src/Routing/Resolver.php @@ -42,7 +42,7 @@ abstract protected function resolve(mixed $value, array $parameters): mixed; * * @return array */ - protected function resolveParameters(Request $request = null, Route $route = null): array { + protected function resolveParameters(?Request $request = null, ?Route $route = null): array { return []; } // @@ -54,7 +54,7 @@ protected function resolveParameters(Request $request = null, Route $route = nul * * @throws UnresolvedValueException */ - public function get(mixed $value, Request $request = null, Route $route = null): mixed { + public function get(mixed $value, ?Request $request = null, ?Route $route = null): mixed { $route = $route ?: $this->router->getCurrentRoute(); $request = $request ?: $this->router->getCurrentRequest(); $parameters = $this->resolveParameters($request, $route); diff --git a/packages/spa/src/Routing/ResolverTest.php b/packages/spa/src/Routing/ResolverTest.php index ed3bf40ef..e600f76a9 100644 --- a/packages/spa/src/Routing/ResolverTest.php +++ b/packages/spa/src/Routing/ResolverTest.php @@ -33,7 +33,7 @@ protected function resolve(mixed $value, array $parameters): mixed { * @inheritDoc */ #[Override] - protected function resolveParameters(Request $request = null, Route $route = null): array { + protected function resolveParameters(?Request $request = null, ?Route $route = null): array { return [ 'property' => 'value', ]; diff --git a/packages/spa/src/Routing/UnresolvedValueException.php b/packages/spa/src/Routing/UnresolvedValueException.php index f493b619d..786d58370 100644 --- a/packages/spa/src/Routing/UnresolvedValueException.php +++ b/packages/spa/src/Routing/UnresolvedValueException.php @@ -10,7 +10,7 @@ class UnresolvedValueException extends RuntimeException { protected mixed $value; - public function __construct(mixed $value, string $message = '', int $code = 0, Throwable $previous = null) { + public function __construct(mixed $value, string $message = '', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->value = $value; diff --git a/packages/testing/README.md b/packages/testing/README.md index 6640b8120..3c89b41e6 100644 --- a/packages/testing/README.md +++ b/packages/testing/README.md @@ -12,7 +12,7 @@ This package provides various useful asserts for [PHPUnit](https://phpunit.de/) |--------------|---------------------|------------------| | PHP | `^8.3` | `HEAD ⋯ 5.0.0` | | | `^8.2` | `HEAD ⋯ 2.0.0` | -| | `^8.1` | `HEAD ⋯ 2.0.0` | +| | `^8.1` | `6.4.1 ⋯ 2.0.0` | | | `^8.0` | `4.6.0 ⋯ 2.0.0` | | | `^8.0.0` | `1.1.2 ⋯ 0.12.0` | | | `>=8.0.0` | `0.11.0 ⋯ 0.4.0` | diff --git a/packages/testing/UPGRADE.md b/packages/testing/UPGRADE.md index 4da28c070..894201930 100644 --- a/packages/testing/UPGRADE.md +++ b/packages/testing/UPGRADE.md @@ -33,6 +33,8 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) [//]: # (start: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) [//]: # (warning: Generated automatically. Do not edit.) +* [ ] PHP 8.1 is not supported anymore. Migrate to the newer version. + * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). [//]: # (end: 470dd21d18d5886f1873b1247130ac8173ed99258e41418c6bd32162325d628b) diff --git a/packages/testing/composer.json b/packages/testing/composer.json index 544d0c83a..091f31f51 100644 --- a/packages/testing/composer.json +++ b/packages/testing/composer.json @@ -19,7 +19,7 @@ "forum": "https://github.com/LastDragon-ru/lara-asp/discussions" }, "require": { - "php": "^8.1|^8.2|^8.3", + "php": "^8.2|^8.3", "ext-json": "*", "ext-libxml": "*", "ext-dom": "*", @@ -34,7 +34,7 @@ "illuminate/database": "^10.34.0|^11.0.0", "illuminate/testing": "^10.34.0|^11.0.0", "illuminate/translation": "^10.34.0|^11.0.0", - "mockery/mockery": "^1.6.2", + "mockery/mockery": "^1.6.5", "opis/json-schema": "^2.3.0", "phpunit/phpunit": "^10.1.0|^11.0.0", "psr/http-message": "^1.0.0|^2.0.0", @@ -49,7 +49,7 @@ }, "require-dev": { "fakerphp/faker": "^1.21.0", - "guzzlehttp/psr7": "^1.9.1|^2.4.5", + "guzzlehttp/psr7": "^2.4.5", "illuminate/http": "^10.34.0|^11.0.0", "laravel/scout": "^9.8.0|^10.0.0", "orchestra/testbench": "^8.0.0|^9.0.0", diff --git a/packages/testing/metadata.json b/packages/testing/metadata.json index 54d804bb9..e5910f341 100644 --- a/packages/testing/metadata.json +++ b/packages/testing/metadata.json @@ -14,8 +14,7 @@ ], "php": [ "^8.3", - "^8.2", - "^8.1" + "^8.2" ], "phpunit/phpunit": [ "^11.0.0", diff --git a/packages/testing/src/Database/QueryLog/WithQueryLog.php b/packages/testing/src/Database/QueryLog/WithQueryLog.php index 9b928ee36..c611a428e 100644 --- a/packages/testing/src/Database/QueryLog/WithQueryLog.php +++ b/packages/testing/src/Database/QueryLog/WithQueryLog.php @@ -49,7 +49,7 @@ protected function initWithQueryLog(): void { /** * @param Connection|ConnectionResolverInterface|Model|class-string|string|null $connection */ - protected function getQueryLog(ConnectionResolverInterface|Connection|Model|string $connection = null): QueryLog { + protected function getQueryLog(ConnectionResolverInterface|Connection|Model|string|null $connection = null): QueryLog { // Normalize connection if (is_string($connection) && is_a($connection, Model::class, true)) { $connection = new $connection(); diff --git a/packages/testing/src/Exceptions/InvalidArgumentClass.php b/packages/testing/src/Exceptions/InvalidArgumentClass.php index d90a8fbff..eba84f096 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentClass.php +++ b/packages/testing/src/Exceptions/InvalidArgumentClass.php @@ -10,7 +10,7 @@ class InvalidArgumentClass extends InvalidArgument { public function __construct( protected string $argument, protected string $class, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be a class with known path, `%2$s` given.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentDatabaseQuery.php b/packages/testing/src/Exceptions/InvalidArgumentDatabaseQuery.php index 576ac9471..2adac38f9 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentDatabaseQuery.php +++ b/packages/testing/src/Exceptions/InvalidArgumentDatabaseQuery.php @@ -10,7 +10,7 @@ class InvalidArgumentDatabaseQuery extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be Database query, `%2$s` given.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentJson.php b/packages/testing/src/Exceptions/InvalidArgumentJson.php index e33e1c19b..d77b42230 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentJson.php +++ b/packages/testing/src/Exceptions/InvalidArgumentJson.php @@ -10,7 +10,7 @@ class InvalidArgumentJson extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be a valid JSON.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentJsonSchema.php b/packages/testing/src/Exceptions/InvalidArgumentJsonSchema.php index 31718e85f..ffb7f494c 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentJsonSchema.php +++ b/packages/testing/src/Exceptions/InvalidArgumentJsonSchema.php @@ -10,7 +10,7 @@ class InvalidArgumentJsonSchema extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be a valid JSON Schema.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentResponse.php b/packages/testing/src/Exceptions/InvalidArgumentResponse.php index 50ecbc75c..b191b90ee 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentResponse.php +++ b/packages/testing/src/Exceptions/InvalidArgumentResponse.php @@ -11,7 +11,7 @@ class InvalidArgumentResponse extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be instance of `%2$s`, `%3$s` given.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentScoutQuery.php b/packages/testing/src/Exceptions/InvalidArgumentScoutQuery.php index fc4de9d09..fb314a55f 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentScoutQuery.php +++ b/packages/testing/src/Exceptions/InvalidArgumentScoutQuery.php @@ -10,7 +10,7 @@ class InvalidArgumentScoutQuery extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfo.php b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfo.php index 71d0dc038..a489d649c 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfo.php +++ b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfo.php @@ -11,7 +11,7 @@ class InvalidArgumentSplFileInfo extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be instance of `%2$s`, `%3$s` given.', diff --git a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotAFile.php b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotAFile.php index 19098ddb3..dec19ba26 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotAFile.php +++ b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotAFile.php @@ -11,7 +11,7 @@ class InvalidArgumentSplFileInfoIsNotAFile extends InvalidArgument { public function __construct( protected string $argument, protected SplFileInfo $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` is not a file (path: `%2$s`).', diff --git a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotReadable.php b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotReadable.php index 250e58d85..8f0b3a662 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotReadable.php +++ b/packages/testing/src/Exceptions/InvalidArgumentSplFileInfoIsNotReadable.php @@ -13,7 +13,7 @@ class InvalidArgumentSplFileInfoIsNotReadable extends InvalidArgumentException i public function __construct( protected string $argument, protected SplFileInfo $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` is file but not readable (path: `%2$s`).', diff --git a/packages/testing/src/Exceptions/InvalidArgumentXml.php b/packages/testing/src/Exceptions/InvalidArgumentXml.php index 45a017e3f..6e11123ee 100644 --- a/packages/testing/src/Exceptions/InvalidArgumentXml.php +++ b/packages/testing/src/Exceptions/InvalidArgumentXml.php @@ -11,7 +11,7 @@ class InvalidArgumentXml extends InvalidArgument { public function __construct( protected string $argument, protected mixed $value, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Argument `%1$s` must be instance of `%2$s` or a valid XML string.', diff --git a/packages/testing/src/Exceptions/TranslatorUnsupported.php b/packages/testing/src/Exceptions/TranslatorUnsupported.php index ecb0643cd..a0dcf7ff2 100644 --- a/packages/testing/src/Exceptions/TranslatorUnsupported.php +++ b/packages/testing/src/Exceptions/TranslatorUnsupported.php @@ -16,7 +16,7 @@ class TranslatorUnsupported extends Exception implements PackageException { */ public function __construct( private string $implementation, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct(sprintf( 'Only `%s` supported, `%s` given.', diff --git a/packages/testing/src/Package/WithFaker.php b/packages/testing/src/Package/WithFaker.php index 350bf8b5e..24da17aea 100644 --- a/packages/testing/src/Package/WithFaker.php +++ b/packages/testing/src/Package/WithFaker.php @@ -24,7 +24,7 @@ protected function withFakerAfter(): void { $this->withFaker = []; } - protected function getFaker(string $locale = null): Generator { + protected function getFaker(?string $locale = null): Generator { $locale ??= Factory::DEFAULT_LOCALE; $this->withFaker[$locale] ??= Factory::create($locale); diff --git a/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponse.php b/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponse.php index ebfd99d60..d0a7e5714 100644 --- a/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponse.php +++ b/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponse.php @@ -26,7 +26,7 @@ class ValidationErrorResponse extends Response { /** * @param array|string|null>|null $errors */ - public function __construct(array $errors = null) { + public function __construct(?array $errors = null) { parent::__construct( new UnprocessableEntity(), new JsonContentType(), diff --git a/packages/testing/src/Utils/WithTempFile.php b/packages/testing/src/Utils/WithTempFile.php index 039e288bc..87459626e 100644 --- a/packages/testing/src/Utils/WithTempFile.php +++ b/packages/testing/src/Utils/WithTempFile.php @@ -14,7 +14,7 @@ * after script shutdown. */ trait WithTempFile { - public static function getTempFile(string $content = null, string $suffix = ''): SplFileInfo { + public static function getTempFile(?string $content = null, string $suffix = ''): SplFileInfo { $fs = new Filesystem(); $pkg = Package::Name; $path = $fs->tempnam(sys_get_temp_dir(), $pkg, $suffix); diff --git a/packages/testing/src/Utils/WithTestData.php b/packages/testing/src/Utils/WithTestData.php index 129318c50..4e459dae5 100644 --- a/packages/testing/src/Utils/WithTestData.php +++ b/packages/testing/src/Utils/WithTestData.php @@ -10,7 +10,7 @@ trait WithTestData { /** * @param class-string|null $class */ - public static function getTestData(string $class = null): TestData { + public static function getTestData(?string $class = null): TestData { return new TestData($class ?? static::class); } } diff --git a/phpcs.xml b/phpcs.xml index 1a270ae88..6be45f512 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -158,4 +158,5 @@ +