Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Laravel Pint: Use the default for nullable_type_declaration_for_default_null_value #9181

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"method": "one"
}
},
"nullable_type_declaration_for_default_null_value": {
"use_nullable_type_declaration": false
},
"psr_autoloading": true
}
}
2 changes: 1 addition & 1 deletion src/Actions/DuplicateEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Assets/FileUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Eloquent/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Eloquent/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Auth/File/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/File/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Auth/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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());
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public function permissions()
})->values();
}

public function children(array $children = null)
public function children(?array $children = null)
{
return $this
->fluentlyGetOrSet('children')
Expand Down Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions src/Auth/UserGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/CP/Utilities/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Processes/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Assets/AssetContainerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions src/Contracts/Auth/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Auth/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions src/Contracts/Auth/UserGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Entries/CollectionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Structures/NavigationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/Contracts/Taxonomies/TaxonomyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Taxonomies/TermRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Entries/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/FieldsetRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Fieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Fieldtypes/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/Queries/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/Types/ArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Imaging/GuzzleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Imaging/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Preferences/Preference.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Search/Searchables/Providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.']');
Expand Down
2 changes: 1 addition & 1 deletion src/Stache/Repositories/AssetContainerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading
Loading