diff --git a/pint.json b/pint.json index ab7c113389..ce1bb7fead 100644 --- a/pint.json +++ b/pint.json @@ -6,9 +6,6 @@ "method": "one" } }, - "nullable_type_declaration_for_default_null_value": { - "use_nullable_type_declaration": false - }, "psr_autoloading": true } } diff --git a/src/Actions/DuplicateEntry.php b/src/Actions/DuplicateEntry.php index c7e1a35f47..b214b72b3f 100644 --- a/src/Actions/DuplicateEntry.php +++ b/src/Actions/DuplicateEntry.php @@ -55,7 +55,7 @@ public function run($items, $values) ->each(fn ($original) => $this->duplicateEntry($original)); } - private function duplicateEntry(Entry $original, string $origin = null) + private function duplicateEntry(Entry $original, ?string $origin = null) { $originalParent = $this->getEntryParentFromStructure($original); [$title, $slug] = $this->generateTitleAndSlug($original); diff --git a/src/Assets/Asset.php b/src/Assets/Asset.php index 3113e33229..7d74229c30 100644 --- a/src/Assets/Asset.php +++ b/src/Assets/Asset.php @@ -886,7 +886,7 @@ public function reupload(ReplacementFile $file) * * @return \Symfony\Component\HttpFoundation\StreamedResponse */ - public function download(string $name = null, array $headers = []) + public function download(?string $name = null, array $headers = []) { return $this->disk()->filesystem()->download($this->path(), $name, $headers); } diff --git a/src/Assets/FileUploader.php b/src/Assets/FileUploader.php index ac7bc71370..e36d5e40aa 100644 --- a/src/Assets/FileUploader.php +++ b/src/Assets/FileUploader.php @@ -15,7 +15,7 @@ public function __construct($container) $this->container = $container ? AssetContainer::find($container) : null; } - public static function container(string $container = null) + public static function container(?string $container = null) { return new static($container); } diff --git a/src/Auth/Eloquent/RoleRepository.php b/src/Auth/Eloquent/RoleRepository.php index 02a1543f48..64045cec54 100644 --- a/src/Auth/Eloquent/RoleRepository.php +++ b/src/Auth/Eloquent/RoleRepository.php @@ -7,7 +7,7 @@ class RoleRepository extends BaseRepository { - public function make(string $handle = null): RoleContract + public function make(?string $handle = null): RoleContract { return (new Role)->handle($handle); } diff --git a/src/Auth/Eloquent/User.php b/src/Auth/Eloquent/User.php index 605c0886eb..f63ef51c0c 100644 --- a/src/Auth/Eloquent/User.php +++ b/src/Auth/Eloquent/User.php @@ -20,7 +20,7 @@ class User extends BaseUser protected $roles; protected $groups; - public function model(Model $model = null) + public function model(?Model $model = null) { if (is_null($model)) { return $this->model; diff --git a/src/Auth/File/Role.php b/src/Auth/File/Role.php index 95b786b40b..66261f0571 100644 --- a/src/Auth/File/Role.php +++ b/src/Auth/File/Role.php @@ -24,7 +24,7 @@ public function __construct() $this->permissions = collect(); } - public function title(string $title = null) + public function title(?string $title = null) { if (func_num_args() === 0) { return $this->title; @@ -40,7 +40,7 @@ public function id(): string return $this->handle(); } - public function handle(string $handle = null) + public function handle(?string $handle = null) { if (func_num_args() === 0) { return $this->handle; diff --git a/src/Auth/File/RoleRepository.php b/src/Auth/File/RoleRepository.php index 4c5e8acac5..8aab8498f1 100644 --- a/src/Auth/File/RoleRepository.php +++ b/src/Auth/File/RoleRepository.php @@ -7,7 +7,7 @@ class RoleRepository extends BaseRepository { - public function make(string $handle = null): RoleContract + public function make(?string $handle = null): RoleContract { return (new Role)->handle($handle); } diff --git a/src/Auth/Permission.php b/src/Auth/Permission.php index f1adc87c4d..b06731a9f6 100644 --- a/src/Auth/Permission.php +++ b/src/Auth/Permission.php @@ -18,7 +18,7 @@ class Permission protected $description; protected $group; - public function value(string $value = null) + public function value(?string $value = null) { if (func_num_args() > 0) { $this->value = $value; @@ -39,7 +39,7 @@ public function originalLabel() return $this->label; } - public function label(string $label = null) + public function label(?string $label = null) { if (func_num_args() > 0) { $this->label = $label; @@ -52,17 +52,17 @@ public function label(string $label = null) return __($label, [$this->placeholder => $this->placeholderLabel]); } - public function placeholder(string $placeholder = null) + public function placeholder(?string $placeholder = null) { return $this->fluentlyGetOrSet('placeholder')->args(func_get_args()); } - public function placeholderLabel(string $label = null) + public function placeholderLabel(?string $label = null) { return $this->fluentlyGetOrSet('placeholderLabel')->args(func_get_args()); } - public function placeholderValue(string $placeholderValue = null) + public function placeholderValue(?string $placeholderValue = null) { return $this->fluentlyGetOrSet('placeholderValue')->args(func_get_args()); } @@ -103,7 +103,7 @@ public function permissions() })->values(); } - public function children(array $children = null) + public function children(?array $children = null) { return $this ->fluentlyGetOrSet('children') @@ -156,7 +156,7 @@ public function toTree() })->all(); } - public function group(string $group = null) + public function group(?string $group = null) { return $this->fluentlyGetOrSet('group')->args(func_get_args()); } diff --git a/src/Auth/UserGroup.php b/src/Auth/UserGroup.php index ba1021d492..0eba8f5ae3 100644 --- a/src/Auth/UserGroup.php +++ b/src/Auth/UserGroup.php @@ -29,7 +29,7 @@ public function __construct() $this->data = collect(); } - public function title(string $title = null) + public function title(?string $title = null) { if (func_num_args() === 0) { return $this->title; @@ -45,7 +45,7 @@ public function id(): string return $this->handle(); } - public function handle(string $handle = null) + public function handle(?string $handle = null) { if (is_null($handle)) { return $this->handle; diff --git a/src/CP/Utilities/Utility.php b/src/CP/Utilities/Utility.php index 676e7c2c38..0519202cbb 100644 --- a/src/CP/Utilities/Utility.php +++ b/src/CP/Utilities/Utility.php @@ -99,7 +99,7 @@ public function url() return cp_route('utilities.index').'/'.$this->slug(); } - public function routes(Closure $routes = null) + public function routes(?Closure $routes = null) { return $this->fluentlyGetOrSet('routes')->args(func_get_args()); } diff --git a/src/Console/Processes/Composer.php b/src/Console/Processes/Composer.php index aecd448047..0157feb377 100644 --- a/src/Console/Processes/Composer.php +++ b/src/Console/Processes/Composer.php @@ -109,7 +109,7 @@ public function installedPath(string $package) * * @param mixed $extraParams */ - public function require(string $package, string $version = null, ...$extraParams) + public function require(string $package, ?string $version = null, ...$extraParams) { if ($version) { $parts[] = $version; @@ -125,7 +125,7 @@ public function require(string $package, string $version = null, ...$extraParams /** * Require a dev package. */ - public function requireDev(string $package, string $version = null, ...$extraParams) + public function requireDev(string $package, ?string $version = null, ...$extraParams) { $this->require($package, $version, '--dev', ...$extraParams); } diff --git a/src/Contracts/Assets/Asset.php b/src/Contracts/Assets/Asset.php index a15721fe7b..3cdd211dd2 100644 --- a/src/Contracts/Assets/Asset.php +++ b/src/Contracts/Assets/Asset.php @@ -76,7 +76,7 @@ public function upload(UploadedFile $file); * * @return \Symfony\Component\HttpFoundation\StreamedResponse */ - public function download(string $name = null, array $headers = []); + public function download(?string $name = null, array $headers = []); /** * Get the asset file contents. diff --git a/src/Contracts/Assets/AssetContainerRepository.php b/src/Contracts/Assets/AssetContainerRepository.php index 9343323044..7f906992c0 100644 --- a/src/Contracts/Assets/AssetContainerRepository.php +++ b/src/Contracts/Assets/AssetContainerRepository.php @@ -12,5 +12,5 @@ public function find($id): ?AssetContainer; public function findByHandle(string $handle): ?AssetContainer; - public function make(string $handle = null): AssetContainer; + public function make(?string $handle = null): AssetContainer; } diff --git a/src/Contracts/Auth/Role.php b/src/Contracts/Auth/Role.php index 14a951d57b..62e5e7691f 100644 --- a/src/Contracts/Auth/Role.php +++ b/src/Contracts/Auth/Role.php @@ -6,9 +6,9 @@ interface Role { public function id(): string; - public function title(string $title = null); + public function title(?string $title = null); - public function handle(string $handle = null); + public function handle(?string $handle = null); public function permissions($permissions = null); diff --git a/src/Contracts/Auth/RoleRepository.php b/src/Contracts/Auth/RoleRepository.php index cd51d83c62..794accbc5f 100644 --- a/src/Contracts/Auth/RoleRepository.php +++ b/src/Contracts/Auth/RoleRepository.php @@ -12,5 +12,5 @@ public function find(string $id): ?Role; public function exists(string $id): bool; - public function make(string $handle = null): Role; + public function make(?string $handle = null): Role; } diff --git a/src/Contracts/Auth/UserGroup.php b/src/Contracts/Auth/UserGroup.php index e8da6f1cf2..fdafe39f15 100644 --- a/src/Contracts/Auth/UserGroup.php +++ b/src/Contracts/Auth/UserGroup.php @@ -6,9 +6,9 @@ interface UserGroup { public function id(): string; - public function title(string $title = null); + public function title(?string $title = null); - public function handle(string $slug = null); + public function handle(?string $slug = null); public function users(); diff --git a/src/Contracts/Entries/CollectionRepository.php b/src/Contracts/Entries/CollectionRepository.php index 331b7c212a..34ea4209f7 100644 --- a/src/Contracts/Entries/CollectionRepository.php +++ b/src/Contracts/Entries/CollectionRepository.php @@ -14,7 +14,7 @@ public function findByHandle($handle): ?Collection; public function findByMount($mount): ?Collection; - public function make(string $handle = null): Collection; + public function make(?string $handle = null): Collection; public function handles(): IlluminateCollection; diff --git a/src/Contracts/Structures/NavigationRepository.php b/src/Contracts/Structures/NavigationRepository.php index 8e9cb0b7bc..0a09becf3d 100644 --- a/src/Contracts/Structures/NavigationRepository.php +++ b/src/Contracts/Structures/NavigationRepository.php @@ -14,5 +14,5 @@ public function findByHandle($handle): ?Nav; public function save(Nav $nav); - public function make(string $handle = null): Nav; + public function make(?string $handle = null): Nav; } diff --git a/src/Contracts/Taxonomies/TaxonomyRepository.php b/src/Contracts/Taxonomies/TaxonomyRepository.php index 8f5e362425..0e0b6690c1 100644 --- a/src/Contracts/Taxonomies/TaxonomyRepository.php +++ b/src/Contracts/Taxonomies/TaxonomyRepository.php @@ -14,7 +14,7 @@ public function findByHandle($handle): ?Taxonomy; public function findByUri(string $uri): ?Taxonomy; - public function make(string $handle = null): Taxonomy; + public function make(?string $handle = null): Taxonomy; public function handles(): Collection; diff --git a/src/Contracts/Taxonomies/TermRepository.php b/src/Contracts/Taxonomies/TermRepository.php index 81ea9b0b8e..98914cec30 100644 --- a/src/Contracts/Taxonomies/TermRepository.php +++ b/src/Contracts/Taxonomies/TermRepository.php @@ -14,7 +14,7 @@ public function find($id); public function findByUri(string $uri); - public function make(string $slug = null); + public function make(?string $slug = null); public function query(); diff --git a/src/Entries/Collection.php b/src/Entries/Collection.php index 35c7fff87a..33b00ddbf6 100644 --- a/src/Entries/Collection.php +++ b/src/Entries/Collection.php @@ -678,7 +678,7 @@ public function structure($structure = null) ->args(func_get_args()); } - public function structureContents(array $contents = null) + public function structureContents(?array $contents = null) { return $this ->fluentlyGetOrSet('structureContents') diff --git a/src/Fields/FieldsetRepository.php b/src/Fields/FieldsetRepository.php index 7bcd8bb20d..fabcf2e98f 100644 --- a/src/Fields/FieldsetRepository.php +++ b/src/Fields/FieldsetRepository.php @@ -175,7 +175,7 @@ public function addNamespace(string $namespace, string $directory): void $this->hints[$namespace] = $directory; } - protected function getFieldsetsByDirectory(string $directory, string $namespace = null): Collection + protected function getFieldsetsByDirectory(string $directory, ?string $namespace = null): Collection { return File::withAbsolutePaths() ->getFilesByTypeRecursively($directory, 'yaml') diff --git a/src/Fields/Fieldtype.php b/src/Fields/Fieldtype.php index da9217cbc4..9c1bca046a 100644 --- a/src/Fields/Fieldtype.php +++ b/src/Fields/Fieldtype.php @@ -309,7 +309,7 @@ public function view() : 'statamic::forms.fields.default'; } - public function config(string $key = null, $fallback = null) + public function config(?string $key = null, $fallback = null) { if (! $this->field) { return $fallback; diff --git a/src/Fieldtypes/Date.php b/src/Fieldtypes/Date.php index f66f1d58e8..dda18bf26f 100644 --- a/src/Fieldtypes/Date.php +++ b/src/Fieldtypes/Date.php @@ -182,7 +182,7 @@ private function splitDateTimeForPreProcessSingle(Carbon $carbon) ]; } - private function splitDateTimeForPreProcessRange(array $range = null) + private function splitDateTimeForPreProcessRange(?array $range = null) { return ['date' => $range, 'time' => null]; } diff --git a/src/GraphQL/Queries/Query.php b/src/GraphQL/Queries/Query.php index 5f7cc4e4ee..0dfb1bd8f4 100644 --- a/src/GraphQL/Queries/Query.php +++ b/src/GraphQL/Queries/Query.php @@ -21,7 +21,7 @@ public static function auth($closure) static::$auth = $closure; } - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { if (static::$auth) { return call_user_func_array(static::$auth, [$root, $args, $ctx, $resolveInfo, $getSelectFields]); diff --git a/src/GraphQL/Types/ArrayType.php b/src/GraphQL/Types/ArrayType.php index 0da8903ec2..cdf8a13d3a 100644 --- a/src/GraphQL/Types/ArrayType.php +++ b/src/GraphQL/Types/ArrayType.php @@ -21,7 +21,7 @@ public function parseValue($value) return $value; } - public function parseLiteral(Node $valueNode, array $variables = null) + public function parseLiteral(Node $valueNode, ?array $variables = null) { return $valueNode->value; } diff --git a/src/Imaging/GuzzleAdapter.php b/src/Imaging/GuzzleAdapter.php index cbdf5cdb5e..867320ac4f 100644 --- a/src/Imaging/GuzzleAdapter.php +++ b/src/Imaging/GuzzleAdapter.php @@ -40,7 +40,7 @@ class GuzzleAdapter implements FilesystemAdapter * @param string $base The base URL. * @param \GuzzleHttp\ClientInterface $client An optional Guzzle client. */ - public function __construct($base, ClientInterface $client = null) + public function __construct($base, ?ClientInterface $client = null) { $this->base = rtrim($base, '/').'/'; $this->client = $client ?: new Client(); diff --git a/src/Imaging/ResponseFactory.php b/src/Imaging/ResponseFactory.php index b7d1cfa277..40e33c0271 100644 --- a/src/Imaging/ResponseFactory.php +++ b/src/Imaging/ResponseFactory.php @@ -20,7 +20,7 @@ class ResponseFactory implements ResponseFactoryInterface * * @param Request|null $request Request object to check "is not modified". */ - public function __construct(Request $request = null) + public function __construct(?Request $request = null) { $this->request = $request; } diff --git a/src/Preferences/Preference.php b/src/Preferences/Preference.php index 4e3574d021..a2adfbc79f 100644 --- a/src/Preferences/Preference.php +++ b/src/Preferences/Preference.php @@ -8,7 +8,7 @@ class Preference protected $field; protected $tab = 'general'; - public function handle(string $handle = null) + public function handle(?string $handle = null) { if (func_num_args() === 0) { return $this->handle; @@ -19,7 +19,7 @@ public function handle(string $handle = null) return $this; } - public function field(array $field = null) + public function field(?array $field = null) { if (func_num_args() === 0) { return $this->field; @@ -30,7 +30,7 @@ public function field(array $field = null) return $this; } - public function tab(string $tab = null) + public function tab(?string $tab = null) { if (func_num_args() === 0) { return $this->tab; diff --git a/src/Search/Index.php b/src/Search/Index.php index a57bab55c3..9cf98a2d98 100644 --- a/src/Search/Index.php +++ b/src/Search/Index.php @@ -21,7 +21,7 @@ abstract protected function insertDocuments(Documents $documents); abstract protected function deleteIndex(); - public function __construct($name, array $config, string $locale = null) + public function __construct($name, array $config, ?string $locale = null) { $this->name = $locale ? $name.'_'.$locale : $name; $this->config = $config; diff --git a/src/Search/Result.php b/src/Search/Result.php index ee39290413..f44d8ed528 100644 --- a/src/Search/Result.php +++ b/src/Search/Result.php @@ -61,7 +61,7 @@ public function getReference(): string return $this->searchable->getSearchReference(); } - public function setScore(int $score = null): self + public function setScore(?int $score = null): self { $this->score = $score; diff --git a/src/Search/Searchables/Providers.php b/src/Search/Searchables/Providers.php index 7d1d8916b1..368726acd5 100644 --- a/src/Search/Searchables/Providers.php +++ b/src/Search/Searchables/Providers.php @@ -30,7 +30,7 @@ public function providers(): Collection }); } - public function make(string $key, Index $index = null, array $keys = null) + public function make(string $key, ?Index $index = null, ?array $keys = null) { if (! $provider = $this->providers()->get($key)) { throw new \Exception('Unknown searchable ['.$key.']'); diff --git a/src/Stache/Repositories/AssetContainerRepository.php b/src/Stache/Repositories/AssetContainerRepository.php index 3f46ba37a1..7fcb89a3e8 100644 --- a/src/Stache/Repositories/AssetContainerRepository.php +++ b/src/Stache/Repositories/AssetContainerRepository.php @@ -33,7 +33,7 @@ public function findByHandle(string $handle): ?AssetContainer return $this->store->getItem($handle); } - public function make(string $handle = null): AssetContainer + public function make(?string $handle = null): AssetContainer { return app(AssetContainer::class)->handle($handle); } diff --git a/src/Stache/Repositories/CollectionRepository.php b/src/Stache/Repositories/CollectionRepository.php index 62ad7cda24..4412d89053 100644 --- a/src/Stache/Repositories/CollectionRepository.php +++ b/src/Stache/Repositories/CollectionRepository.php @@ -51,7 +51,7 @@ public function findByMount($mount): ?Collection }); } - public function make(string $handle = null): Collection + public function make(?string $handle = null): Collection { return app(Collection::class)->handle($handle); } diff --git a/src/Stache/Repositories/EntryRepository.php b/src/Stache/Repositories/EntryRepository.php index e125e500ef..f3d3d738ac 100644 --- a/src/Stache/Repositories/EntryRepository.php +++ b/src/Stache/Repositories/EntryRepository.php @@ -43,7 +43,7 @@ public function find($id): ?Entry return $this->query()->where('id', $id)->first(); } - public function findByUri(string $uri, string $site = null): ?Entry + public function findByUri(string $uri, ?string $site = null): ?Entry { $site = $site ?? $this->stache->sites()->first(); diff --git a/src/Stache/Repositories/NavigationRepository.php b/src/Stache/Repositories/NavigationRepository.php index 7cb58ed416..1ded4311bc 100644 --- a/src/Stache/Repositories/NavigationRepository.php +++ b/src/Stache/Repositories/NavigationRepository.php @@ -45,7 +45,7 @@ public function delete(Nav $nav) $this->store->delete($nav); } - public function make(string $handle = null): Nav + public function make(?string $handle = null): Nav { return app(Nav::class)->handle($handle); } diff --git a/src/Stache/Repositories/TaxonomyRepository.php b/src/Stache/Repositories/TaxonomyRepository.php index d24e010576..0e1bd76fd3 100644 --- a/src/Stache/Repositories/TaxonomyRepository.php +++ b/src/Stache/Repositories/TaxonomyRepository.php @@ -54,12 +54,12 @@ public function delete(Taxonomy $taxonomy) $this->store->delete($taxonomy); } - public function make(string $handle = null): Taxonomy + public function make(?string $handle = null): Taxonomy { return app(Taxonomy::class)->handle($handle); } - public function findByUri(string $uri, string $site = null): ?Taxonomy + public function findByUri(string $uri, ?string $site = null): ?Taxonomy { $collection = Facades\Collection::all() ->first(function ($collection) use ($uri, $site) { diff --git a/src/Stache/Repositories/TermRepository.php b/src/Stache/Repositories/TermRepository.php index e29acfc6d8..ba75a56be7 100644 --- a/src/Stache/Repositories/TermRepository.php +++ b/src/Stache/Repositories/TermRepository.php @@ -45,7 +45,7 @@ public function find($id): ?Term return $this->query()->where('id', $id)->first(); } - public function findByUri(string $uri, string $site = null): ?Term + public function findByUri(string $uri, ?string $site = null): ?Term { $site = $site ?? $this->stache->sites()->first(); @@ -112,7 +112,7 @@ public function query() return new TermQueryBuilder($this->store); } - public function make(string $slug = null): Term + public function make(?string $slug = null): Term { return app(Term::class)->slug($slug); } diff --git a/src/StarterKits/Installer.php b/src/StarterKits/Installer.php index 34b419de63..eaa856f7b0 100644 --- a/src/StarterKits/Installer.php +++ b/src/StarterKits/Installer.php @@ -36,7 +36,7 @@ final class Installer * * @param mixed $console */ - public function __construct(string $package, $console = null, LicenseManager $licenseManager = null) + public function __construct(string $package, $console = null, ?LicenseManager $licenseManager = null) { $this->package = $package; $this->licenseManager = $licenseManager; @@ -51,7 +51,7 @@ public function __construct(string $package, $console = null, LicenseManager $li * @param mixed $console * @return static */ - public static function package(string $package, $console = null, LicenseManager $licenseManager = null) + public static function package(string $package, $console = null, ?LicenseManager $licenseManager = null) { return new self($package, $console, $licenseManager); } diff --git a/src/StaticCaching/NoCache/BladeDirective.php b/src/StaticCaching/NoCache/BladeDirective.php index 5c977d5473..d6cf8cb793 100644 --- a/src/StaticCaching/NoCache/BladeDirective.php +++ b/src/StaticCaching/NoCache/BladeDirective.php @@ -14,7 +14,7 @@ public function __construct(Session $nocache) $this->nocache = $nocache; } - public function handle($expression, array $params, array $data = null) + public function handle($expression, array $params, ?array $data = null) { if (func_num_args() == 2) { $data = $params; diff --git a/tests/Antlers/Runtime/PhpEnabledTest.php b/tests/Antlers/Runtime/PhpEnabledTest.php index fbac86d838..4ed5783e92 100644 --- a/tests/Antlers/Runtime/PhpEnabledTest.php +++ b/tests/Antlers/Runtime/PhpEnabledTest.php @@ -105,7 +105,7 @@ public function augment($value) return $value; } - public function config(string $key = null, $fallback = null) + public function config(?string $key = null, $fallback = null) { return true; } @@ -153,7 +153,7 @@ public function augment($value) return $value; } - public function config(string $key = null, $fallback = null) + public function config(?string $key = null, $fallback = null) { return true; } diff --git a/tests/Auth/Eloquent/EloquentUserTest.php b/tests/Auth/Eloquent/EloquentUserTest.php index d1fab7abb0..efb7fde007 100644 --- a/tests/Auth/Eloquent/EloquentUserTest.php +++ b/tests/Auth/Eloquent/EloquentUserTest.php @@ -36,28 +36,28 @@ public function it_gets_roles_already_in_the_db_without_explicitly_assigning_the { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } }; $roleC = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'c'; } }; $roleD = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'd'; } diff --git a/tests/Auth/PermissibleContractTests.php b/tests/Auth/PermissibleContractTests.php index d0352cf13c..8dd99ae522 100644 --- a/tests/Auth/PermissibleContractTests.php +++ b/tests/Auth/PermissibleContractTests.php @@ -19,28 +19,28 @@ public function it_gets_and_assigns_roles() { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } }; $roleC = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'c'; } }; $roleD = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'd'; } @@ -80,28 +80,28 @@ public function it_removes_a_role_assignment() { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } }; $roleC = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'c'; } }; $roleD = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'd'; } @@ -126,14 +126,14 @@ public function it_checks_if_it_has_a_role() { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } @@ -229,7 +229,7 @@ public function it_checks_if_it_has_super_permissions_through_roles_and_groups() { $superRole = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'superrole'; } @@ -241,7 +241,7 @@ public function permissions($permissions = null) }; $nonSuperRole = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'nonsuperrole'; } diff --git a/tests/Auth/UserGroupTest.php b/tests/Auth/UserGroupTest.php index c2a7bda215..ecbf76406d 100644 --- a/tests/Auth/UserGroupTest.php +++ b/tests/Auth/UserGroupTest.php @@ -81,7 +81,7 @@ public function it_gets_and_sets_roles() $role = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'test'; } @@ -98,7 +98,7 @@ public function it_adds_a_role() { $role = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'test'; } @@ -115,7 +115,7 @@ public function it_adds_a_role_using_handle() { $role = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'test'; } @@ -135,21 +135,21 @@ public function it_sets_all_roles() { RoleAPI::shouldReceive('find')->with('one')->andReturn($roleOne = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'one'; } }); RoleAPI::shouldReceive('find')->with('two')->andReturn($roleTwo = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'two'; } }); RoleAPI::shouldReceive('find')->with('three')->andReturn($roleThree = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'three'; } @@ -170,7 +170,7 @@ public function it_removes_a_role() { $role = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'test'; } @@ -189,7 +189,7 @@ public function it_removes_a_role_by_handle() { $role = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'test'; } @@ -209,14 +209,14 @@ public function it_checks_if_it_has_a_role() { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } @@ -233,14 +233,14 @@ public function it_checks_if_it_has_a_role_by_handle() { $roleA = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'a'; } }; $roleB = new class extends Role { - public function handle(string $handle = null) + public function handle(?string $handle = null) { return 'b'; } diff --git a/tests/Modifiers/AddQueryParamTest.php b/tests/Modifiers/AddQueryParamTest.php index 07eb5fd5b1..1f95968224 100644 --- a/tests/Modifiers/AddQueryParamTest.php +++ b/tests/Modifiers/AddQueryParamTest.php @@ -26,7 +26,7 @@ public function it_does_nothing_if_no_parameters_are_passed() $this->assertSame("{$this->baseUrl}#test", $this->modify("{$this->baseUrl}#test")); } - private function modify(string $url, array $queryParam = null) + private function modify(string $url, ?array $queryParam = null) { if (is_null($queryParam)) { return Modify::value($url)->addQueryParam()->fetch(); diff --git a/tests/Modifiers/RemoveQueryParamTest.php b/tests/Modifiers/RemoveQueryParamTest.php index 575fb34119..83174366ab 100644 --- a/tests/Modifiers/RemoveQueryParamTest.php +++ b/tests/Modifiers/RemoveQueryParamTest.php @@ -33,7 +33,7 @@ public function it_does_nothing_if_no_parameters_are_passed() $this->assertSame($this->baseUrl, $this->modify($this->baseUrl)); } - private function modify(string $url, string $queryParamKey = null) + private function modify(string $url, ?string $queryParamKey = null) { if (is_null($queryParamKey)) { return Modify::value($url)->removeQueryParam()->fetch(); diff --git a/tests/Modifiers/SetQueryParamTest.php b/tests/Modifiers/SetQueryParamTest.php index 7b7307ace3..4e6d05fc45 100644 --- a/tests/Modifiers/SetQueryParamTest.php +++ b/tests/Modifiers/SetQueryParamTest.php @@ -63,7 +63,7 @@ public function it_does_nothing_if_no_parameters_are_passed() $this->assertSame($this->baseUrl, $this->modify($this->baseUrl)); } - private function modify(string $url, array $queryParam = null) + private function modify(string $url, ?array $queryParam = null) { if (is_null($queryParam)) { return Modify::value($url)->setQueryParam()->fetch(); diff --git a/tests/Routing/RouteBindingTest.php b/tests/Routing/RouteBindingTest.php index bdc4d721e9..fd5ea972a0 100644 --- a/tests/Routing/RouteBindingTest.php +++ b/tests/Routing/RouteBindingTest.php @@ -169,8 +169,8 @@ public function binds_route_parameters_in_statamic_routes_with_bindings_disabled */ public function binds_route_parameters_in_frontend_routes( $uri, - Closure $enabledCallback = null, - Closure $disabledCallback = null, + ?Closure $enabledCallback = null, + ?Closure $disabledCallback = null, ) { $this->setupContent(); @@ -193,8 +193,8 @@ public function binds_route_parameters_in_frontend_routes( */ public function binds_route_parameters_in_frontend_routes_with_bindings_disabled( $uri, - Closure $enabledCallback = null, - Closure $disabledCallback = null, + ?Closure $enabledCallback = null, + ?Closure $disabledCallback = null, ) { $this->setupContent(); diff --git a/tests/TestCase.php b/tests/TestCase.php index db295ac12a..14da03defd 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -177,7 +177,7 @@ public static function assertArraySubset($subset, $array, bool $checkForObjectId } // This method is unavailable on earlier versions of Laravel. - public function partialMock($abstract, \Closure $mock = null) + public function partialMock($abstract, ?\Closure $mock = null) { $mock = \Mockery::mock(...array_filter(func_get_args()))->makePartial(); $this->app->instance($abstract, $mock); diff --git a/tests/View/Antlers/ParserTests.php b/tests/View/Antlers/ParserTests.php index 08029ec3a5..ccd7a6c897 100644 --- a/tests/View/Antlers/ParserTests.php +++ b/tests/View/Antlers/ParserTests.php @@ -1144,7 +1144,7 @@ public function augment($value) return 'augmented '.$value; } - public function config(string $key = null, $fallback = null) + public function config(?string $key = null, $fallback = null) { return true; } @@ -1158,7 +1158,7 @@ public function augment($value) return 'augmented '.$value; } - public function config(string $key = null, $fallback = null) + public function config(?string $key = null, $fallback = null) { return false; }