From 8615ec2c25ad559f41a404e57e512f806d2000ed Mon Sep 17 00:00:00 2001 From: Aleksei Lebedev <1329824+LastDragon-ru@users.noreply.github.com> Date: Sat, 20 Jul 2024 10:29:41 +0400 Subject: [PATCH] Enabled `SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue` rule (phpcs). --- packages/core/src/Helpers/Translator.php | 4 +- packages/dev/src/App/Example.php | 4 +- .../documentator/src/PackageException.php | 2 +- .../Exceptions/CircularDependency.php | 2 +- .../Exceptions/DependencyNotFound.php | 2 +- .../Processor/Exceptions/FileSaveFailed.php | 2 +- .../Processor/Exceptions/FileTaskFailed.php | 2 +- .../Processor/Exceptions/ProcessingFailed.php | 2 +- .../Exceptions/DependencyIsMissing.php | 2 +- .../Exceptions/InstructionFailed.php | 2 +- .../Exceptions/PreprocessFailed.php | 2 +- .../Exceptions/ArtisanCommandError.php | 2 +- .../Exceptions/ArtisanCommandFailed.php | 2 +- .../Exceptions/TargetIsNotValidPhpFile.php | 2 +- .../Exceptions/DocumentTitleIsMissing.php | 2 +- .../Exceptions/ExampleFailed.php | 2 +- .../Exceptions/TargetExecFailed.php | 2 +- .../Exceptions/TargetIsNotDirective.php | 2 +- .../PackageComposerJsonIsMissing.php | 2 +- .../Exceptions/PackageReadmeIsEmpty.php | 2 +- .../PackageReadmeTitleIsMissing.php | 2 +- .../Exceptions/TemplateDataMissed.php | 2 +- .../Exceptions/TemplateVariablesMissed.php | 2 +- .../Exceptions/TemplateVariablesUnused.php | 2 +- packages/documentator/src/Utils/Git.php | 10 ++-- packages/documentator/src/Utils/Markdown.php | 2 +- .../src/Exceptions/PropertyIsNotRelation.php | 2 +- .../Iterators/ChunkedChangeSafeIterator.php | 2 +- .../src/Mixins/EloquentBuilderMixin.php | 4 +- packages/eloquent/src/PackageException.php | 2 +- .../FailedToCreateDateFormatter.php | 2 +- .../FailedToCreateNumberFormatter.php | 2 +- .../src/Exceptions/FailedToFormatValue.php | 2 +- packages/formatter/src/Formatter.php | 46 +++++++++---------- packages/formatter/src/PackageException.php | 2 +- .../src/Blocks/Document/DirectivesTest.php | 2 +- .../Exceptions/DirectiveArgumentNotFound.php | 2 +- .../DirectiveDefinitionNotFound.php | 2 +- .../src/Exceptions/FieldArgumentNotFound.php | 2 +- .../src/Exceptions/FieldNotFound.php | 2 +- .../src/Exceptions/TypeNotFound.php | 2 +- .../src/Exceptions/Unsupported.php | 2 +- .../graphql-printer/src/PackageException.php | 2 +- packages/graphql-printer/src/Printer.php | 2 +- packages/graphql-printer/src/PrinterTest.php | 4 +- .../src/Testing/GraphQLAssertions.php | 2 +- .../src/Builder/Contracts/Enhancer.php | 4 +- .../Builder/Directives/HandlerDirective.php | 8 ++-- .../src/Builder/Exceptions/BuilderUnknown.php | 2 +- .../Exceptions/Client/ConditionEmpty.php | 2 +- .../Client/ConditionTooManyFields.php | 2 +- .../Client/ConditionTooManyOperators.php | 2 +- .../FakeTypeDefinitionIsNotFake.php | 2 +- .../Exceptions/FakeTypeDefinitionUnknown.php | 2 +- .../Exceptions/HandlerInvalidConditions.php | 2 +- .../OperatorImpossibleToCreateField.php | 2 +- .../Exceptions/OperatorUnsupportedBuilder.php | 2 +- .../TypeDefinitionFieldAlreadyDefined.php | 2 +- .../TypeDefinitionImpossibleToCreateType.php | 2 +- .../TypeDefinitionInvalidTypeName.php | 2 +- .../TypeDefinitionIsNotScalarExtension.php | 2 +- .../graphql/src/Builder/Scalars/Internal.php | 2 +- .../src/Exceptions/ArgumentAlreadyDefined.php | 2 +- .../graphql/src/Exceptions/NotImplemented.php | 2 +- .../TypeDefinitionAlreadyDefined.php | 2 +- .../src/Exceptions/TypeDefinitionUnknown.php | 2 +- .../graphql/src/Exceptions/TypeUnexpected.php | 2 +- packages/graphql/src/PackageException.php | 2 +- packages/graphql/src/Printer/PrinterTest.php | 4 +- .../graphql/src/Scalars/JsonStringType.php | 2 +- .../FailedToCreateSearchCondition.php | 2 +- .../OperatorInvalidArgumentValue.php | 2 +- .../SearchBy/Operators/Comparison/InTest.php | 2 +- .../graphql/src/SortBy/Contracts/Sorter.php | 2 +- .../Exceptions/FailedToCreateSortClause.php | 2 +- .../SortBy/Exceptions/RelationUnsupported.php | 2 +- .../graphql/src/SortBy/Operators/SortTest.php | 2 +- .../src/SortBy/Sorters/DatabaseSorter.php | 2 +- .../src/SortBy/Sorters/DatabaseSorterTest.php | 6 +-- .../src/SortBy/Sorters/EloquentSorter.php | 2 +- .../src/SortBy/Sorters/QuerySorter.php | 2 +- .../src/SortBy/Sorters/ScoutSorter.php | 2 +- .../src/Stream/Directives/Directive.php | 2 +- .../src/Stream/Exceptions/ArgumentMissed.php | 2 +- .../src/Stream/Exceptions/BuilderInvalid.php | 2 +- .../Stream/Exceptions/BuilderUnsupported.php | 2 +- .../Client/ArgumentsMutuallyExclusive.php | 2 +- .../Exceptions/Client/CursorInvalidPath.php | 2 +- .../src/Stream/Exceptions/FieldIsNotList.php | 2 +- .../Stream/Exceptions/FieldIsSubscription.php | 2 +- .../src/Stream/Exceptions/FieldIsUnion.php | 2 +- .../src/Stream/Exceptions/KeyUnknown.php | 2 +- .../graphql/src/Stream/Scalars/Offset.php | 2 +- .../graphql/src/Testing/GraphQLAssertions.php | 2 +- .../Package/Models/Concerns/Concerns.php | 2 +- .../graphql/src/Testing/Package/TestCase.php | 4 +- packages/graphql/src/Utils/AstManipulator.php | 2 +- .../graphql/src/Utils/AstManipulatorTest.php | 2 +- .../migrator/src/Concerns/RawSqlHelper.php | 4 +- .../src/Exceptions/ConnectionUnknown.php | 2 +- .../src/Exceptions/DatabaseSeeded.php | 2 +- .../migrator/src/Exceptions/FileNotFound.php | 2 +- .../src/Exceptions/SchemaStateUnsupported.php | 2 +- packages/migrator/src/PackageException.php | 2 +- packages/migrator/src/Seeders/SmartSeeder.php | 2 +- .../serializer/src/Casts/AsSerializable.php | 2 +- .../serializer/src/Contracts/Serializer.php | 4 +- .../src/Exceptions/FailedToCast.php | 2 +- .../src/Exceptions/FailedToDeserialize.php | 2 +- .../src/Exceptions/FailedToSerialize.php | 2 +- packages/serializer/src/Factory.php | 2 +- .../src/Normalizers/DateTimeNormalizer.php | 8 ++-- .../Normalizers/SerializableNormalizer.php | 8 ++-- .../src/Normalizers/UnitEnumNormalizer.php | 8 ++-- packages/serializer/src/PackageException.php | 2 +- packages/serializer/src/Serializer.php | 4 +- .../Http/Controllers/SpaControllerTest.php | 2 +- packages/spa/src/Routing/Resolver.php | 4 +- packages/spa/src/Routing/ResolverTest.php | 2 +- .../src/Routing/UnresolvedValueException.php | 2 +- .../src/Database/QueryLog/WithQueryLog.php | 2 +- .../src/Exceptions/InvalidArgumentClass.php | 2 +- .../InvalidArgumentDatabaseQuery.php | 2 +- .../src/Exceptions/InvalidArgumentJson.php | 2 +- .../Exceptions/InvalidArgumentJsonSchema.php | 2 +- .../Exceptions/InvalidArgumentResponse.php | 2 +- .../Exceptions/InvalidArgumentScoutQuery.php | 2 +- .../Exceptions/InvalidArgumentSplFileInfo.php | 2 +- .../InvalidArgumentSplFileInfoIsNotAFile.php | 2 +- ...nvalidArgumentSplFileInfoIsNotReadable.php | 2 +- .../src/Exceptions/InvalidArgumentXml.php | 2 +- .../src/Exceptions/TranslatorUnsupported.php | 2 +- packages/testing/src/Package/WithFaker.php | 2 +- .../Laravel/Json/ValidationErrorResponse.php | 2 +- packages/testing/src/Utils/WithTempFile.php | 2 +- packages/testing/src/Utils/WithTestData.php | 2 +- phpcs.xml | 1 + 137 files changed, 188 insertions(+), 187 deletions(-) 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/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/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/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/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/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/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/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/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 553047e8c..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, ) { 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/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/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/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/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/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/Exceptions/FailedToCreateSearchCondition.php b/packages/graphql/src/SearchBy/Exceptions/FailedToCreateSearchCondition.php index 1fc71d6e5..f3a39e2d9 100644 --- a/packages/graphql/src/SearchBy/Exceptions/FailedToCreateSearchCondition.php +++ b/packages/graphql/src/SearchBy/Exceptions/FailedToCreateSearchCondition.php @@ -10,7 +10,7 @@ class FailedToCreateSearchCondition extends SearchByException { public function __construct( protected Stringable|string $source, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/SearchBy/Exceptions/OperatorInvalidArgumentValue.php b/packages/graphql/src/SearchBy/Exceptions/OperatorInvalidArgumentValue.php index 109a60ac6..5fd6b25d3 100644 --- a/packages/graphql/src/SearchBy/Exceptions/OperatorInvalidArgumentValue.php +++ b/packages/graphql/src/SearchBy/Exceptions/OperatorInvalidArgumentValue.php @@ -13,7 +13,7 @@ public function __construct( protected Operator $operator, protected string $expected, protected mixed $actual, - Throwable $previous = null, + ?Throwable $previous = null, ) { parent::__construct( sprintf( diff --git a/packages/graphql/src/SearchBy/Operators/Comparison/InTest.php b/packages/graphql/src/SearchBy/Operators/Comparison/InTest.php index fb7bc8411..14cccf5e4 100644 --- a/packages/graphql/src/SearchBy/Operators/Comparison/InTest.php +++ b/packages/graphql/src/SearchBy/Operators/Comparison/InTest.php @@ -79,7 +79,7 @@ public function testCallScoutBuilder( Closure $argumentFactory, ?Closure $contextFactory, ?Closure $resolver, - Closure $fieldResolver = null, + ?Closure $fieldResolver = null, ): void { if ($fieldResolver) { $this->override(FieldResolver::class, $fieldResolver); 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/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/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 0dfea067b..c86b2807a 100644 --- a/packages/graphql/src/Utils/AstManipulator.php +++ b/packages/graphql/src/Utils/AstManipulator.php @@ -677,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)) { diff --git a/packages/graphql/src/Utils/AstManipulatorTest.php b/packages/graphql/src/Utils/AstManipulatorTest.php index c5a81e8ed..3ff9dc481 100644 --- a/packages/graphql/src/Utils/AstManipulatorTest.php +++ b/packages/graphql/src/Utils/AstManipulatorTest.php @@ -599,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/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/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/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/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 @@ +