From 2c6f1bd538f46b93645991518398bb087011cb42 Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Thu, 21 Mar 2024 15:22:19 +0000 Subject: Implicit/explicit nullable types for PHP 8.4 --- app/Auth.php | 12 ++--- app/Cache.php | 2 +- app/Contracts/FamilyFactoryInterface.php | 2 +- app/Contracts/GedcomRecordFactoryInterface.php | 2 +- app/Contracts/HeaderFactoryInterface.php | 2 +- app/Contracts/IndividualFactoryInterface.php | 2 +- app/Contracts/LocationFactoryInterface.php | 2 +- app/Contracts/MarkdownFactoryInterface.php | 4 +- app/Contracts/MediaFactoryInterface.php | 2 +- app/Contracts/NoteFactoryInterface.php | 2 +- app/Contracts/RepositoryFactoryInterface.php | 2 +- app/Contracts/SharedNoteFactoryInterface.php | 2 +- app/Contracts/SourceFactoryInterface.php | 2 +- app/Contracts/SubmissionFactoryInterface.php | 2 +- app/Contracts/SubmitterFactoryInterface.php | 2 +- app/Contracts/TimestampFactoryInterface.php | 6 +-- app/Date.php | 2 +- app/Elements/AbstractElement.php | 2 +- app/Elements/NamePersonal.php | 2 +- app/Fact.php | 2 +- app/Factories/FamilyFactory.php | 2 +- app/Factories/GedcomRecordFactory.php | 2 +- app/Factories/HeaderFactory.php | 2 +- app/Factories/IndividualFactory.php | 2 +- app/Factories/LocationFactory.php | 2 +- app/Factories/MarkdownFactory.php | 4 +- app/Factories/MediaFactory.php | 2 +- app/Factories/NoteFactory.php | 2 +- app/Factories/RepositoryFactory.php | 2 +- app/Factories/SharedNoteFactory.php | 2 +- app/Factories/SourceFactory.php | 2 +- app/Factories/SubmissionFactory.php | 2 +- app/Factories/SubmitterFactory.php | 2 +- app/Factories/TimestampFactory.php | 6 +-- app/Family.php | 12 ++--- app/GedcomRecord.php | 8 ++-- app/Http/Exceptions/HttpAccessDeniedException.php | 2 +- app/Http/Exceptions/HttpBadRequestException.php | 2 +- app/Http/Exceptions/HttpGoneException.php | 2 +- app/Http/Exceptions/HttpNotFoundException.php | 2 +- .../Exceptions/HttpTooManyRequestsException.php | 2 +- app/Individual.php | 6 +-- app/Log.php | 4 +- app/Module/BranchesListModule.php | 2 +- app/Module/FamilyTreeStatisticsModule.php | 2 +- app/Module/IndividualListModule.php | 2 +- app/Module/InteractiveTree/TreeView.php | 2 +- app/Module/TopSurnamesModule.php | 2 +- app/Registry.php | 56 +++++++++++----------- app/Services/GedcomExportService.php | 4 +- app/Services/LinkedRecordService.php | 4 +- app/Services/RelationshipService.php | 2 +- app/Services/TimeoutService.php | 2 +- app/Statistics.php | 38 +++++++-------- app/Statistics/Google/ChartBirth.php | 2 +- app/Statistics/Google/ChartCommonGiven.php | 2 +- app/Statistics/Google/ChartCommonSurname.php | 2 +- app/Statistics/Google/ChartDeath.php | 2 +- app/Statistics/Google/ChartDivorce.php | 2 +- app/Statistics/Google/ChartFamilyLargest.php | 4 +- app/Statistics/Google/ChartFamilyWithSources.php | 2 +- .../Google/ChartIndividualWithSources.php | 2 +- app/Statistics/Google/ChartMarriage.php | 2 +- app/Statistics/Google/ChartMedia.php | 2 +- app/Statistics/Google/ChartMortality.php | 2 +- app/Statistics/Google/ChartSex.php | 4 +- app/Statistics/Repository/FamilyRepository.php | 8 ++-- app/Statistics/Repository/IndividualRepository.php | 22 ++++----- .../Interfaces/IndividualRepositoryInterface.php | 4 +- .../Interfaces/LatestUserRepositoryInterface.php | 6 +-- .../Interfaces/MediaRepositoryInterface.php | 2 +- app/Statistics/Repository/LatestUserRepository.php | 6 +-- app/Statistics/Repository/MediaRepository.php | 2 +- app/Tree.php | 2 +- app/Validator.php | 8 ++-- 75 files changed, 167 insertions(+), 167 deletions(-) (limited to 'app') diff --git a/app/Auth.php b/app/Auth.php index afbbf51272..e882459564 100644 --- a/app/Auth.php +++ b/app/Auth.php @@ -55,7 +55,7 @@ class Auth * * @return bool */ - public static function isAdmin(UserInterface $user = null): bool + public static function isAdmin(UserInterface|null $user = null): bool { $user ??= self::user(); @@ -70,7 +70,7 @@ class Auth * * @return bool */ - public static function isManager(Tree $tree, UserInterface $user = null): bool + public static function isManager(Tree $tree, UserInterface|null $user = null): bool { $user ??= self::user(); @@ -85,7 +85,7 @@ class Auth * * @return bool */ - public static function isModerator(Tree $tree, UserInterface $user = null): bool + public static function isModerator(Tree $tree, UserInterface|null $user = null): bool { $user ??= self::user(); @@ -102,7 +102,7 @@ class Auth * * @return bool */ - public static function isEditor(Tree $tree, UserInterface $user = null): bool + public static function isEditor(Tree $tree, UserInterface|null $user = null): bool { $user ??= self::user(); @@ -119,7 +119,7 @@ class Auth * * @return bool */ - public static function isMember(Tree $tree, UserInterface $user = null): bool + public static function isMember(Tree $tree, UserInterface|null $user = null): bool { $user ??= self::user(); @@ -136,7 +136,7 @@ class Auth * * @return int */ - public static function accessLevel(Tree $tree, UserInterface $user = null): int + public static function accessLevel(Tree $tree, UserInterface|null $user = null): int { $user ??= self::user(); diff --git a/app/Cache.php b/app/Cache.php index 859421325e..a5facae9d3 100644 --- a/app/Cache.php +++ b/app/Cache.php @@ -50,7 +50,7 @@ class Cache * * @return T */ - public function remember(string $key, Closure $closure, int $ttl = null) + public function remember(string $key, Closure $closure, int|null $ttl = null) { return $this->cache->get(md5($key), static function (ItemInterface $item) use ($closure, $ttl) { $item->expiresAfter($ttl); diff --git a/app/Contracts/FamilyFactoryInterface.php b/app/Contracts/FamilyFactoryInterface.php index 93c1d5356d..d543d94171 100644 --- a/app/Contracts/FamilyFactoryInterface.php +++ b/app/Contracts/FamilyFactoryInterface.php @@ -37,7 +37,7 @@ interface FamilyFactoryInterface extends GedcomRecordFactoryInterface * * @return Family|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Family; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Family; /** * Create a Family object from a row in the database. diff --git a/app/Contracts/GedcomRecordFactoryInterface.php b/app/Contracts/GedcomRecordFactoryInterface.php index f254422428..d10aba8f60 100644 --- a/app/Contracts/GedcomRecordFactoryInterface.php +++ b/app/Contracts/GedcomRecordFactoryInterface.php @@ -37,7 +37,7 @@ interface GedcomRecordFactoryInterface * * @return GedcomRecord|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?GedcomRecord; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?GedcomRecord; /** * Create a GedcomRecord object from raw GEDCOM data. diff --git a/app/Contracts/HeaderFactoryInterface.php b/app/Contracts/HeaderFactoryInterface.php index b2b7ed3a9e..4cd55fa25e 100644 --- a/app/Contracts/HeaderFactoryInterface.php +++ b/app/Contracts/HeaderFactoryInterface.php @@ -37,7 +37,7 @@ interface HeaderFactoryInterface extends GedcomRecordFactoryInterface * * @return Header|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Header; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Header; /** * Create a header from a row in the database. diff --git a/app/Contracts/IndividualFactoryInterface.php b/app/Contracts/IndividualFactoryInterface.php index 0ed1cc72fa..f72979459d 100644 --- a/app/Contracts/IndividualFactoryInterface.php +++ b/app/Contracts/IndividualFactoryInterface.php @@ -37,7 +37,7 @@ interface IndividualFactoryInterface extends GedcomRecordFactoryInterface * * @return Individual|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Individual; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Individual; /** * Create an individual from a row in the database. diff --git a/app/Contracts/LocationFactoryInterface.php b/app/Contracts/LocationFactoryInterface.php index d440e9eadc..e9fec7becc 100644 --- a/app/Contracts/LocationFactoryInterface.php +++ b/app/Contracts/LocationFactoryInterface.php @@ -37,7 +37,7 @@ interface LocationFactoryInterface extends GedcomRecordFactoryInterface * * @return Location|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Location; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Location; /** * Create a Location from a row in the database. diff --git a/app/Contracts/MarkdownFactoryInterface.php b/app/Contracts/MarkdownFactoryInterface.php index 9cb2d48ed7..20693b3444 100644 --- a/app/Contracts/MarkdownFactoryInterface.php +++ b/app/Contracts/MarkdownFactoryInterface.php @@ -32,7 +32,7 @@ interface MarkdownFactoryInterface * * @return string */ - public function autolink(string $markdown, Tree $tree = null): string; + public function autolink(string $markdown, Tree|null $tree = null): string; /** * @param string $markdown @@ -40,5 +40,5 @@ interface MarkdownFactoryInterface * * @return string */ - public function markdown(string $markdown, Tree $tree = null): string; + public function markdown(string $markdown, Tree|null $tree = null): string; } diff --git a/app/Contracts/MediaFactoryInterface.php b/app/Contracts/MediaFactoryInterface.php index b7d32a421d..697fc89ed7 100644 --- a/app/Contracts/MediaFactoryInterface.php +++ b/app/Contracts/MediaFactoryInterface.php @@ -37,7 +37,7 @@ interface MediaFactoryInterface extends GedcomRecordFactoryInterface * * @return Media|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Media; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Media; /** * Create a media object from a row in the database. diff --git a/app/Contracts/NoteFactoryInterface.php b/app/Contracts/NoteFactoryInterface.php index d5b2d81958..4158f7f040 100644 --- a/app/Contracts/NoteFactoryInterface.php +++ b/app/Contracts/NoteFactoryInterface.php @@ -37,7 +37,7 @@ interface NoteFactoryInterface extends GedcomRecordFactoryInterface * * @return Note|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Note; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Note; /** * Create a note from a row in the database. diff --git a/app/Contracts/RepositoryFactoryInterface.php b/app/Contracts/RepositoryFactoryInterface.php index d6fd17ef3d..f1ebb5c09a 100644 --- a/app/Contracts/RepositoryFactoryInterface.php +++ b/app/Contracts/RepositoryFactoryInterface.php @@ -37,7 +37,7 @@ interface RepositoryFactoryInterface extends GedcomRecordFactoryInterface * * @return Repository|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Repository; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Repository; /** * Create a source from a row in the database. diff --git a/app/Contracts/SharedNoteFactoryInterface.php b/app/Contracts/SharedNoteFactoryInterface.php index e5a1de89f0..6130e6f9ea 100644 --- a/app/Contracts/SharedNoteFactoryInterface.php +++ b/app/Contracts/SharedNoteFactoryInterface.php @@ -37,7 +37,7 @@ interface SharedNoteFactoryInterface extends GedcomRecordFactoryInterface * * @return SharedNote|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?SharedNote; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?SharedNote; /** * Create a note from a row in the database. diff --git a/app/Contracts/SourceFactoryInterface.php b/app/Contracts/SourceFactoryInterface.php index c85776a7e5..9bc7c0a247 100644 --- a/app/Contracts/SourceFactoryInterface.php +++ b/app/Contracts/SourceFactoryInterface.php @@ -37,7 +37,7 @@ interface SourceFactoryInterface extends GedcomRecordFactoryInterface * * @return Source|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Source; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Source; /** * Create a source from a row in the database. diff --git a/app/Contracts/SubmissionFactoryInterface.php b/app/Contracts/SubmissionFactoryInterface.php index 34966081aa..1a17dd513d 100644 --- a/app/Contracts/SubmissionFactoryInterface.php +++ b/app/Contracts/SubmissionFactoryInterface.php @@ -37,7 +37,7 @@ interface SubmissionFactoryInterface extends GedcomRecordFactoryInterface * * @return Submission|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Submission; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submission; /** * Create a submission from a row in the database. diff --git a/app/Contracts/SubmitterFactoryInterface.php b/app/Contracts/SubmitterFactoryInterface.php index d3328d3339..326b4d6eab 100644 --- a/app/Contracts/SubmitterFactoryInterface.php +++ b/app/Contracts/SubmitterFactoryInterface.php @@ -37,7 +37,7 @@ interface SubmitterFactoryInterface extends GedcomRecordFactoryInterface * * @return Submitter|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Submitter; + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submitter; /** * Create a submitter from a row in the database. diff --git a/app/Contracts/TimestampFactoryInterface.php b/app/Contracts/TimestampFactoryInterface.php index 4e21dad92a..62e754c9cc 100644 --- a/app/Contracts/TimestampFactoryInterface.php +++ b/app/Contracts/TimestampFactoryInterface.php @@ -30,7 +30,7 @@ interface TimestampFactoryInterface * * @return TimestampInterface */ - public function make(int $timestamp, UserInterface $user = null): TimestampInterface; + public function make(int $timestamp, UserInterface|null $user = null): TimestampInterface; /** * @param string|null $string YYYY-MM-DD HH:MM:SS (as provided by SQL). @@ -39,12 +39,12 @@ interface TimestampFactoryInterface * * @return TimestampInterface */ - public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface $user = null): TimestampInterface; + public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface; /** * @param UserInterface|null $user * * @return TimestampInterface */ - public function now(UserInterface $user = null): TimestampInterface; + public function now(UserInterface|null $user = null): TimestampInterface; } diff --git a/app/Date.php b/app/Date.php index d7eff837cc..5197052242 100644 --- a/app/Date.php +++ b/app/Date.php @@ -98,7 +98,7 @@ class Date * * @return string */ - public function display(Tree $tree = null, string $date_format = null, bool $convert_calendars = false): string + public function display(Tree|null $tree = null, string|null $date_format = null, bool $convert_calendars = false): string { if ($tree instanceof Tree) { $CALENDAR_FORMAT = $tree->getPreference('CALENDAR_FORMAT'); diff --git a/app/Elements/AbstractElement.php b/app/Elements/AbstractElement.php index 9b91dcc79f..35fffd1ccc 100644 --- a/app/Elements/AbstractElement.php +++ b/app/Elements/AbstractElement.php @@ -78,7 +78,7 @@ abstract class AbstractElement implements ElementInterface * @param string $label * @param array|null $subtags */ - public function __construct(string $label, array $subtags = null) + public function __construct(string $label, array|null $subtags = null) { $this->label = $label; $this->subtags = $subtags ?? static::SUBTAGS; diff --git a/app/Elements/NamePersonal.php b/app/Elements/NamePersonal.php index 9c4f64f5ce..3ae6f383af 100644 --- a/app/Elements/NamePersonal.php +++ b/app/Elements/NamePersonal.php @@ -89,7 +89,7 @@ class NamePersonal extends AbstractElement * @param string $label * @param array|null $subtags */ - public function __construct(string $label, array $subtags = null) + public function __construct(string $label, array|null $subtags = null) { if ($subtags === null && in_array(I18N::languageTag(), static::SURNAME_FIRST_LANGUAGES, true)) { $subtags = static::SUBTAGS_SURNAME_FIRST; diff --git a/app/Fact.php b/app/Fact.php index fa81baaf57..fe5f92ffdc 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -313,7 +313,7 @@ class Fact * * @return bool */ - public function canShow(int $access_level = null): bool + public function canShow(int|null $access_level = null): bool { $access_level ??= Auth::accessLevel($this->record->tree()); diff --git a/app/Factories/FamilyFactory.php b/app/Factories/FamilyFactory.php index ac0259a9e7..33ae7ff81b 100644 --- a/app/Factories/FamilyFactory.php +++ b/app/Factories/FamilyFactory.php @@ -45,7 +45,7 @@ class FamilyFactory extends AbstractGedcomRecordFactory implements FamilyFactory * * @return Family|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Family + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Family { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/GedcomRecordFactory.php b/app/Factories/GedcomRecordFactory.php index 875ec196dd..c046db9b09 100644 --- a/app/Factories/GedcomRecordFactory.php +++ b/app/Factories/GedcomRecordFactory.php @@ -52,7 +52,7 @@ class GedcomRecordFactory extends AbstractGedcomRecordFactory implements GedcomR * * @return GedcomRecord|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?GedcomRecord + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?GedcomRecord { // We know the type of the record. Return it directly. if ($gedcom !== null && preg_match('/^0(?: @[^@]+@)? ([A-Z_]+)/', $gedcom, $match)) { diff --git a/app/Factories/HeaderFactory.php b/app/Factories/HeaderFactory.php index e0808629c5..0a3122298c 100644 --- a/app/Factories/HeaderFactory.php +++ b/app/Factories/HeaderFactory.php @@ -44,7 +44,7 @@ class HeaderFactory extends AbstractGedcomRecordFactory implements HeaderFactory * * @return Header|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Header + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Header { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/IndividualFactory.php b/app/Factories/IndividualFactory.php index ee9aea9bac..39b21a6708 100644 --- a/app/Factories/IndividualFactory.php +++ b/app/Factories/IndividualFactory.php @@ -44,7 +44,7 @@ class IndividualFactory extends AbstractGedcomRecordFactory implements Individua * * @return Individual|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Individual + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Individual { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/LocationFactory.php b/app/Factories/LocationFactory.php index 9cc0054289..dac5b1a673 100644 --- a/app/Factories/LocationFactory.php +++ b/app/Factories/LocationFactory.php @@ -44,7 +44,7 @@ class LocationFactory extends AbstractGedcomRecordFactory implements LocationFac * * @return Location|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Location + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Location { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/MarkdownFactory.php b/app/Factories/MarkdownFactory.php index 09df669976..57d51f78ce 100644 --- a/app/Factories/MarkdownFactory.php +++ b/app/Factories/MarkdownFactory.php @@ -83,7 +83,7 @@ class MarkdownFactory implements MarkdownFactoryInterface * * @return string */ - public function autolink(string $markdown, Tree $tree = null): string + public function autolink(string $markdown, Tree|null $tree = null): string { // Create a minimal commonmark processor - just add support for auto-links. $environment = new Environment(static::CONFIG_AUTOLINK); @@ -117,7 +117,7 @@ class MarkdownFactory implements MarkdownFactoryInterface * * @return string */ - public function markdown(string $markdown, Tree $tree = null): string + public function markdown(string $markdown, Tree|null $tree = null): string { $environment = new Environment(static::CONFIG_MARKDOWN); $environment->addExtension(new CommonMarkCoreExtension()); diff --git a/app/Factories/MediaFactory.php b/app/Factories/MediaFactory.php index 177a8aacaa..2d985c32d6 100644 --- a/app/Factories/MediaFactory.php +++ b/app/Factories/MediaFactory.php @@ -44,7 +44,7 @@ class MediaFactory extends AbstractGedcomRecordFactory implements MediaFactoryIn * * @return Media|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Media + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Media { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/NoteFactory.php b/app/Factories/NoteFactory.php index c678c48242..bb45a48ce1 100644 --- a/app/Factories/NoteFactory.php +++ b/app/Factories/NoteFactory.php @@ -44,7 +44,7 @@ class NoteFactory extends AbstractGedcomRecordFactory implements NoteFactoryInte * * @return Note|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Note + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Note { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/RepositoryFactory.php b/app/Factories/RepositoryFactory.php index 60bc75e9fb..7eb111fe20 100644 --- a/app/Factories/RepositoryFactory.php +++ b/app/Factories/RepositoryFactory.php @@ -45,7 +45,7 @@ class RepositoryFactory extends AbstractGedcomRecordFactory implements Repositor * * @return Repository|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Repository + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Repository { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/SharedNoteFactory.php b/app/Factories/SharedNoteFactory.php index ada5b8e294..657d7c49db 100644 --- a/app/Factories/SharedNoteFactory.php +++ b/app/Factories/SharedNoteFactory.php @@ -44,7 +44,7 @@ class SharedNoteFactory extends AbstractGedcomRecordFactory implements SharedNot * * @return SharedNote|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?SharedNote + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?SharedNote { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/SourceFactory.php b/app/Factories/SourceFactory.php index 2c1193452a..d7a3d58a7b 100644 --- a/app/Factories/SourceFactory.php +++ b/app/Factories/SourceFactory.php @@ -45,7 +45,7 @@ class SourceFactory extends AbstractGedcomRecordFactory implements SourceFactory * * @return Source|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Source + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Source { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/SubmissionFactory.php b/app/Factories/SubmissionFactory.php index 4af0fd81d3..e02e99a64a 100644 --- a/app/Factories/SubmissionFactory.php +++ b/app/Factories/SubmissionFactory.php @@ -44,7 +44,7 @@ class SubmissionFactory extends AbstractGedcomRecordFactory implements Submissio * * @return Submission|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Submission + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submission { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/SubmitterFactory.php b/app/Factories/SubmitterFactory.php index 8518c00aea..a4e69d320f 100644 --- a/app/Factories/SubmitterFactory.php +++ b/app/Factories/SubmitterFactory.php @@ -44,7 +44,7 @@ class SubmitterFactory extends AbstractGedcomRecordFactory implements SubmitterF * * @return Submitter|null */ - public function make(string $xref, Tree $tree, string $gedcom = null): ?Submitter + public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submitter { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); diff --git a/app/Factories/TimestampFactory.php b/app/Factories/TimestampFactory.php index 46c4086e1a..46b97ea2e2 100644 --- a/app/Factories/TimestampFactory.php +++ b/app/Factories/TimestampFactory.php @@ -43,7 +43,7 @@ class TimestampFactory implements TimestampFactoryInterface * * @return TimestampInterface */ - public function make(int $timestamp, UserInterface $user = null): TimestampInterface + public function make(int $timestamp, UserInterface|null $user = null): TimestampInterface { $user ??= Auth::user(); $timezone = $user->getPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE')); @@ -59,7 +59,7 @@ class TimestampFactory implements TimestampFactoryInterface * * @return TimestampInterface */ - public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface $user = null): TimestampInterface + public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface { $string ??= date($format); $timestamp = date_create_from_format($format, $string); @@ -76,7 +76,7 @@ class TimestampFactory implements TimestampFactoryInterface * * @return TimestampInterface */ - public function now(UserInterface $user = null): TimestampInterface + public function now(UserInterface|null $user = null): TimestampInterface { return $this->make(time(), $user); } diff --git a/app/Family.php b/app/Family.php index 8dbdc04357..b4618bcac0 100644 --- a/app/Family.php +++ b/app/Family.php @@ -107,7 +107,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function husband(int $access_level = null): ?Individual + public function husband(int|null $access_level = null): ?Individual { if ($this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS') === '1') { $access_level = Auth::PRIV_HIDE; @@ -127,7 +127,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function wife(int $access_level = null): ?Individual + public function wife(int|null $access_level = null): ?Individual { if ($this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS') === '1') { $access_level = Auth::PRIV_HIDE; @@ -168,7 +168,7 @@ class Family extends GedcomRecord * * @return bool */ - public function canShowName(int $access_level = null): bool + public function canShowName(int|null $access_level = null): bool { // We can always see the name (Husband-name + Wife-name), however, // the name will often be "private + private" @@ -183,7 +183,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function spouse(Individual $person, int $access_level = null): ?Individual + public function spouse(Individual $person, int|null $access_level = null): ?Individual { if ($person === $this->wife) { return $this->husband($access_level); @@ -199,7 +199,7 @@ class Family extends GedcomRecord * * @return Collection */ - public function spouses(int $access_level = null): Collection + public function spouses(int|null $access_level = null): Collection { $spouses = new Collection([ $this->husband($access_level), @@ -216,7 +216,7 @@ class Family extends GedcomRecord * * @return Collection */ - public function children(int $access_level = null): Collection + public function children(int|null $access_level = null): Collection { $access_level ??= Auth::accessLevel($this->tree); diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index 37197eb70b..b314526a1e 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -243,7 +243,7 @@ class GedcomRecord * * @return bool */ - public function canShow(int $access_level = null): bool + public function canShow(int|null $access_level = null): bool { $access_level ??= Auth::accessLevel($this->tree); @@ -267,7 +267,7 @@ class GedcomRecord * * @return bool */ - public function canShowName(int $access_level = null): bool + public function canShowName(int|null $access_level = null): bool { return $this->canShow($access_level); } @@ -429,7 +429,7 @@ class GedcomRecord * * @return void */ - public function setPrimaryName(int $n = null): void + public function setPrimaryName(int|null $n = null): void { $this->getPrimaryName = $n; $this->getSecondaryName = null; @@ -608,7 +608,7 @@ class GedcomRecord public function facts( array $filter = [], bool $sort = false, - int $access_level = null, + int|null $access_level = null, bool $ignore_deleted = false ): Collection { $access_level ??= Auth::accessLevel($this->tree); diff --git a/app/Http/Exceptions/HttpAccessDeniedException.php b/app/Http/Exceptions/HttpAccessDeniedException.php index abc41b28b6..850ac09b1e 100644 --- a/app/Http/Exceptions/HttpAccessDeniedException.php +++ b/app/Http/Exceptions/HttpAccessDeniedException.php @@ -30,7 +30,7 @@ class HttpAccessDeniedException extends HttpException /** * @param string|null $message */ - public function __construct(string $message = null) + public function __construct(string|null $message = null) { $message ??= I18N::translate('You do not have permission to view this page.'); diff --git a/app/Http/Exceptions/HttpBadRequestException.php b/app/Http/Exceptions/HttpBadRequestException.php index c5e3ee7c77..745b2f21cc 100644 --- a/app/Http/Exceptions/HttpBadRequestException.php +++ b/app/Http/Exceptions/HttpBadRequestException.php @@ -30,7 +30,7 @@ class HttpBadRequestException extends HttpException /** * @param string|null $message */ - public function __construct(string $message = null) + public function __construct(string|null $message = null) { $message ??= I18N::translate('The server could not understand this request.'); diff --git a/app/Http/Exceptions/HttpGoneException.php b/app/Http/Exceptions/HttpGoneException.php index 97cce57090..0b6c5cd679 100644 --- a/app/Http/Exceptions/HttpGoneException.php +++ b/app/Http/Exceptions/HttpGoneException.php @@ -30,7 +30,7 @@ class HttpGoneException extends HttpException /** * @param string|null $message */ - public function __construct(string $message = null) + public function __construct(string|null $message = null) { $message ??= I18N::translate('This page has been deleted.'); diff --git a/app/Http/Exceptions/HttpNotFoundException.php b/app/Http/Exceptions/HttpNotFoundException.php index 2edb6211bc..fc69a55f20 100644 --- a/app/Http/Exceptions/HttpNotFoundException.php +++ b/app/Http/Exceptions/HttpNotFoundException.php @@ -30,7 +30,7 @@ class HttpNotFoundException extends HttpException /** * @param string|null $message */ - public function __construct(string $message = null) + public function __construct(string|null $message = null) { $message ??= I18N::translate('You do not have permission to view this page.'); diff --git a/app/Http/Exceptions/HttpTooManyRequestsException.php b/app/Http/Exceptions/HttpTooManyRequestsException.php index 99be059778..a88652badb 100644 --- a/app/Http/Exceptions/HttpTooManyRequestsException.php +++ b/app/Http/Exceptions/HttpTooManyRequestsException.php @@ -30,7 +30,7 @@ class HttpTooManyRequestsException extends HttpException /** * @param string|null $message */ - public function __construct(string $message = null) + public function __construct(string|null $message = null) { $message ??= I18N::translate('Too many requests. Try again later.'); diff --git a/app/Individual.php b/app/Individual.php index 7032652f3c..2e252d73a5 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -82,7 +82,7 @@ class Individual extends GedcomRecord * * @return bool */ - public function canShowName(int $access_level = null): bool + public function canShowName(int|null $access_level = null): bool { $access_level ??= Auth::accessLevel($this->tree); @@ -703,7 +703,7 @@ class Individual extends GedcomRecord * * @return Collection */ - public function spouseFamilies(int $access_level = null): Collection + public function spouseFamilies(int|null $access_level = null): Collection { $access_level ??= Auth::accessLevel($this->tree); @@ -769,7 +769,7 @@ class Individual extends GedcomRecord * * @return Collection */ - public function childFamilies(int $access_level = null): Collection + public function childFamilies(int|null $access_level = null): Collection { $access_level ??= Auth::accessLevel($this->tree); diff --git a/app/Log.php b/app/Log.php index 635b745949..74f3b94471 100644 --- a/app/Log.php +++ b/app/Log.php @@ -55,7 +55,7 @@ class Log * * @return void */ - private static function addLog(string $message, string $log_type, Tree $tree = null): void + private static function addLog(string $message, string $log_type, Tree|null $tree = null): void { if (Registry::container()->has(ServerRequestInterface::class)) { $request = Registry::container()->get(ServerRequestInterface::class); @@ -81,7 +81,7 @@ class Log * * @return void */ - public static function addConfigurationLog(string $message, Tree $tree = null): void + public static function addConfigurationLog(string $message, Tree|null $tree = null): void { self::addLog($message, self::TYPE_CONFIGURATION, $tree); } diff --git a/app/Module/BranchesListModule.php b/app/Module/BranchesListModule.php index 8d10edc8ca..f591d5d3bc 100644 --- a/app/Module/BranchesListModule.php +++ b/app/Module/BranchesListModule.php @@ -378,7 +378,7 @@ class BranchesListModule extends AbstractModule implements ModuleListInterface, * * @return string */ - private function getDescendantsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std, Individual $individual, Family $parents = null): string + private function getDescendantsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std, Individual $individual, Family|null $parents = null): string { $module = $this->module_service->findByComponent(ModuleChartInterface::class, $tree, Auth::user())->first(static function (ModuleInterface $module) { return $module instanceof RelationshipsChartModule; diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php index 6e0a12ad7d..06cf6f545e 100644 --- a/app/Module/FamilyTreeStatisticsModule.php +++ b/app/Module/FamilyTreeStatisticsModule.php @@ -347,7 +347,7 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn * * @return Expression */ - private function binaryColumn(string $column, string $alias = null): Expression + private function binaryColumn(string $column, string|null $alias = null): Expression { if (DB::connection()->getDriverName() === 'mysql') { $sql = 'CAST(' . $column . ' AS binary)'; diff --git a/app/Module/IndividualListModule.php b/app/Module/IndividualListModule.php index 4fe7163674..5720a53d1a 100644 --- a/app/Module/IndividualListModule.php +++ b/app/Module/IndividualListModule.php @@ -832,7 +832,7 @@ class IndividualListModule extends AbstractModule implements ModuleListInterface * * @return Expression */ - private function binaryColumn(string $column, string $alias = null): Expression + private function binaryColumn(string $column, string|null $alias = null): Expression { if (DB::connection()->getDriverName() === 'mysql') { $sql = 'CAST(' . $column . ' AS binary)'; diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php index 7de1c8a12e..8e8ca6816e 100644 --- a/app/Module/InteractiveTree/TreeView.php +++ b/app/Module/InteractiveTree/TreeView.php @@ -149,7 +149,7 @@ class TreeView * * @return string */ - private function getPersonDetails(Individual $individual, Family $family = null): string + private function getPersonDetails(Individual $individual, Family|null $family = null): string { $chart_url = route('module', [ 'module' => 'tree', diff --git a/app/Module/TopSurnamesModule.php b/app/Module/TopSurnamesModule.php index acfdf6a7c6..4b503a9c4f 100644 --- a/app/Module/TopSurnamesModule.php +++ b/app/Module/TopSurnamesModule.php @@ -297,7 +297,7 @@ class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface * * @return Expression */ - private function binaryColumn(string $column, string $alias = null): Expression + private function binaryColumn(string $column, string|null $alias = null): Expression { if (DB::connection()->getDriverName() === 'mysql') { $sql = 'CAST(' . $column . ' AS binary)'; diff --git a/app/Registry.php b/app/Registry.php index cfa91789ae..2a40b4c29d 100644 --- a/app/Registry.php +++ b/app/Registry.php @@ -116,7 +116,7 @@ class Registry * * @return CacheFactoryInterface */ - public static function cache(CacheFactoryInterface $factory = null): CacheFactoryInterface + public static function cache(CacheFactoryInterface|null $factory = null): CacheFactoryInterface { if ($factory instanceof CacheFactoryInterface) { self::$cache_factory = $factory; @@ -132,7 +132,7 @@ class Registry * * @return CalendarDateFactoryInterface */ - public static function calendarDateFactory(CalendarDateFactoryInterface $factory = null): CalendarDateFactoryInterface + public static function calendarDateFactory(CalendarDateFactoryInterface|null $factory = null): CalendarDateFactoryInterface { if ($factory instanceof CalendarDateFactoryInterface) { self::$calendar_date_factory = $factory; @@ -148,7 +148,7 @@ class Registry * * @return ContainerInterface */ - public static function container(ContainerInterface $container = null): ContainerInterface + public static function container(ContainerInterface|null $container = null): ContainerInterface { if ($container instanceof ContainerInterface) { self::$container = $container; @@ -164,7 +164,7 @@ class Registry * * @return ElementFactoryInterface */ - public static function elementFactory(ElementFactoryInterface $factory = null): ElementFactoryInterface + public static function elementFactory(ElementFactoryInterface|null $factory = null): ElementFactoryInterface { if ($factory instanceof ElementFactoryInterface) { self::$element_factory = $factory; @@ -180,7 +180,7 @@ class Registry * * @return EncodingFactoryInterface */ - public static function encodingFactory(EncodingFactoryInterface $factory = null): EncodingFactoryInterface + public static function encodingFactory(EncodingFactoryInterface|null $factory = null): EncodingFactoryInterface { if ($factory instanceof EncodingFactoryInterface) { self::$encoding_factory = $factory; @@ -196,7 +196,7 @@ class Registry * * @return FamilyFactoryInterface */ - public static function familyFactory(FamilyFactoryInterface $factory = null): FamilyFactoryInterface + public static function familyFactory(FamilyFactoryInterface|null $factory = null): FamilyFactoryInterface { if ($factory instanceof FamilyFactoryInterface) { self::$family_factory = $factory; @@ -212,7 +212,7 @@ class Registry * * @return FilesystemFactoryInterface */ - public static function filesystem(FilesystemFactoryInterface $factory = null): FilesystemFactoryInterface + public static function filesystem(FilesystemFactoryInterface|null $factory = null): FilesystemFactoryInterface { if ($factory instanceof FilesystemFactoryInterface) { self::$filesystem_factory = $factory; @@ -228,7 +228,7 @@ class Registry * * @return GedcomRecordFactoryInterface */ - public static function gedcomRecordFactory(GedcomRecordFactoryInterface $factory = null): GedcomRecordFactoryInterface + public static function gedcomRecordFactory(GedcomRecordFactoryInterface|null $factory = null): GedcomRecordFactoryInterface { if ($factory instanceof GedcomRecordFactoryInterface) { self::$gedcom_record_factory = $factory; @@ -244,7 +244,7 @@ class Registry * * @return HeaderFactoryInterface */ - public static function headerFactory(HeaderFactoryInterface $factory = null): HeaderFactoryInterface + public static function headerFactory(HeaderFactoryInterface|null $factory = null): HeaderFactoryInterface { if ($factory instanceof HeaderFactoryInterface) { self::$header_factory = $factory; @@ -260,7 +260,7 @@ class Registry * * @return IdFactoryInterface */ - public static function idFactory(IdFactoryInterface $factory = null): IdFactoryInterface + public static function idFactory(IdFactoryInterface|null $factory = null): IdFactoryInterface { if ($factory instanceof IdFactoryInterface) { self::$id_factory = $factory; @@ -276,7 +276,7 @@ class Registry * * @return ImageFactoryInterface */ - public static function imageFactory(ImageFactoryInterface $factory = null): ImageFactoryInterface + public static function imageFactory(ImageFactoryInterface|null $factory = null): ImageFactoryInterface { if ($factory instanceof ImageFactoryInterface) { self::$image_factory = $factory; @@ -292,7 +292,7 @@ class Registry * * @return IndividualFactoryInterface */ - public static function individualFactory(IndividualFactoryInterface $factory = null): IndividualFactoryInterface + public static function individualFactory(IndividualFactoryInterface|null $factory = null): IndividualFactoryInterface { if ($factory instanceof IndividualFactoryInterface) { self::$individual_factory = $factory; @@ -308,7 +308,7 @@ class Registry * * @return LocationFactoryInterface */ - public static function locationFactory(LocationFactoryInterface $factory = null): LocationFactoryInterface + public static function locationFactory(LocationFactoryInterface|null $factory = null): LocationFactoryInterface { if ($factory instanceof LocationFactoryInterface) { self::$location_factory = $factory; @@ -324,7 +324,7 @@ class Registry * * @return MarkdownFactoryInterface */ - public static function markdownFactory(MarkdownFactoryInterface $factory = null): MarkdownFactoryInterface + public static function markdownFactory(MarkdownFactoryInterface|null $factory = null): MarkdownFactoryInterface { if ($factory instanceof MarkdownFactoryInterface) { self::$markdown_factory = $factory; @@ -340,7 +340,7 @@ class Registry * * @return MediaFactoryInterface */ - public static function mediaFactory(MediaFactoryInterface $factory = null): MediaFactoryInterface + public static function mediaFactory(MediaFactoryInterface|null $factory = null): MediaFactoryInterface { if ($factory instanceof MediaFactoryInterface) { self::$media_factory = $factory; @@ -356,7 +356,7 @@ class Registry * * @return NoteFactoryInterface */ - public static function noteFactory(NoteFactoryInterface $factory = null): NoteFactoryInterface + public static function noteFactory(NoteFactoryInterface|null $factory = null): NoteFactoryInterface { if ($factory instanceof NoteFactoryInterface) { self::$note_factory = $factory; @@ -372,7 +372,7 @@ class Registry * * @return RepositoryFactoryInterface */ - public static function repositoryFactory(RepositoryFactoryInterface $factory = null): RepositoryFactoryInterface + public static function repositoryFactory(RepositoryFactoryInterface|null $factory = null): RepositoryFactoryInterface { if ($factory instanceof RepositoryFactoryInterface) { self::$repository_factory = $factory; @@ -388,7 +388,7 @@ class Registry * * @return ResponseFactoryInterface */ - public static function responseFactory(ResponseFactoryInterface $factory = null): ResponseFactoryInterface + public static function responseFactory(ResponseFactoryInterface|null $factory = null): ResponseFactoryInterface { if ($factory instanceof ResponseFactoryInterface) { self::$response_factory = $factory; @@ -404,7 +404,7 @@ class Registry * * @return RouteFactoryInterface */ - public static function routeFactory(RouteFactoryInterface $factory = null): RouteFactoryInterface + public static function routeFactory(RouteFactoryInterface|null $factory = null): RouteFactoryInterface { if ($factory instanceof RouteFactoryInterface) { self::$route_factory = $factory; @@ -420,7 +420,7 @@ class Registry * * @return SharedNoteFactoryInterface */ - public static function sharedNoteFactory(SharedNoteFactoryInterface $factory = null): SharedNoteFactoryInterface + public static function sharedNoteFactory(SharedNoteFactoryInterface|null $factory = null): SharedNoteFactoryInterface { if ($factory instanceof SharedNoteFactoryInterface) { self::$shared_note_factory = $factory; @@ -436,7 +436,7 @@ class Registry * * @return SlugFactoryInterface */ - public static function slugFactory(SlugFactoryInterface $factory = null): SlugFactoryInterface + public static function slugFactory(SlugFactoryInterface|null $factory = null): SlugFactoryInterface { if ($factory instanceof SlugFactoryInterface) { self::$slug_factory = $factory; @@ -452,7 +452,7 @@ class Registry * * @return SourceFactoryInterface */ - public static function sourceFactory(SourceFactoryInterface $factory = null): SourceFactoryInterface + public static function sourceFactory(SourceFactoryInterface|null $factory = null): SourceFactoryInterface { if ($factory instanceof SourceFactoryInterface) { self::$source_factory = $factory; @@ -468,7 +468,7 @@ class Registry * * @return SubmissionFactoryInterface */ - public static function submissionFactory(SubmissionFactoryInterface $factory = null): SubmissionFactoryInterface + public static function submissionFactory(SubmissionFactoryInterface|null $factory = null): SubmissionFactoryInterface { if ($factory instanceof SubmissionFactoryInterface) { self::$submission_factory = $factory; @@ -484,7 +484,7 @@ class Registry * * @return SubmitterFactoryInterface */ - public static function submitterFactory(SubmitterFactoryInterface $factory = null): SubmitterFactoryInterface + public static function submitterFactory(SubmitterFactoryInterface|null $factory = null): SubmitterFactoryInterface { if ($factory instanceof SubmitterFactoryInterface) { self::$submitter_factory = $factory; @@ -500,7 +500,7 @@ class Registry * * @return SurnameTraditionFactoryInterface */ - public static function surnameTraditionFactory(SurnameTraditionFactoryInterface $factory = null): SurnameTraditionFactoryInterface + public static function surnameTraditionFactory(SurnameTraditionFactoryInterface|null $factory = null): SurnameTraditionFactoryInterface { if ($factory instanceof SurnameTraditionFactoryInterface) { self::$surname_tradition_factory = $factory; @@ -516,7 +516,7 @@ class Registry * * @return TimeFactoryInterface */ - public static function timeFactory(TimeFactoryInterface $factory = null): TimeFactoryInterface + public static function timeFactory(TimeFactoryInterface|null $factory = null): TimeFactoryInterface { if ($factory instanceof TimeFactoryInterface) { self::$time_factory = $factory; @@ -532,7 +532,7 @@ class Registry * * @return TimestampFactoryInterface */ - public static function timestampFactory(TimestampFactoryInterface $factory = null): TimestampFactoryInterface + public static function timestampFactory(TimestampFactoryInterface|null $factory = null): TimestampFactoryInterface { if ($factory instanceof TimestampFactoryInterface) { self::$timestamp_factory = $factory; @@ -548,7 +548,7 @@ class Registry * * @return XrefFactoryInterface */ - public static function xrefFactory(XrefFactoryInterface $factory = null): XrefFactoryInterface + public static function xrefFactory(XrefFactoryInterface|null $factory = null): XrefFactoryInterface { if ($factory instanceof XrefFactoryInterface) { self::$xref_factory = $factory; diff --git a/app/Services/GedcomExportService.php b/app/Services/GedcomExportService.php index 9d4c342d54..9fd195c150 100644 --- a/app/Services/GedcomExportService.php +++ b/app/Services/GedcomExportService.php @@ -182,8 +182,8 @@ class GedcomExportService string $encoding = UTF8::NAME, int $access_level = Auth::PRIV_HIDE, string $line_endings = 'CRLF', - Collection $records = null, - FilesystemOperator $zip_filesystem = null, + Collection|null $records = null, + FilesystemOperator|null $zip_filesystem = null, string $media_path = null ) { $stream = fopen('php://memory', 'wb+'); diff --git a/app/Services/LinkedRecordService.php b/app/Services/LinkedRecordService.php index 9368240c43..bdde4c15ad 100644 --- a/app/Services/LinkedRecordService.php +++ b/app/Services/LinkedRecordService.php @@ -85,7 +85,7 @@ class LinkedRecordService * * @return Collection */ - public function linkedFamilies(GedcomRecord $record, string $link_type = null): Collection + public function linkedFamilies(GedcomRecord $record, string|null $link_type = null): Collection { $query = DB::table('families') ->join('link', static function (JoinClause $join): void { @@ -116,7 +116,7 @@ class LinkedRecordService * * @return Collection */ - public function linkedIndividuals(GedcomRecord $record, string $link_type = null): Collection + public function linkedIndividuals(GedcomRecord $record, string|null $link_type = null): Collection { $query = DB::table('individuals') ->join('link', static function (JoinClause $join): void { diff --git a/app/Services/RelationshipService.php b/app/Services/RelationshipService.php index 6c1e512c65..380307fc74 100644 --- a/app/Services/RelationshipService.php +++ b/app/Services/RelationshipService.php @@ -325,7 +325,7 @@ class RelationshipService * * @deprecated This code was originally Functions::getRelationshipNameFromPath */ - public function legacyNameAlgorithm(string $path, Individual $person1 = null, Individual $person2 = null): string + public function legacyNameAlgorithm(string $path, Individual|null $person1 = null, Individual|null $person2 = null): string { // The path does not include the starting person. In some languages, the // translation for a man’s (relative) is different from a woman’s (relative), diff --git a/app/Services/TimeoutService.php b/app/Services/TimeoutService.php index 0992c6a295..f05305916e 100644 --- a/app/Services/TimeoutService.php +++ b/app/Services/TimeoutService.php @@ -38,7 +38,7 @@ class TimeoutService /** * @param float|null $start_time */ - public function __construct(float $start_time = null) + public function __construct(float|null $start_time = null) { $this->start_time = $start_time ?? Registry::timeFactory()->now(); } diff --git a/app/Statistics.php b/app/Statistics.php index a8051a6dd8..4ab7c815e8 100644 --- a/app/Statistics.php +++ b/app/Statistics.php @@ -320,7 +320,7 @@ class Statistics implements * @return string */ public function chartIndisWithSources( - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { return $this->individual_repository->chartIndisWithSources($color_from, $color_to); @@ -373,7 +373,7 @@ class Statistics implements * @return string */ public function chartFamsWithSources( - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { return $this->individual_repository->chartFamsWithSources($color_from, $color_to); @@ -585,8 +585,8 @@ class Statistics implements * @return string */ public function chartSex( - string $color_female = null, - string $color_male = null, + string|null $color_female = null, + string|null $color_male = null, string $color_unknown = null ): string { return $this->individual_repository->chartSex($color_female, $color_male, $color_unknown); @@ -630,7 +630,7 @@ class Statistics implements * * @return string */ - public function chartMortality(string $color_living = null, string $color_dead = null): string + public function chartMortality(string|null $color_living = null, string|null $color_dead = null): string { return $this->individual_repository->chartMortality($color_living, $color_dead); } @@ -801,7 +801,7 @@ class Statistics implements * * @return string */ - public function chartMedia(string $color_from = null, string $color_to = null): string + public function chartMedia(string|null $color_from = null, string|null $color_to = null): string { return $this->media_repository->chartMedia($color_from, $color_to); } @@ -953,7 +953,7 @@ class Statistics implements * * @return string */ - public function statsBirth(string $color_from = null, string $color_to = null): string + public function statsBirth(string|null $color_from = null, string|null $color_to = null): string { return $this->individual_repository->statsBirth($color_from, $color_to); } @@ -1050,7 +1050,7 @@ class Statistics implements * * @return string */ - public function statsDeath(string $color_from = null, string $color_to = null): string + public function statsDeath(string|null $color_from = null, string|null $color_to = null): string { return $this->individual_repository->statsDeath($color_from, $color_to); } @@ -1472,7 +1472,7 @@ class Statistics implements * * @return string */ - public function statsMarr(string $color_from = null, string $color_to = null): string + public function statsMarr(string|null $color_from = null, string|null $color_to = null): string { return $this->family_repository->statsMarr($color_from, $color_to); } @@ -1547,7 +1547,7 @@ class Statistics implements * * @return string */ - public function statsDiv(string $color_from = null, string $color_to = null): string + public function statsDiv(string|null $color_from = null, string|null $color_to = null): string { return $this->family_repository->statsDiv($color_from, $color_to); } @@ -1982,8 +1982,8 @@ class Statistics implements * @return string */ public function chartLargestFamilies( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, string $total = '10' ): string { return $this->family_repository->chartLargestFamilies($color_from, $color_to, (int) $total); @@ -2193,8 +2193,8 @@ class Statistics implements * @return string */ public function chartCommonSurnames( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, string $number_of_surnames = '10' ): string { return $this->individual_repository @@ -2429,8 +2429,8 @@ class Statistics implements * @return string */ public function chartCommonGiven( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, string $maxtoshow = '7' ): string { return $this->individual_repository->chartCommonGiven($color_from, $color_to, (int) $maxtoshow); @@ -2555,7 +2555,7 @@ class Statistics implements * * @return string */ - public function latestUserRegDate(string $format = null): string + public function latestUserRegDate(string|null $format = null): string { return $this->latest_user_repository->latestUserRegDate($format); } @@ -2565,7 +2565,7 @@ class Statistics implements * * @return string */ - public function latestUserRegTime(string $format = null): string + public function latestUserRegTime(string|null $format = null): string { return $this->latest_user_repository->latestUserRegTime($format); } @@ -2576,7 +2576,7 @@ class Statistics implements * * @return string */ - public function latestUserLoggedin(string $yes = null, string $no = null): string + public function latestUserLoggedin(string|null $yes = null, string|null $no = null): string { return $this->latest_user_repository->latestUserLoggedin($yes, $no); } diff --git a/app/Statistics/Google/ChartBirth.php b/app/Statistics/Google/ChartBirth.php index 7549d09b67..32aa1a499d 100644 --- a/app/Statistics/Google/ChartBirth.php +++ b/app/Statistics/Google/ChartBirth.php @@ -86,7 +86,7 @@ class ChartBirth * * @return string */ - public function chartBirth(string $color_from = null, string $color_to = null): string + public function chartBirth(string|null $color_from = null, string|null $color_to = null): string { $color_from ??= 'ffffff'; $color_to ??= '84beff'; diff --git a/app/Statistics/Google/ChartCommonGiven.php b/app/Statistics/Google/ChartCommonGiven.php index 735b2f7b65..3e032b6617 100644 --- a/app/Statistics/Google/ChartCommonGiven.php +++ b/app/Statistics/Google/ChartCommonGiven.php @@ -53,7 +53,7 @@ class ChartCommonGiven public function chartCommonGiven( int $tot_indi, array $given, - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartCommonSurname.php b/app/Statistics/Google/ChartCommonSurname.php index afa930f925..69566aa620 100644 --- a/app/Statistics/Google/ChartCommonSurname.php +++ b/app/Statistics/Google/ChartCommonSurname.php @@ -111,7 +111,7 @@ class ChartCommonSurname public function chartCommonSurnames( int $tot_indi, array $all_surnames, - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartDeath.php b/app/Statistics/Google/ChartDeath.php index 739beb2702..e513ea2291 100644 --- a/app/Statistics/Google/ChartDeath.php +++ b/app/Statistics/Google/ChartDeath.php @@ -86,7 +86,7 @@ class ChartDeath * * @return string */ - public function chartDeath(string $color_from = null, string $color_to = null): string + public function chartDeath(string|null $color_from = null, string|null $color_to = null): string { $color_from ??= 'ffffff'; $color_to ??= '84beff'; diff --git a/app/Statistics/Google/ChartDivorce.php b/app/Statistics/Google/ChartDivorce.php index 6aa83e6db4..2da03bbfb5 100644 --- a/app/Statistics/Google/ChartDivorce.php +++ b/app/Statistics/Google/ChartDivorce.php @@ -86,7 +86,7 @@ class ChartDivorce * * @return string */ - public function chartDivorce(string $color_from = null, string $color_to = null): string + public function chartDivorce(string|null $color_from = null, string|null $color_to = null): string { $color_from ??= 'ffffff'; $color_to ??= '84beff'; diff --git a/app/Statistics/Google/ChartFamilyLargest.php b/app/Statistics/Google/ChartFamilyLargest.php index 40a7423e32..a2890b719e 100644 --- a/app/Statistics/Google/ChartFamilyLargest.php +++ b/app/Statistics/Google/ChartFamilyLargest.php @@ -78,8 +78,8 @@ class ChartFamilyLargest * @return string */ public function chartLargestFamilies( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, int $total = 10 ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartFamilyWithSources.php b/app/Statistics/Google/ChartFamilyWithSources.php index 9caffb9144..09683e5cd4 100644 --- a/app/Statistics/Google/ChartFamilyWithSources.php +++ b/app/Statistics/Google/ChartFamilyWithSources.php @@ -53,7 +53,7 @@ class ChartFamilyWithSources public function chartFamsWithSources( int $tot_fam, int $tot_fam_source, - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartIndividualWithSources.php b/app/Statistics/Google/ChartIndividualWithSources.php index 73dd9a485b..a3f0da9d79 100644 --- a/app/Statistics/Google/ChartIndividualWithSources.php +++ b/app/Statistics/Google/ChartIndividualWithSources.php @@ -53,7 +53,7 @@ class ChartIndividualWithSources public function chartIndisWithSources( int $tot_indi, int $tot_indi_source, - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartMarriage.php b/app/Statistics/Google/ChartMarriage.php index a811191e3b..fc6884a44e 100644 --- a/app/Statistics/Google/ChartMarriage.php +++ b/app/Statistics/Google/ChartMarriage.php @@ -86,7 +86,7 @@ class ChartMarriage * * @return string */ - public function chartMarriage(string $color_from = null, string $color_to = null): string + public function chartMarriage(string|null $color_from = null, string|null $color_to = null): string { $color_from ??= 'ffffff'; $color_to ??= '84beff'; diff --git a/app/Statistics/Google/ChartMedia.php b/app/Statistics/Google/ChartMedia.php index dd6bfa8b27..0f1570cdd5 100644 --- a/app/Statistics/Google/ChartMedia.php +++ b/app/Statistics/Google/ChartMedia.php @@ -52,7 +52,7 @@ class ChartMedia */ public function chartMedia( array $media, - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $color_from ??= 'ffffff'; diff --git a/app/Statistics/Google/ChartMortality.php b/app/Statistics/Google/ChartMortality.php index b489e36c31..5763a3d272 100644 --- a/app/Statistics/Google/ChartMortality.php +++ b/app/Statistics/Google/ChartMortality.php @@ -53,7 +53,7 @@ class ChartMortality public function chartMortality( int $tot_l, int $tot_d, - string $color_living = null, + string|null $color_living = null, string $color_dead = null ): string { $color_living ??= '#ffffff'; diff --git a/app/Statistics/Google/ChartSex.php b/app/Statistics/Google/ChartSex.php index 6ed5cf3ea0..a92ee9c66e 100644 --- a/app/Statistics/Google/ChartSex.php +++ b/app/Statistics/Google/ChartSex.php @@ -42,8 +42,8 @@ class ChartSex int $tot_m, int $tot_f, int $tot_u, - string $color_female = null, - string $color_male = null, + string|null $color_female = null, + string|null $color_male = null, string $color_unknown = null ): string { $color_female ??= '#ffd1dc'; diff --git a/app/Statistics/Repository/FamilyRepository.php b/app/Statistics/Repository/FamilyRepository.php index 39162d77ed..4d45d96cec 100644 --- a/app/Statistics/Repository/FamilyRepository.php +++ b/app/Statistics/Repository/FamilyRepository.php @@ -686,8 +686,8 @@ class FamilyRepository * @return string */ public function chartLargestFamilies( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, int $total = 10 ): string { return (new ChartFamilyLargest($this->color_service, $this->tree)) @@ -1725,7 +1725,7 @@ class FamilyRepository * * @return string */ - public function statsMarr(string $color_from = null, string $color_to = null): string + public function statsMarr(string|null $color_from = null, string|null $color_to = null): string { return (new ChartMarriage($this->century_service, $this->color_service, $this->tree)) ->chartMarriage($color_from, $color_to); @@ -1739,7 +1739,7 @@ class FamilyRepository * * @return string */ - public function statsDiv(string $color_from = null, string $color_to = null): string + public function statsDiv(string|null $color_from = null, string|null $color_to = null): string { return (new ChartDivorce($this->century_service, $this->color_service, $this->tree)) ->chartDivorce($color_from, $color_to); diff --git a/app/Statistics/Repository/IndividualRepository.php b/app/Statistics/Repository/IndividualRepository.php index abb4a789e2..e3e56b4577 100644 --- a/app/Statistics/Repository/IndividualRepository.php +++ b/app/Statistics/Repository/IndividualRepository.php @@ -724,7 +724,7 @@ class IndividualRepository implements IndividualRepositoryInterface * * @return string */ - public function statsBirth(string $color_from = null, string $color_to = null): string + public function statsBirth(string|null $color_from = null, string|null $color_to = null): string { return (new ChartBirth($this->century_service, $this->color_service, $this->tree)) ->chartBirth($color_from, $color_to); @@ -782,7 +782,7 @@ class IndividualRepository implements IndividualRepositoryInterface * * @return string */ - public function statsDeath(string $color_from = null, string $color_to = null): string + public function statsDeath(string|null $color_from = null, string|null $color_to = null): string { return (new ChartDeath($this->century_service, $this->color_service, $this->tree)) ->chartDeath($color_from, $color_to); @@ -1817,8 +1817,8 @@ class IndividualRepository implements IndividualRepositoryInterface * @return string */ public function chartCommonGiven( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, int $maxtoshow = 7 ): string { $tot_indi = $this->totalIndividualsQuery(); @@ -1842,8 +1842,8 @@ class IndividualRepository implements IndividualRepositoryInterface * @return string */ public function chartCommonSurnames( - string $color_from = null, - string $color_to = null, + string|null $color_from = null, + string|null $color_to = null, int $number_of_surnames = 10 ): string { $tot_indi = $this->totalIndividualsQuery(); @@ -1868,7 +1868,7 @@ class IndividualRepository implements IndividualRepositoryInterface * * @return string */ - public function chartMortality(string $color_living = null, string $color_dead = null): string + public function chartMortality(string|null $color_living = null, string|null $color_dead = null): string { $tot_l = $this->totalLivingQuery(); $tot_d = $this->totalDeceasedQuery(); @@ -1886,7 +1886,7 @@ class IndividualRepository implements IndividualRepositoryInterface * @return string */ public function chartIndisWithSources( - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $tot_indi = $this->totalIndividualsQuery(); @@ -1905,7 +1905,7 @@ class IndividualRepository implements IndividualRepositoryInterface * @return string */ public function chartFamsWithSources( - string $color_from = null, + string|null $color_from = null, string $color_to = null ): string { $tot_fam = $this->totalFamiliesQuery(); @@ -1923,8 +1923,8 @@ class IndividualRepository implements IndividualRepositoryInterface * @return string */ public function chartSex( - string $color_female = null, - string $color_male = null, + string|null $color_female = null, + string|null $color_male = null, string $color_unknown = null ): string { $tot_m = $this->totalSexMalesQuery(); diff --git a/app/Statistics/Repository/Interfaces/IndividualRepositoryInterface.php b/app/Statistics/Repository/Interfaces/IndividualRepositoryInterface.php index 7fdc1bf962..1fc49d097f 100644 --- a/app/Statistics/Repository/Interfaces/IndividualRepositoryInterface.php +++ b/app/Statistics/Repository/Interfaces/IndividualRepositoryInterface.php @@ -188,8 +188,8 @@ interface IndividualRepositoryInterface * @return string */ public function chartSex( - string $color_female = null, - string $color_male = null, + string|null $color_female = null, + string|null $color_male = null, string $color_unknown = null ): string; } diff --git a/app/Statistics/Repository/Interfaces/LatestUserRepositoryInterface.php b/app/Statistics/Repository/Interfaces/LatestUserRepositoryInterface.php index 803171a3ff..5a8e5e74b2 100644 --- a/app/Statistics/Repository/Interfaces/LatestUserRepositoryInterface.php +++ b/app/Statistics/Repository/Interfaces/LatestUserRepositoryInterface.php @@ -52,7 +52,7 @@ interface LatestUserRepositoryInterface * * @return string */ - public function latestUserRegDate(string $format = null): string; + public function latestUserRegDate(string|null $format = null): string; /** * Find the timestamp of the latest user to register. @@ -61,7 +61,7 @@ interface LatestUserRepositoryInterface * * @return string */ - public function latestUserRegTime(string $format = null): string; + public function latestUserRegTime(string|null $format = null): string; /** * Is the most recently registered user logged in right now? @@ -71,5 +71,5 @@ interface LatestUserRepositoryInterface * * @return string */ - public function latestUserLoggedin(string $yes = null, string $no = null): string; + public function latestUserLoggedin(string|null $yes = null, string|null $no = null): string; } diff --git a/app/Statistics/Repository/Interfaces/MediaRepositoryInterface.php b/app/Statistics/Repository/Interfaces/MediaRepositoryInterface.php index 8717e2d690..377e83906d 100644 --- a/app/Statistics/Repository/Interfaces/MediaRepositoryInterface.php +++ b/app/Statistics/Repository/Interfaces/MediaRepositoryInterface.php @@ -172,5 +172,5 @@ interface MediaRepositoryInterface * * @return string */ - public function chartMedia(string $color_from = null, string $color_to = null): string; + public function chartMedia(string|null $color_from = null, string|null $color_to = null): string; } diff --git a/app/Statistics/Repository/LatestUserRepository.php b/app/Statistics/Repository/LatestUserRepository.php index f7fc037e2c..722110709c 100644 --- a/app/Statistics/Repository/LatestUserRepository.php +++ b/app/Statistics/Repository/LatestUserRepository.php @@ -110,7 +110,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface * * @return string */ - public function latestUserRegDate(string $format = null): string + public function latestUserRegDate(string|null $format = null): string { $format ??= I18N::dateFormat(); $user = $this->latestUserQuery(); @@ -124,7 +124,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface * * @return string */ - public function latestUserRegTime(string $format = null): string + public function latestUserRegTime(string|null $format = null): string { $format ??= str_replace('%', '', I18N::timeFormat()); $user = $this->latestUserQuery(); @@ -138,7 +138,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface * * @return string */ - public function latestUserLoggedin(string $yes = null, string $no = null): string + public function latestUserLoggedin(string|null $yes = null, string|null $no = null): string { $yes ??= I18N::translate('yes'); $no ??= I18N::translate('no'); diff --git a/app/Statistics/Repository/MediaRepository.php b/app/Statistics/Repository/MediaRepository.php index 54c5569674..01fce27b81 100644 --- a/app/Statistics/Repository/MediaRepository.php +++ b/app/Statistics/Repository/MediaRepository.php @@ -244,7 +244,7 @@ class MediaRepository implements MediaRepositoryInterface * * @return string */ - public function chartMedia(string $color_from = null, string $color_to = null): string + public function chartMedia(string|null $color_from = null, string|null $color_to = null): string { $media = DB::table('media_file') ->where('m_file', '=', $this->tree->id()) diff --git a/app/Tree.php b/app/Tree.php index fa85ed3856..4255c3a6d4 100644 --- a/app/Tree.php +++ b/app/Tree.php @@ -196,7 +196,7 @@ class Tree * * @return string */ - public function getPreference(string $setting_name, string $default = null): string + public function getPreference(string $setting_name, string|null $default = null): string { if ($this->preferences === []) { $this->preferences = DB::table('gedcom_setting') diff --git a/app/Validator.php b/app/Validator.php index 7c93b877ca..382e0ca00e 100644 --- a/app/Validator.php +++ b/app/Validator.php @@ -247,7 +247,7 @@ class Validator * * @return bool */ - public function boolean(string $parameter, bool $default = null): bool + public function boolean(string $parameter, bool|null $default = null): bool { $value = $this->parameters[$parameter] ?? null; @@ -290,7 +290,7 @@ class Validator * * @return float */ - public function float(string $parameter, float $default = null): float + public function float(string $parameter, float|null $default = null): float { $value = $this->parameters[$parameter] ?? null; @@ -317,7 +317,7 @@ class Validator * * @return int */ - public function integer(string $parameter, int $default = null): int + public function integer(string $parameter, int|null $default = null): int { $value = $this->parameters[$parameter] ?? null; @@ -366,7 +366,7 @@ class Validator * * @return string */ - public function string(string $parameter, string $default = null): string + public function string(string $parameter, string|null $default = null): string { $value = $this->parameters[$parameter] ?? null; -- cgit v1.3