diff options
114 files changed, 250 insertions, 548 deletions
diff --git a/app/Auth.php b/app/Auth.php index e882459564..5ce8562b28 100644 --- a/app/Auth.php +++ b/app/Auth.php @@ -153,10 +153,8 @@ class Auth /** * The ID of the authenticated user, from the current session. - * - * @return int|null */ - public static function id(): ?int + public static function id(): int|null { $wt_user = Session::get('wt_user'); @@ -223,7 +221,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkFamilyAccess(?Family $family, bool $edit = false): Family + public static function checkFamilyAccess(Family|null $family, bool $edit = false): Family { $message = I18N::translate('This family does not exist or you do not have permission to view it.'); @@ -252,7 +250,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkHeaderAccess(?Header $header, bool $edit = false): Header + public static function checkHeaderAccess(Header|null $header, bool $edit = false): Header { $message = I18N::translate('This record does not exist or you do not have permission to view it.'); @@ -282,7 +280,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkIndividualAccess(?Individual $individual, bool $edit = false, bool $chart = false): Individual + public static function checkIndividualAccess(Individual|null $individual, bool $edit = false, bool $chart = false): Individual { $message = I18N::translate('This individual does not exist or you do not have permission to view it.'); @@ -315,7 +313,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkLocationAccess(?Location $location, bool $edit = false): Location + public static function checkLocationAccess(Location|null $location, bool $edit = false): Location { $message = I18N::translate('This record does not exist or you do not have permission to view it.'); @@ -344,7 +342,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkMediaAccess(?Media $media, bool $edit = false): Media + public static function checkMediaAccess(Media|null $media, bool $edit = false): Media { $message = I18N::translate('This media object does not exist or you do not have permission to view it.'); @@ -373,7 +371,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkNoteAccess(?Note $note, bool $edit = false): Note + public static function checkNoteAccess(Note|null $note, bool $edit = false): Note { $message = I18N::translate('This note does not exist or you do not have permission to view it.'); @@ -402,7 +400,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkSharedNoteAccess(?SharedNote $shared_note, bool $edit = false): SharedNote + public static function checkSharedNoteAccess(SharedNote|null $shared_note, bool $edit = false): SharedNote { $message = I18N::translate('This note does not exist or you do not have permission to view it.'); @@ -431,7 +429,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkRecordAccess(?GedcomRecord $record, bool $edit = false): GedcomRecord + public static function checkRecordAccess(GedcomRecord|null $record, bool $edit = false): GedcomRecord { $message = I18N::translate('This record does not exist or you do not have permission to view it.'); @@ -460,7 +458,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkRepositoryAccess(?Repository $repository, bool $edit = false): Repository + public static function checkRepositoryAccess(Repository|null $repository, bool $edit = false): Repository { $message = I18N::translate('This repository does not exist or you do not have permission to view it.'); @@ -489,7 +487,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkSourceAccess(?Source $source, bool $edit = false): Source + public static function checkSourceAccess(Source|null $source, bool $edit = false): Source { $message = I18N::translate('This source does not exist or you do not have permission to view it.'); @@ -518,7 +516,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkSubmitterAccess(?Submitter $submitter, bool $edit = false): Submitter + public static function checkSubmitterAccess(Submitter|null $submitter, bool $edit = false): Submitter { $message = I18N::translate('This record does not exist or you do not have permission to view it.'); @@ -547,7 +545,7 @@ class Auth * @throws HttpNotFoundException * @throws HttpAccessDeniedException */ - public static function checkSubmissionAccess(?Submission $submission, bool $edit = false): Submission + public static function checkSubmissionAccess(Submission|null $submission, bool $edit = false): Submission { $message = I18N::translate('This record does not exist or you do not have permission to view it.'); diff --git a/app/Census/AbstractCensusColumn.php b/app/Census/AbstractCensusColumn.php index 184de105e2..7087838f2d 100644 --- a/app/Census/AbstractCensusColumn.php +++ b/app/Census/AbstractCensusColumn.php @@ -64,10 +64,6 @@ class AbstractCensusColumn /** * Find the father of an individual - * - * @param Individual $individual - * - * @return Individual|null */ public function father(Individual $individual): ?Individual { @@ -82,10 +78,6 @@ class AbstractCensusColumn /** * Find the mother of an individual - * - * @param Individual $individual - * - * @return Individual|null */ public function mother(Individual $individual): ?Individual { @@ -100,10 +92,6 @@ class AbstractCensusColumn /** * Find the current spouse family of an individual - * - * @param Individual $individual - * - * @return Family|null */ public function spouseFamily(Individual $individual): ?Family { @@ -118,8 +106,6 @@ class AbstractCensusColumn * What was an individual's likely name on a given date, allowing * for marriages and married names. * - * @param Individual $individual - * * @return array<string> */ protected function nameAtCensusDate(Individual $individual): array @@ -151,8 +137,6 @@ class AbstractCensusColumn /** * When did this census occur - * - * @return Date */ public function date(): Date { diff --git a/app/CommonMark/CensusTableContinueParser.php b/app/CommonMark/CensusTableContinueParser.php index 7501b556f2..d15f591dea 100644 --- a/app/CommonMark/CensusTableContinueParser.php +++ b/app/CommonMark/CensusTableContinueParser.php @@ -66,7 +66,7 @@ class CensusTableContinueParser extends AbstractBlockContinueParser * * @return BlockContinue|null */ - public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): BlockContinue|null { $line = $cursor->getLine(); diff --git a/app/CommonMark/CensusTableStartParser.php b/app/CommonMark/CensusTableStartParser.php index d1c2e80f72..81035a67ed 100644 --- a/app/CommonMark/CensusTableStartParser.php +++ b/app/CommonMark/CensusTableStartParser.php @@ -30,13 +30,7 @@ use League\CommonMark\Parser\MarkdownParserStateInterface; */ class CensusTableStartParser implements BlockStartParserInterface { - /** - * @param Cursor $cursor - * @param MarkdownParserStateInterface $parserState - * - * @return BlockStart|null - */ - public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): BlockStart|null { if ($cursor->getLine() === CensusTableExtension::CA_PREFIX) { return BlockStart::of(new CensusTableContinueParser()) diff --git a/app/Contracts/EncodingFactoryInterface.php b/app/Contracts/EncodingFactoryInterface.php index 1ca9d549c3..7af3407875 100644 --- a/app/Contracts/EncodingFactoryInterface.php +++ b/app/Contracts/EncodingFactoryInterface.php @@ -28,12 +28,8 @@ interface EncodingFactoryInterface { /** * Detect an encoding from a GEDCOM header record. - * - * @param string $header - * - * @return EncodingInterface|null */ - public function detect(string $header): ?EncodingInterface; + public function detect(string $header): EncodingInterface|null; /** * Create a named encoding. diff --git a/app/Contracts/FamilyFactoryInterface.php b/app/Contracts/FamilyFactoryInterface.php index d543d94171..a4849bc480 100644 --- a/app/Contracts/FamilyFactoryInterface.php +++ b/app/Contracts/FamilyFactoryInterface.php @@ -30,14 +30,8 @@ interface FamilyFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a family. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Family|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Family; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Family|null; /** * Create a Family object from a row in the database. @@ -59,5 +53,5 @@ interface FamilyFactoryInterface extends GedcomRecordFactoryInterface * * @return Family */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Family; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Family; } diff --git a/app/Contracts/GedcomRecordFactoryInterface.php b/app/Contracts/GedcomRecordFactoryInterface.php index d10aba8f60..6a32ccd65d 100644 --- a/app/Contracts/GedcomRecordFactoryInterface.php +++ b/app/Contracts/GedcomRecordFactoryInterface.php @@ -30,14 +30,8 @@ interface GedcomRecordFactoryInterface { /** * Create a GedcomRecord object. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return GedcomRecord|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?GedcomRecord; + public function make(string $xref, Tree $tree, string|null $gedcom = null): GedcomRecord|null; /** * Create a GedcomRecord object from raw GEDCOM data. @@ -50,7 +44,7 @@ interface GedcomRecordFactoryInterface * * @return GedcomRecord */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): GedcomRecord; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): GedcomRecord; /** * Create a GedcomRecord object from a row in the database. diff --git a/app/Contracts/HeaderFactoryInterface.php b/app/Contracts/HeaderFactoryInterface.php index 4cd55fa25e..1a693521f8 100644 --- a/app/Contracts/HeaderFactoryInterface.php +++ b/app/Contracts/HeaderFactoryInterface.php @@ -30,14 +30,8 @@ interface HeaderFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a header. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Header|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Header; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Header|null; /** * Create a header from a row in the database. @@ -59,5 +53,5 @@ interface HeaderFactoryInterface extends GedcomRecordFactoryInterface * * @return Header */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Header; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Header; } diff --git a/app/Contracts/IndividualFactoryInterface.php b/app/Contracts/IndividualFactoryInterface.php index f72979459d..978ce13eed 100644 --- a/app/Contracts/IndividualFactoryInterface.php +++ b/app/Contracts/IndividualFactoryInterface.php @@ -30,14 +30,8 @@ interface IndividualFactoryInterface extends GedcomRecordFactoryInterface { /** * Create an individual. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Individual|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Individual; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Individual|null; /** * Create an individual from a row in the database. @@ -59,5 +53,5 @@ interface IndividualFactoryInterface extends GedcomRecordFactoryInterface * * @return Individual */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Individual; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Individual; } diff --git a/app/Contracts/LocationFactoryInterface.php b/app/Contracts/LocationFactoryInterface.php index e9fec7becc..9c8be0729d 100644 --- a/app/Contracts/LocationFactoryInterface.php +++ b/app/Contracts/LocationFactoryInterface.php @@ -30,14 +30,8 @@ interface LocationFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a Location. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Location|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Location; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Location|null; /** * Create a Location from a row in the database. @@ -59,5 +53,5 @@ interface LocationFactoryInterface extends GedcomRecordFactoryInterface * * @return Location */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Location; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Location; } diff --git a/app/Contracts/MediaFactoryInterface.php b/app/Contracts/MediaFactoryInterface.php index 697fc89ed7..da1b6a2a2c 100644 --- a/app/Contracts/MediaFactoryInterface.php +++ b/app/Contracts/MediaFactoryInterface.php @@ -30,14 +30,8 @@ interface MediaFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a media object. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Media|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Media; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Media|null; /** * Create a media object from a row in the database. @@ -59,5 +53,5 @@ interface MediaFactoryInterface extends GedcomRecordFactoryInterface * * @return Media */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Media; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Media; } diff --git a/app/Contracts/NoteFactoryInterface.php b/app/Contracts/NoteFactoryInterface.php index 4158f7f040..f54032bef5 100644 --- a/app/Contracts/NoteFactoryInterface.php +++ b/app/Contracts/NoteFactoryInterface.php @@ -30,14 +30,8 @@ interface NoteFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a note. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Note|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Note; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Note|null; /** * Create a note from a row in the database. @@ -59,5 +53,5 @@ interface NoteFactoryInterface extends GedcomRecordFactoryInterface * * @return Note */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Note; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Note; } diff --git a/app/Contracts/RepositoryFactoryInterface.php b/app/Contracts/RepositoryFactoryInterface.php index f1ebb5c09a..731dfa7826 100644 --- a/app/Contracts/RepositoryFactoryInterface.php +++ b/app/Contracts/RepositoryFactoryInterface.php @@ -30,14 +30,8 @@ interface RepositoryFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a repository. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Repository|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Repository; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Repository|null; /** * Create a source from a row in the database. @@ -59,5 +53,5 @@ interface RepositoryFactoryInterface extends GedcomRecordFactoryInterface * * @return Repository */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Repository; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Repository; } diff --git a/app/Contracts/SharedNoteFactoryInterface.php b/app/Contracts/SharedNoteFactoryInterface.php index 6130e6f9ea..e1413baf0f 100644 --- a/app/Contracts/SharedNoteFactoryInterface.php +++ b/app/Contracts/SharedNoteFactoryInterface.php @@ -30,14 +30,8 @@ interface SharedNoteFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a note. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return SharedNote|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?SharedNote; + public function make(string $xref, Tree $tree, string|null $gedcom = null): SharedNote|null; /** * Create a note from a row in the database. @@ -59,5 +53,5 @@ interface SharedNoteFactoryInterface extends GedcomRecordFactoryInterface * * @return SharedNote */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): SharedNote; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): SharedNote; } diff --git a/app/Contracts/SourceFactoryInterface.php b/app/Contracts/SourceFactoryInterface.php index 9bc7c0a247..7fadecd250 100644 --- a/app/Contracts/SourceFactoryInterface.php +++ b/app/Contracts/SourceFactoryInterface.php @@ -30,14 +30,8 @@ interface SourceFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a source. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Source|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Source; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Source|null; /** * Create a source from a row in the database. @@ -59,5 +53,5 @@ interface SourceFactoryInterface extends GedcomRecordFactoryInterface * * @return Source */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Source; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Source; } diff --git a/app/Contracts/SubmissionFactoryInterface.php b/app/Contracts/SubmissionFactoryInterface.php index 1a17dd513d..c94e019706 100644 --- a/app/Contracts/SubmissionFactoryInterface.php +++ b/app/Contracts/SubmissionFactoryInterface.php @@ -30,14 +30,8 @@ interface SubmissionFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a submission. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Submission|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submission; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Submission|null; /** * Create a submission from a row in the database. @@ -59,5 +53,5 @@ interface SubmissionFactoryInterface extends GedcomRecordFactoryInterface * * @return Submission */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Submission; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Submission; } diff --git a/app/Contracts/SubmitterFactoryInterface.php b/app/Contracts/SubmitterFactoryInterface.php index 326b4d6eab..c22de01da7 100644 --- a/app/Contracts/SubmitterFactoryInterface.php +++ b/app/Contracts/SubmitterFactoryInterface.php @@ -30,14 +30,8 @@ interface SubmitterFactoryInterface extends GedcomRecordFactoryInterface { /** * Create a submitter. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Submitter|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submitter; + public function make(string $xref, Tree $tree, string|null $gedcom = null): Submitter|null; /** * Create a submitter from a row in the database. @@ -59,5 +53,5 @@ interface SubmitterFactoryInterface extends GedcomRecordFactoryInterface * * @return Submitter */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Submitter; + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Submitter; } diff --git a/app/Contracts/TimestampFactoryInterface.php b/app/Contracts/TimestampFactoryInterface.php index 62e754c9cc..dd963b1386 100644 --- a/app/Contracts/TimestampFactoryInterface.php +++ b/app/Contracts/TimestampFactoryInterface.php @@ -39,7 +39,7 @@ interface TimestampFactoryInterface * * @return TimestampInterface */ - public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface; + public function fromString(string|null $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface; /** * @param UserInterface|null $user diff --git a/app/Date.php b/app/Date.php index 5197052242..18e5f8a0ed 100644 --- a/app/Date.php +++ b/app/Date.php @@ -45,7 +45,7 @@ class Date public string $qual2 = ''; // Optional second date - private ?AbstractCalendarDate $date2 = null; + private AbstractCalendarDate|null $date2 = null; // Optional text, as included with an INTerpreted date private string $text = ''; diff --git a/app/Exceptions/FileUploadException.php b/app/Exceptions/FileUploadException.php index 4a078406b2..44ec0df03c 100644 --- a/app/Exceptions/FileUploadException.php +++ b/app/Exceptions/FileUploadException.php @@ -42,7 +42,7 @@ class FileUploadException extends RuntimeException /** * @param UploadedFileInterface|null $uploaded_file */ - public function __construct(?UploadedFileInterface $uploaded_file) + public function __construct(UploadedFileInterface|null $uploaded_file) { if ($uploaded_file === null) { parent::__construct(I18N::translate('No file was received. Please try again.')); diff --git a/app/Fact.php b/app/Fact.php index fe5f92ffdc..137785dac2 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -276,10 +276,8 @@ class Fact /** * Get the PLAC:MAP:LATI for the fact. - * - * @return float|null */ - public function latitude(): ?float + public function latitude(): float|null { if (preg_match('/\n4 LATI (.+)/', $this->gedcom, $match)) { $gedcom_service = new GedcomService(); @@ -292,10 +290,8 @@ class Fact /** * Get the PLAC:MAP:LONG for the fact. - * - * @return float|null */ - public function longitude(): ?float + public function longitude(): float|null { if (preg_match('/\n4 LONG (.+)/', $this->gedcom, $match)) { $gedcom_service = new GedcomService(); diff --git a/app/Factories/ElementFactory.php b/app/Factories/ElementFactory.php index 49bd295027..1f509e337a 100644 --- a/app/Factories/ElementFactory.php +++ b/app/Factories/ElementFactory.php @@ -71,12 +71,7 @@ class ElementFactory implements ElementFactoryInterface } } - /** - * @param string $tag - * - * @return ElementInterface|null - */ - private function findElementByWildcard(string $tag): ?ElementInterface + private function findElementByWildcard(string $tag): ElementInterface|null { foreach ($this->elements as $tags => $element) { if (str_contains($tags, '*')) { diff --git a/app/Factories/EncodingFactory.php b/app/Factories/EncodingFactory.php index 94e65504fd..321186a343 100644 --- a/app/Factories/EncodingFactory.php +++ b/app/Factories/EncodingFactory.php @@ -52,12 +52,9 @@ class EncodingFactory implements EncodingFactoryInterface /** * Detect an encoding from a GEDCOM header record. * - * @param string $header - * - * @return EncodingInterface|null * @throws InvalidGedcomEncodingException */ - public function detect(string $header): ?EncodingInterface + public function detect(string $header): EncodingInterface|null { $utf_bom = [ '/^' . UTF8::BYTE_ORDER_MARK . '/' => UTF8::NAME, diff --git a/app/Factories/FamilyFactory.php b/app/Factories/FamilyFactory.php index 33ae7ff81b..3763aa53e7 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|null $gedcom = null): ?Family + public function make(string $xref, Tree $tree, string|null $gedcom = null): Family|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -92,7 +92,7 @@ class FamilyFactory extends AbstractGedcomRecordFactory implements FamilyFactory * * @return Family */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Family + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Family { return new Family($xref, $gedcom, $pending, $tree); } @@ -105,7 +105,7 @@ class FamilyFactory extends AbstractGedcomRecordFactory implements FamilyFactory * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('families') ->where('f_id', '=', $xref) diff --git a/app/Factories/GedcomRecordFactory.php b/app/Factories/GedcomRecordFactory.php index c046db9b09..8c2e098e96 100644 --- a/app/Factories/GedcomRecordFactory.php +++ b/app/Factories/GedcomRecordFactory.php @@ -45,14 +45,8 @@ class GedcomRecordFactory extends AbstractGedcomRecordFactory implements GedcomR { /** * Create a GedcomRecord object. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return GedcomRecord|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?GedcomRecord + public function make(string $xref, Tree $tree, string|null $gedcom = null): GedcomRecord|null { // We know the type of the record. Return it directly. if ($gedcom !== null && preg_match('/^0(?: @[^@]+@)? ([A-Z_]+)/', $gedcom, $match)) { @@ -119,7 +113,7 @@ class GedcomRecordFactory extends AbstractGedcomRecordFactory implements GedcomR * * @return GedcomRecord */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): GedcomRecord + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): GedcomRecord { return new GedcomRecord($xref, $gedcom, $pending, $tree); } @@ -145,7 +139,7 @@ class GedcomRecordFactory extends AbstractGedcomRecordFactory implements GedcomR * * @return GedcomRecord */ - private function newGedcomRecord(string $type, string $xref, string $gedcom, ?string $pending, Tree $tree): GedcomRecord + private function newGedcomRecord(string $type, string $xref, string $gedcom, string|null $pending, Tree $tree): GedcomRecord { switch ($type) { case Family::RECORD_TYPE: @@ -205,7 +199,7 @@ class GedcomRecordFactory extends AbstractGedcomRecordFactory implements GedcomR * * @return string|null */ - private function gedcom(string $xref, Tree $tree): ?string + private function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/HeaderFactory.php b/app/Factories/HeaderFactory.php index 0a3122298c..e4755de753 100644 --- a/app/Factories/HeaderFactory.php +++ b/app/Factories/HeaderFactory.php @@ -37,14 +37,8 @@ class HeaderFactory extends AbstractGedcomRecordFactory implements HeaderFactory /** * Create a header. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Header|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Header + public function make(string $xref, Tree $tree, string|null $gedcom = null): Header|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class HeaderFactory extends AbstractGedcomRecordFactory implements HeaderFactory * * @return Header */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Header + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Header { return new Header($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class HeaderFactory extends AbstractGedcomRecordFactory implements HeaderFactory * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/IndividualFactory.php b/app/Factories/IndividualFactory.php index 39b21a6708..a91e8c3f22 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|null $gedcom = null): ?Individual + public function make(string $xref, Tree $tree, string|null $gedcom = null): Individual|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -82,7 +82,7 @@ class IndividualFactory extends AbstractGedcomRecordFactory implements Individua * * @return Individual */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Individual + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Individual { return new Individual($xref, $gedcom, $pending, $tree); } @@ -95,7 +95,7 @@ class IndividualFactory extends AbstractGedcomRecordFactory implements Individua * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('individuals') ->where('i_id', '=', $xref) diff --git a/app/Factories/LocationFactory.php b/app/Factories/LocationFactory.php index dac5b1a673..5dbd19e1b2 100644 --- a/app/Factories/LocationFactory.php +++ b/app/Factories/LocationFactory.php @@ -37,14 +37,8 @@ class LocationFactory extends AbstractGedcomRecordFactory implements LocationFac /** * Create a Location. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Location|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Location + public function make(string $xref, Tree $tree, string|null $gedcom = null): Location|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class LocationFactory extends AbstractGedcomRecordFactory implements LocationFac * * @return Location */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Location + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Location { return new Location($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class LocationFactory extends AbstractGedcomRecordFactory implements LocationFac * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/MediaFactory.php b/app/Factories/MediaFactory.php index 2d985c32d6..eddbcb6ad5 100644 --- a/app/Factories/MediaFactory.php +++ b/app/Factories/MediaFactory.php @@ -37,14 +37,8 @@ class MediaFactory extends AbstractGedcomRecordFactory implements MediaFactoryIn /** * Create a individual. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Media|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Media + public function make(string $xref, Tree $tree, string|null $gedcom = null): Media|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class MediaFactory extends AbstractGedcomRecordFactory implements MediaFactoryIn * * @return Media */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Media + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Media { return new Media($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class MediaFactory extends AbstractGedcomRecordFactory implements MediaFactoryIn * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('media') ->where('m_id', '=', $xref) diff --git a/app/Factories/NoteFactory.php b/app/Factories/NoteFactory.php index bb45a48ce1..9bcbcd68a8 100644 --- a/app/Factories/NoteFactory.php +++ b/app/Factories/NoteFactory.php @@ -37,14 +37,8 @@ class NoteFactory extends AbstractGedcomRecordFactory implements NoteFactoryInte /** * Create a note. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Note|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Note + public function make(string $xref, Tree $tree, string|null $gedcom = null): Note|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class NoteFactory extends AbstractGedcomRecordFactory implements NoteFactoryInte * * @return Note */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Note + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Note { return new Note($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class NoteFactory extends AbstractGedcomRecordFactory implements NoteFactoryInte * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/RepositoryFactory.php b/app/Factories/RepositoryFactory.php index 7eb111fe20..db96be0880 100644 --- a/app/Factories/RepositoryFactory.php +++ b/app/Factories/RepositoryFactory.php @@ -38,14 +38,8 @@ class RepositoryFactory extends AbstractGedcomRecordFactory implements Repositor /** * Create a repository. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Repository|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Repository + public function make(string $xref, Tree $tree, string|null $gedcom = null): Repository|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -89,7 +83,7 @@ class RepositoryFactory extends AbstractGedcomRecordFactory implements Repositor * * @return Repository */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Repository + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Repository { return new Repository($xref, $gedcom, $pending, $tree); } @@ -102,7 +96,7 @@ class RepositoryFactory extends AbstractGedcomRecordFactory implements Repositor * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/SharedNoteFactory.php b/app/Factories/SharedNoteFactory.php index 657d7c49db..f2279843c0 100644 --- a/app/Factories/SharedNoteFactory.php +++ b/app/Factories/SharedNoteFactory.php @@ -37,14 +37,8 @@ class SharedNoteFactory extends AbstractGedcomRecordFactory implements SharedNot /** * Create a note. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return SharedNote|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?SharedNote + public function make(string $xref, Tree $tree, string|null $gedcom = null): SharedNote|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class SharedNoteFactory extends AbstractGedcomRecordFactory implements SharedNot * * @return SharedNote */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): SharedNote + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): SharedNote { return new SharedNote($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class SharedNoteFactory extends AbstractGedcomRecordFactory implements SharedNot * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/SlugFactory.php b/app/Factories/SlugFactory.php index 2977a91992..bd3be82055 100644 --- a/app/Factories/SlugFactory.php +++ b/app/Factories/SlugFactory.php @@ -34,7 +34,7 @@ use function trim; */ class SlugFactory implements SlugFactoryInterface { - private ?Transliterator $transliterator = null; + private Transliterator|null $transliterator = null; public function __construct() { diff --git a/app/Factories/SourceFactory.php b/app/Factories/SourceFactory.php index d7a3d58a7b..b1080572d4 100644 --- a/app/Factories/SourceFactory.php +++ b/app/Factories/SourceFactory.php @@ -38,14 +38,8 @@ class SourceFactory extends AbstractGedcomRecordFactory implements SourceFactory /** * Create a individual. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Source|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Source + public function make(string $xref, Tree $tree, string|null $gedcom = null): Source|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -84,7 +78,7 @@ class SourceFactory extends AbstractGedcomRecordFactory implements SourceFactory * * @return Source */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Source + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Source { return new Source($xref, $gedcom, $pending, $tree); } @@ -97,7 +91,7 @@ class SourceFactory extends AbstractGedcomRecordFactory implements SourceFactory * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('sources') ->where('s_id', '=', $xref) diff --git a/app/Factories/SubmissionFactory.php b/app/Factories/SubmissionFactory.php index e02e99a64a..ef94ae159a 100644 --- a/app/Factories/SubmissionFactory.php +++ b/app/Factories/SubmissionFactory.php @@ -37,14 +37,8 @@ class SubmissionFactory extends AbstractGedcomRecordFactory implements Submissio /** * Create a submission. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Submission|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submission + public function make(string $xref, Tree $tree, string|null $gedcom = null): Submission|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class SubmissionFactory extends AbstractGedcomRecordFactory implements Submissio * * @return Submission */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Submission + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Submission { return new Submission($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class SubmissionFactory extends AbstractGedcomRecordFactory implements Submissio * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/SubmitterFactory.php b/app/Factories/SubmitterFactory.php index a4e69d320f..74eacca8bf 100644 --- a/app/Factories/SubmitterFactory.php +++ b/app/Factories/SubmitterFactory.php @@ -37,14 +37,8 @@ class SubmitterFactory extends AbstractGedcomRecordFactory implements SubmitterF /** * Create a submitter. - * - * @param string $xref - * @param Tree $tree - * @param string|null $gedcom - * - * @return Submitter|null */ - public function make(string $xref, Tree $tree, string|null $gedcom = null): ?Submitter + public function make(string $xref, Tree $tree, string|null $gedcom = null): Submitter|null { return Registry::cache()->array()->remember(self::class . $xref . '@' . $tree->id(), function () use ($xref, $tree, $gedcom) { $gedcom ??= $this->gedcom($xref, $tree); @@ -83,7 +77,7 @@ class SubmitterFactory extends AbstractGedcomRecordFactory implements SubmitterF * * @return Submitter */ - public function new(string $xref, string $gedcom, ?string $pending, Tree $tree): Submitter + public function new(string $xref, string $gedcom, string|null $pending, Tree $tree): Submitter { return new Submitter($xref, $gedcom, $pending, $tree); } @@ -96,7 +90,7 @@ class SubmitterFactory extends AbstractGedcomRecordFactory implements SubmitterF * * @return string|null */ - protected function gedcom(string $xref, Tree $tree): ?string + protected function gedcom(string $xref, Tree $tree): string|null { return DB::table('other') ->where('o_id', '=', $xref) diff --git a/app/Factories/TimestampFactory.php b/app/Factories/TimestampFactory.php index 46b97ea2e2..295c01611f 100644 --- a/app/Factories/TimestampFactory.php +++ b/app/Factories/TimestampFactory.php @@ -59,7 +59,7 @@ class TimestampFactory implements TimestampFactoryInterface * * @return TimestampInterface */ - public function fromString(?string $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface + public function fromString(string|null $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampInterface { $string ??= date($format); $timestamp = date_create_from_format($format, $string); diff --git a/app/Family.php b/app/Family.php index ceb8fc6a06..6d05e515e3 100644 --- a/app/Family.php +++ b/app/Family.php @@ -33,10 +33,10 @@ class Family extends GedcomRecord protected const ROUTE_NAME = FamilyPage::class; // The husband (or first spouse for same-sex couples) - private ?Individual $husb = null; + private Individual|null $husb = null; // The wife (or second spouse for same-sex couples) - private ?Individual $wife = null; + private Individual|null $wife = null; /** * Create a GedcomRecord object from raw GEDCOM data. @@ -47,7 +47,7 @@ class Family extends GedcomRecord * empty string for records with pending deletions * @param Tree $tree */ - public function __construct(string $xref, string $gedcom, ?string $pending, Tree $tree) + public function __construct(string $xref, string $gedcom, string|null $pending, Tree $tree) { parent::__construct($xref, $gedcom, $pending, $tree); @@ -105,7 +105,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function husband(int|null $access_level = null): ?Individual + public function husband(int|null $access_level = null): Individual|null { if ($this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS') === '1') { $access_level = Auth::PRIV_HIDE; @@ -125,7 +125,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function wife(int|null $access_level = null): ?Individual + public function wife(int|null $access_level = null): Individual|null { if ($this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS') === '1') { $access_level = Auth::PRIV_HIDE; @@ -181,7 +181,7 @@ class Family extends GedcomRecord * * @return Individual|null */ - public function spouse(Individual $person, int|null $access_level = null): ?Individual + public function spouse(Individual $person, int|null $access_level = null): Individual|null { if ($person === $this->wife) { return $this->husband($access_level); @@ -253,10 +253,8 @@ class Family extends GedcomRecord /** * get the marriage event - * - * @return Fact|null */ - public function getMarriage(): ?Fact + public function getMarriage(): Fact|null { return $this->facts(['MARR'])->first(); } diff --git a/app/GedcomFilters/GedcomEncodingFilter.php b/app/GedcomFilters/GedcomEncodingFilter.php index ed0d0ee477..c9eec0505f 100644 --- a/app/GedcomFilters/GedcomEncodingFilter.php +++ b/app/GedcomFilters/GedcomEncodingFilter.php @@ -34,9 +34,9 @@ class GedcomEncodingFilter extends php_user_filter { private string $data = ''; - private ?EncodingInterface $src_encoding = null; + private EncodingInterface|null $src_encoding = null; - private ?EncodingInterface $dst_encoding = null; + private EncodingInterface|null $dst_encoding = null; /** * Initialization diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index a3534ff000..e449ac749f 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -77,7 +77,7 @@ class GedcomRecord protected string $gedcom; // GEDCOM data (after any pending edits) - protected ?string $pending; + protected string|null $pending; /** @var array<Fact> Facts extracted from $gedcom/$pending */ protected array $facts; @@ -86,10 +86,10 @@ class GedcomRecord protected array $getAllNames = []; /** @var int|null Cached result */ - private ?int $getPrimaryName = null; + private int|null $getPrimaryName = null; /** @var int|null Cached result */ - private ?int $getSecondaryName = null; + private int|null $getSecondaryName = null; /** * Create a GedcomRecord object from raw GEDCOM data. @@ -100,7 +100,7 @@ class GedcomRecord * empty string for records with pending deletions * @param Tree $tree */ - public function __construct(string $xref, string $gedcom, ?string $pending, Tree $tree) + public function __construct(string $xref, string $gedcom, string|null $pending, Tree $tree) { $this->xref = $xref; $this->gedcom = $gedcom; @@ -474,7 +474,7 @@ class GedcomRecord * * @return string|null */ - public function alternateName(): ?string + public function alternateName(): string|null { if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) { $all_names = $this->getAllNames(); diff --git a/app/Http/Middleware/BadBotBlocker.php b/app/Http/Middleware/BadBotBlocker.php index b8a4d0b256..6211f72929 100644 --- a/app/Http/Middleware/BadBotBlocker.php +++ b/app/Http/Middleware/BadBotBlocker.php @@ -344,7 +344,7 @@ class BadBotBlocker implements MiddlewareInterface private function fetchIpRangesForAsn(string $asn): array { return Registry::cache()->file()->remember('whois-asn-' . $asn, static function () use ($asn): array { - $mapper = static fn (AsnRouteInfo $route_info): ?RangeInterface => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); + $mapper = static fn (AsnRouteInfo $route_info): RangeInterface|null => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); try { $loader = new CurlLoader(self::WHOIS_TIMEOUT); diff --git a/app/Http/Middleware/CompressResponse.php b/app/Http/Middleware/CompressResponse.php index b77372c8e5..8186efbb69 100644 --- a/app/Http/Middleware/CompressResponse.php +++ b/app/Http/Middleware/CompressResponse.php @@ -100,12 +100,7 @@ class CompressResponse implements MiddlewareInterface return $response; } - /** - * @param RequestInterface $request - * - * @return string|null - */ - protected function compressionMethod(RequestInterface $request): ?string + protected function compressionMethod(RequestInterface $request): string|null { $accept_encoding = strtolower($request->getHeaderLine('accept-encoding')); $zlib_available = extension_loaded('zlib'); diff --git a/app/Http/RequestHandlers/DataFixUpdateAll.php b/app/Http/RequestHandlers/DataFixUpdateAll.php index 6429c6148f..191b48bc8c 100644 --- a/app/Http/RequestHandlers/DataFixUpdateAll.php +++ b/app/Http/RequestHandlers/DataFixUpdateAll.php @@ -89,8 +89,8 @@ class DataFixUpdateAll implements RequestHandlerInterface /** @var Collection<int,GedcomRecord> $records */ $records = $rows - ->map(fn(object $row): ?GedcomRecord => $this->data_fix_service->getRecordByType($row->xref, $tree, $row->type)) - ->filter(static fn(?GedcomRecord $record): bool => $record instanceof GedcomRecord && !$record->isPendingDeletion() && $module->doesRecordNeedUpdate($record, $params)); + ->map(fn(object $row): GedcomRecord|null => $this->data_fix_service->getRecordByType($row->xref, $tree, $row->type)) + ->filter(static fn(GedcomRecord|null $record): bool => $record instanceof GedcomRecord && !$record->isPendingDeletion() && $module->doesRecordNeedUpdate($record, $params)); foreach ($records as $record) { $module->updateRecord($record, $params); diff --git a/app/I18N.php b/app/I18N.php index 079afe1606..f16b365545 100644 --- a/app/I18N.php +++ b/app/I18N.php @@ -209,7 +209,7 @@ class I18N private static Translator $translator; - private static ?Collator $collator = null; + private static Collator|null $collator = null; /** * The preferred locales for this site, or a default list if no preference. diff --git a/app/Individual.php b/app/Individual.php index 802d372a9b..efdd48f50e 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -45,11 +45,11 @@ class Individual extends GedcomRecord protected const ROUTE_NAME = IndividualPage::class; /** Used in some lists to keep track of this individual’s generation in that list */ - public ?int $generation = null; + public int|null $generation = null; - private ?Date $estimated_birth_date = null; + private Date|null $estimated_birth_date = null; - private ?Date $estimated_death_date = null; + private Date|null $estimated_death_date = null; /** * A closure which will compare individuals by birth date. @@ -345,10 +345,8 @@ class Individual extends GedcomRecord /** * Find the highlighted media object for an individual - * - * @return MediaFile|null */ - public function findHighlightedMediaFile(): ?MediaFile + public function findHighlightedMediaFile(): MediaFile|null { $fact = $this->facts(['OBJE']) ->first(static function (Fact $fact): bool { @@ -726,7 +724,7 @@ class Individual extends GedcomRecord * * @return Individual|null */ - public function getCurrentSpouse(): ?Individual + public function getCurrentSpouse(): Individual|null { $family = $this->spouseFamilies()->last(); diff --git a/app/Media.php b/app/Media.php index 0deeb9a4a4..64205a4675 100644 --- a/app/Media.php +++ b/app/Media.php @@ -74,10 +74,8 @@ class Media extends GedcomRecord /** * Get the first media file that contains an image. - * - * @return MediaFile|null */ - public function firstImageFile(): ?MediaFile + public function firstImageFile(): MediaFile|null { return $this->mediaFiles() ->first(static fn(MediaFile $media_file): bool => $media_file->isImage() && !$media_file->isExternal()); diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php index f0ed37c24c..9629c16868 100644 --- a/app/Module/AncestorsChartModule.php +++ b/app/Module/AncestorsChartModule.php @@ -119,12 +119,8 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac /** * Return a menu item for this chart - for use in individual boxes. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/CalendarMenuModule.php b/app/Module/CalendarMenuModule.php index a4460363e1..b567d1e4f3 100644 --- a/app/Module/CalendarMenuModule.php +++ b/app/Module/CalendarMenuModule.php @@ -65,12 +65,8 @@ class CalendarMenuModule extends AbstractModule implements ModuleMenuInterface /** * A menu, to be added to the main application menu. - * - * @param Tree $tree - * - * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $submenu = [ $this->calendarDayMenu($tree), diff --git a/app/Module/ChartsMenuModule.php b/app/Module/ChartsMenuModule.php index 666d322ad3..b3b6a2a2a3 100644 --- a/app/Module/ChartsMenuModule.php +++ b/app/Module/ChartsMenuModule.php @@ -79,12 +79,8 @@ class ChartsMenuModule extends AbstractModule implements ModuleMenuInterface /** * A menu, to be added to the main application menu. - * - * @param Tree $tree - * - * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $request = Registry::container()->get(ServerRequestInterface::class); $xref = Validator::attributes($request)->isXref()->string('xref', ''); diff --git a/app/Module/ClippingsCartModule.php b/app/Module/ClippingsCartModule.php index 9c73d88d2c..5f786ebba5 100644 --- a/app/Module/ClippingsCartModule.php +++ b/app/Module/ClippingsCartModule.php @@ -146,12 +146,8 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * A menu, to be added to the main application menu. - * - * @param Tree $tree - * - * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $request = Registry::container()->get(ServerRequestInterface::class); $route = Validator::attributes($request)->route(); @@ -413,7 +409,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface $xrefs = array_map('strval', $xrefs); // PHP converts numeric keys to integers. // Fetch all the records in the cart. - $records = array_map(static fn(string $xref): ?GedcomRecord => Registry::gedcomRecordFactory()->make($xref, $tree), $xrefs); + $records = array_map(static fn(string $xref): GedcomRecord|null => Registry::gedcomRecordFactory()->make($xref, $tree), $xrefs); // Some records may have been deleted after they were added to the cart. $records = array_filter($records); diff --git a/app/Module/CloudsTheme.php b/app/Module/CloudsTheme.php index dff8596117..4deaf7bb35 100644 --- a/app/Module/CloudsTheme.php +++ b/app/Module/CloudsTheme.php @@ -50,7 +50,7 @@ class CloudsTheme extends AbstractModule implements ModuleThemeInterface * * @return array<Menu> */ - public function genealogyMenu(?Tree $tree): array + public function genealogyMenu(Tree|null $tree): array { $primary_menu = $this->baseGenealogyMenu($tree); diff --git a/app/Module/ColorsTheme.php b/app/Module/ColorsTheme.php index 669c6941fa..996d4e10f6 100644 --- a/app/Module/ColorsTheme.php +++ b/app/Module/ColorsTheme.php @@ -60,7 +60,7 @@ class ColorsTheme extends CloudsTheme * * @return array<Menu> */ - public function userMenu(?Tree $tree): array + public function userMenu(Tree|null $tree): array { return array_filter([ $this->menuPendingChanges($tree), diff --git a/app/Module/CompactTreeChartModule.php b/app/Module/CompactTreeChartModule.php index 93615f08a8..9af48874e9 100644 --- a/app/Module/CompactTreeChartModule.php +++ b/app/Module/CompactTreeChartModule.php @@ -98,12 +98,8 @@ class CompactTreeChartModule extends AbstractModule implements ModuleChartInterf /** * Return a menu item for this chart - for use in individual boxes. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/DescendancyChartModule.php b/app/Module/DescendancyChartModule.php index 18a78fcd38..b91f5b41b6 100644 --- a/app/Module/DescendancyChartModule.php +++ b/app/Module/DescendancyChartModule.php @@ -115,12 +115,8 @@ class DescendancyChartModule extends AbstractModule implements ModuleChartInterf /** * Return a menu item for this chart - for use in individual boxes. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/FamilyBookChartModule.php b/app/Module/FamilyBookChartModule.php index f1c85516c1..9b66144e61 100644 --- a/app/Module/FamilyBookChartModule.php +++ b/app/Module/FamilyBookChartModule.php @@ -103,12 +103,8 @@ class FamilyBookChartModule extends AbstractModule implements ModuleChartInterfa /** * Return a menu item for this chart - for use in individual boxes. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/FamilyTreeFavoritesModule.php b/app/Module/FamilyTreeFavoritesModule.php index 8c500a1891..be1bbf428b 100644 --- a/app/Module/FamilyTreeFavoritesModule.php +++ b/app/Module/FamilyTreeFavoritesModule.php @@ -248,14 +248,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt ]); } - /** - * @param string $type - * @param string $xref - * @param Tree $tree - * - * @return GedcomRecord|null - */ - private function getRecordForType(string $type, string $xref, Tree $tree): ?GedcomRecord + private function getRecordForType(string $type, string $xref, Tree $tree): GedcomRecord|null { switch ($type) { case 'indi': diff --git a/app/Module/FanChartModule.php b/app/Module/FanChartModule.php index 097bdf619a..cc05f52230 100644 --- a/app/Module/FanChartModule.php +++ b/app/Module/FanChartModule.php @@ -158,12 +158,8 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface, Req /** * Return a menu item for this chart - for use in individual boxes. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/FixCemeteryTag.php b/app/Module/FixCemeteryTag.php index 741af67fb2..8c14091376 100644 --- a/app/Module/FixCemeteryTag.php +++ b/app/Module/FixCemeteryTag.php @@ -100,7 +100,7 @@ class FixCemeteryTag extends AbstractModule implements ModuleDataFixInterface * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { return $this->individualsToFixQuery($tree, $params) ->where(static function (Builder $query): void { diff --git a/app/Module/FixDuplicateLinks.php b/app/Module/FixDuplicateLinks.php index 96756ccab2..da95763f5f 100644 --- a/app/Module/FixDuplicateLinks.php +++ b/app/Module/FixDuplicateLinks.php @@ -92,7 +92,7 @@ class FixDuplicateLinks extends AbstractModule implements ModuleDataFixInterface * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { // No DB querying possible? Select all. return $this->individualsToFixQuery($tree, $params) diff --git a/app/Module/FixMissingDeaths.php b/app/Module/FixMissingDeaths.php index d0e59f5711..b305179146 100644 --- a/app/Module/FixMissingDeaths.php +++ b/app/Module/FixMissingDeaths.php @@ -75,7 +75,7 @@ class FixMissingDeaths extends AbstractModule implements ModuleDataFixInterface * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { $query = $this->individualsToFixQuery($tree, $params); diff --git a/app/Module/FixNameSlashesAndSpaces.php b/app/Module/FixNameSlashesAndSpaces.php index 54f4931c58..f05bb9fcdb 100644 --- a/app/Module/FixNameSlashesAndSpaces.php +++ b/app/Module/FixNameSlashesAndSpaces.php @@ -76,7 +76,7 @@ class FixNameSlashesAndSpaces extends AbstractModule implements ModuleDataFixInt * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { // No DB querying possible? Select all. return $this->individualsToFixQuery($tree, $params) diff --git a/app/Module/FixPlaceNames.php b/app/Module/FixPlaceNames.php index a026a299f1..0cd7d0450f 100644 --- a/app/Module/FixPlaceNames.php +++ b/app/Module/FixPlaceNames.php @@ -91,7 +91,7 @@ class FixPlaceNames extends AbstractModule implements ModuleDataFixInterface * * @return Collection<int,string>|null */ - protected function familiesToFix(Tree $tree, array $params): ?Collection + protected function familiesToFix(Tree $tree, array $params): Collection|null { if ($params['search-for'] === '' || $params['replace-with'] === '') { return null; @@ -113,7 +113,7 @@ class FixPlaceNames extends AbstractModule implements ModuleDataFixInterface * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { if ($params['search-for'] === '' || $params['replace-with'] === '') { return null; diff --git a/app/Module/FixSearchAndReplace.php b/app/Module/FixSearchAndReplace.php index 4bc1625a9d..ab0e387b1b 100644 --- a/app/Module/FixSearchAndReplace.php +++ b/app/Module/FixSearchAndReplace.php @@ -133,7 +133,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function familiesToFix(Tree $tree, array $params): ?Collection + protected function familiesToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Family::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -154,7 +154,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Individual::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -177,7 +177,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function locationsToFix(Tree $tree, array $params): ?Collection + protected function locationsToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Location::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -201,7 +201,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function mediaToFix(Tree $tree, array $params): ?Collection + protected function mediaToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Media::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -224,7 +224,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function notesToFix(Tree $tree, array $params): ?Collection + protected function notesToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Note::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -248,7 +248,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function repositoriesToFix(Tree $tree, array $params): ?Collection + protected function repositoriesToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Repository::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -272,7 +272,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function sourcesToFix(Tree $tree, array $params): ?Collection + protected function sourcesToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Source::RECORD_TYPE || $params['search-for'] === '') { return null; @@ -294,7 +294,7 @@ class FixSearchAndReplace extends AbstractModule implements ModuleDataFixInterfa * * @return Collection<int,string>|null */ - protected function submittersToFix(Tree $tree, array $params): ?Collection + protected function submittersToFix(Tree $tree, array $params): Collection|null { if ($params['type'] !== Submitter::RECORD_TYPE || $params['search-for'] === '') { return null; diff --git a/app/Module/FrequentlyAskedQuestionsModule.php b/app/Module/FrequentlyAskedQuestionsModule.php index 6c3ec131c3..4eccc22637 100644 --- a/app/Module/FrequentlyAskedQuestionsModule.php +++ b/app/Module/FrequentlyAskedQuestionsModule.php @@ -98,7 +98,7 @@ class FrequentlyAskedQuestionsModule extends AbstractModule implements ModuleCon * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { if ($this->faqsExist($tree, I18N::languageTag())) { return new Menu($this->title(), route('module', [ diff --git a/app/Module/HourglassChartModule.php b/app/Module/HourglassChartModule.php index b9cc77594b..c396079c17 100644 --- a/app/Module/HourglassChartModule.php +++ b/app/Module/HourglassChartModule.php @@ -107,7 +107,7 @@ class HourglassChartModule extends AbstractModule implements ModuleChartInterfac * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php index 25f0ded92e..b94041a3d2 100644 --- a/app/Module/InteractiveTree/TreeView.php +++ b/app/Module/InteractiveTree/TreeView.php @@ -93,7 +93,7 @@ class TreeView switch ($firstLetter) { case 'c': $families = Collection::make(explode(',', $json_request)) - ->map(static fn(string $xref): ?Family => Registry::familyFactory()->make($xref, $tree)) + ->map(static fn(string $xref): Family|null => Registry::familyFactory()->make($xref, $tree)) ->filter(); $r[] = $this->drawChildren($families, 1, true); @@ -235,7 +235,7 @@ class TreeView * * @return string */ - private function drawPerson(Individual $person, int $gen, int $state, ?Family $pfamily, string $line, bool $isRoot): string + private function drawPerson(Individual $person, int $gen, int $state, Family|null $pfamily, string $line, bool $isRoot): string { if ($gen < 0) { return ''; diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php index 567d198633..98e642bf0f 100644 --- a/app/Module/InteractiveTreeModule.php +++ b/app/Module/InteractiveTreeModule.php @@ -141,7 +141,7 @@ class InteractiveTreeModule extends AbstractModule implements ModuleChartInterfa * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php index 25a8021806..554fbb4027 100644 --- a/app/Module/LifespansChartModule.php +++ b/app/Module/LifespansChartModule.php @@ -248,9 +248,9 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac protected function chart(Tree $tree, array $xrefs): ResponseInterface { /** @var Individual[] $individuals */ - $individuals = array_map(static fn(string $xref): ?Individual => Registry::individualFactory()->make($xref, $tree), $xrefs); + $individuals = array_map(static fn(string $xref): Individual|null => Registry::individualFactory()->make($xref, $tree), $xrefs); - $individuals = array_filter($individuals, static fn(?Individual $individual): bool => $individual instanceof Individual && $individual->canShow()); + $individuals = array_filter($individuals, static fn(Individual|null $individual): bool => $individual instanceof Individual && $individual->canShow()); // Sort the array in order of birth year usort($individuals, Individual::birthDateComparator()); diff --git a/app/Module/ListsMenuModule.php b/app/Module/ListsMenuModule.php index 7c62695694..ac195cce76 100644 --- a/app/Module/ListsMenuModule.php +++ b/app/Module/ListsMenuModule.php @@ -81,10 +81,10 @@ class ListsMenuModule extends AbstractModule implements ModuleMenuInterface * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $submenus = $this->module_service->findByComponent(ModuleListInterface::class, $tree, Auth::user()) - ->map(static fn(ModuleListInterface $module): ?Menu => $module->listMenu($tree)) + ->map(static fn(ModuleListInterface $module): Menu|null => $module->listMenu($tree)) ->filter() ->sort(static fn(Menu $x, Menu $y): int => I18N::comparator()($x->getLabel(), $y->getLabel())); diff --git a/app/Module/ModuleChartInterface.php b/app/Module/ModuleChartInterface.php index cc9eceefc3..e1736de2ec 100644 --- a/app/Module/ModuleChartInterface.php +++ b/app/Module/ModuleChartInterface.php @@ -29,12 +29,8 @@ interface ModuleChartInterface extends ModuleInterface { /** * A menu item for this chart for an individual box in a chart. - * - * @param Individual $individual - * - * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu; + public function chartBoxMenu(Individual $individual): Menu|null; /** * A main menu item for this chart. diff --git a/app/Module/ModuleChartTrait.php b/app/Module/ModuleChartTrait.php index d2b859f4e4..5034f5f5ee 100644 --- a/app/Module/ModuleChartTrait.php +++ b/app/Module/ModuleChartTrait.php @@ -48,7 +48,7 @@ trait ModuleChartTrait * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return null; } diff --git a/app/Module/ModuleDataFixTrait.php b/app/Module/ModuleDataFixTrait.php index 0285856bd7..573b0c99af 100644 --- a/app/Module/ModuleDataFixTrait.php +++ b/app/Module/ModuleDataFixTrait.php @@ -155,7 +155,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function familiesToFix(Tree $tree, array $params): ?Collection + protected function familiesToFix(Tree $tree, array $params): Collection|null { return null; } @@ -186,7 +186,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function individualsToFix(Tree $tree, array $params): ?Collection + protected function individualsToFix(Tree $tree, array $params): Collection|null { return null; } @@ -217,7 +217,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function locationsToFix(Tree $tree, array $params): ?Collection + protected function locationsToFix(Tree $tree, array $params): Collection|null { return null; } @@ -249,7 +249,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function mediaToFix(Tree $tree, array $params): ?Collection + protected function mediaToFix(Tree $tree, array $params): Collection|null { return null; } @@ -280,7 +280,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function notesToFix(Tree $tree, array $params): ?Collection + protected function notesToFix(Tree $tree, array $params): Collection|null { return null; } @@ -312,7 +312,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function repositoriesToFix(Tree $tree, array $params): ?Collection + protected function repositoriesToFix(Tree $tree, array $params): Collection|null { return null; } @@ -344,7 +344,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function sourcesToFix(Tree $tree, array $params): ?Collection + protected function sourcesToFix(Tree $tree, array $params): Collection|null { return null; } @@ -375,7 +375,7 @@ trait ModuleDataFixTrait * * @return Collection<int,string>|null */ - protected function submittersToFix(Tree $tree, array $params): ?Collection + protected function submittersToFix(Tree $tree, array $params): Collection|null { return null; } diff --git a/app/Module/ModuleListInterface.php b/app/Module/ModuleListInterface.php index 034d1aaf51..a6dfadbad5 100644 --- a/app/Module/ModuleListInterface.php +++ b/app/Module/ModuleListInterface.php @@ -34,7 +34,7 @@ interface ModuleListInterface extends ModuleInterface * * @return Menu|null */ - public function listMenu(Tree $tree): ?Menu; + public function listMenu(Tree $tree): Menu|null; /** * CSS class for the menu. diff --git a/app/Module/ModuleListTrait.php b/app/Module/ModuleListTrait.php index 7606ec0d23..9d784e72a7 100644 --- a/app/Module/ModuleListTrait.php +++ b/app/Module/ModuleListTrait.php @@ -48,7 +48,7 @@ trait ModuleListTrait * * @return Menu|null */ - public function listMenu(Tree $tree): ?Menu + public function listMenu(Tree $tree): Menu|null { if ($this->listIsEmpty($tree)) { return null; diff --git a/app/Module/ModuleMenuInterface.php b/app/Module/ModuleMenuInterface.php index 03d57e3319..eb991d709f 100644 --- a/app/Module/ModuleMenuInterface.php +++ b/app/Module/ModuleMenuInterface.php @@ -57,5 +57,5 @@ interface ModuleMenuInterface extends ModuleInterface * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu; + public function getMenu(Tree $tree): Menu|null; } diff --git a/app/Module/ModuleMenuTrait.php b/app/Module/ModuleMenuTrait.php index 2a19020e5f..d007a6a62c 100644 --- a/app/Module/ModuleMenuTrait.php +++ b/app/Module/ModuleMenuTrait.php @@ -69,7 +69,7 @@ trait ModuleMenuTrait * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { return null; } diff --git a/app/Module/ModuleThemeInterface.php b/app/Module/ModuleThemeInterface.php index 067ff2f60b..9b541e9595 100644 --- a/app/Module/ModuleThemeInterface.php +++ b/app/Module/ModuleThemeInterface.php @@ -42,7 +42,7 @@ interface ModuleThemeInterface extends ModuleInterface * * @return Menu|null */ - public function menuThemes(): ?Menu; + public function menuThemes(): Menu|null; /** * Generate a list of items for the main menu. @@ -51,7 +51,7 @@ interface ModuleThemeInterface extends ModuleInterface * * @return array<Menu> */ - public function genealogyMenu(?Tree $tree): array; + public function genealogyMenu(Tree|null $tree): array; /** * Generate a list of items for the user menu. @@ -60,7 +60,7 @@ interface ModuleThemeInterface extends ModuleInterface * * @return array<Menu> */ - public function userMenu(?Tree $tree): array; + public function userMenu(Tree|null $tree): array; /** * A list of CSS files to include for this page. diff --git a/app/Module/ModuleThemeTrait.php b/app/Module/ModuleThemeTrait.php index dd1e58babe..1be4c9aa18 100644 --- a/app/Module/ModuleThemeTrait.php +++ b/app/Module/ModuleThemeTrait.php @@ -200,7 +200,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuChangeBlocks(Tree $tree): ?Menu + public function menuChangeBlocks(Tree $tree): Menu|null { $request = Registry::container()->get(ServerRequestInterface::class); $route = Validator::attributes($request)->route(); @@ -223,7 +223,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuControlPanel(Tree $tree): ?Menu + public function menuControlPanel(Tree $tree): Menu|null { if (Auth::isAdmin()) { return new Menu(I18N::translate('Control panel'), route(ControlPanel::class), 'menu-admin'); @@ -241,7 +241,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuLanguages(): ?Menu + public function menuLanguages(): Menu|null { $menu = new Menu(I18N::translate('Language'), '#', 'menu-language'); @@ -265,7 +265,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuLogin(): ?Menu + public function menuLogin(): Menu|null { if (Auth::check()) { return null; @@ -294,7 +294,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuLogout(): ?Menu + public function menuLogout(): Menu|null { if (Auth::check()) { $parameters = [ @@ -315,7 +315,7 @@ trait ModuleThemeTrait * * @return Menu */ - public function menuMyAccount(?Tree $tree): Menu + public function menuMyAccount(Tree|null $tree): Menu { $url = route(AccountEdit::class, ['tree' => $tree?->name()]); @@ -329,7 +329,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuMyIndividualRecord(Tree $tree): ?Menu + public function menuMyIndividualRecord(Tree $tree): Menu|null { $record = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $tree); @@ -359,7 +359,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuMyPages(?Tree $tree): ?Menu + public function menuMyPages(Tree|null $tree): Menu|null { if (Auth::check()) { if ($tree instanceof Tree) { @@ -386,7 +386,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuMyPedigree(Tree $tree): ?Menu + public function menuMyPedigree(Tree $tree): Menu|null { $my_xref = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF); @@ -417,7 +417,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuPendingChanges(?Tree $tree): ?Menu + public function menuPendingChanges(Tree|null $tree): Menu|null { if ($tree instanceof Tree && $tree->hasPendingEdit() && Auth::isModerator($tree)) { $request = Registry::container()->get(ServerRequestInterface::class); @@ -438,7 +438,7 @@ trait ModuleThemeTrait * * @return Menu|null */ - public function menuThemes(): ?Menu + public function menuThemes(): Menu|null { $module_service = Registry::container()->get(ModuleService::class); $themes = $module_service->findByInterface(ModuleThemeInterface::class, false, true); @@ -467,7 +467,7 @@ trait ModuleThemeTrait * * @return array<Menu> */ - public function genealogyMenu(?Tree $tree): array + public function genealogyMenu(Tree|null $tree): array { if ($tree === null) { return []; @@ -477,7 +477,7 @@ trait ModuleThemeTrait return $module_service ->findByComponent(ModuleMenuInterface::class, $tree, Auth::user()) - ->map(static fn (ModuleMenuInterface $menu): ?Menu => $menu->getMenu($tree)) + ->map(static fn (ModuleMenuInterface $menu): Menu|null => $menu->getMenu($tree)) ->filter() ->all(); } @@ -501,7 +501,7 @@ trait ModuleThemeTrait * * @return array<Menu> */ - public function userMenu(?Tree $tree): array + public function userMenu(Tree|null $tree): array { return array_filter([ $this->menuPendingChanges($tree), diff --git a/app/Module/NotesTabModule.php b/app/Module/NotesTabModule.php index 6fb249eb6f..4047a76d0e 100644 --- a/app/Module/NotesTabModule.php +++ b/app/Module/NotesTabModule.php @@ -35,7 +35,7 @@ class NotesTabModule extends AbstractModule implements ModuleTabInterface use ModuleTabTrait; /** @var Collection<array-key,Fact>|null */ - private ?Collection $facts = null; + private Collection|null $facts = null; private ClipboardService $clipboard_service; diff --git a/app/Module/PedigreeChartModule.php b/app/Module/PedigreeChartModule.php index e2895621d6..a76da4fd9e 100644 --- a/app/Module/PedigreeChartModule.php +++ b/app/Module/PedigreeChartModule.php @@ -130,7 +130,7 @@ class PedigreeChartModule extends AbstractModule implements ModuleChartInterface * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } @@ -200,7 +200,7 @@ class PedigreeChartModule extends AbstractModule implements ModuleChartInterface // Father’s ancestors link to the father’s pedigree // Mother’s ancestors link to the mother’s pedigree.. - $links = $ancestors->map(function (?Individual $individual, $sosa) use ($ancestors, $style, $generations): string { + $links = $ancestors->map(function (Individual|null $individual, $sosa) use ($ancestors, $style, $generations): string { if ($individual instanceof Individual && $sosa >= 2 ** $generations / 2 && $individual->childFamilies()->isNotEmpty()) { // The last row/column, and there are more generations. if ($sosa >= 2 ** $generations * 3 / 4) { diff --git a/app/Module/PedigreeMapModule.php b/app/Module/PedigreeMapModule.php index a1d6f552a9..55d2f2fefe 100644 --- a/app/Module/PedigreeMapModule.php +++ b/app/Module/PedigreeMapModule.php @@ -137,7 +137,7 @@ class PedigreeMapModule extends AbstractModule implements ModuleChartInterface, * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/PlaceHierarchyListModule.php b/app/Module/PlaceHierarchyListModule.php index 1e2058bff7..8792c961cd 100644 --- a/app/Module/PlaceHierarchyListModule.php +++ b/app/Module/PlaceHierarchyListModule.php @@ -338,7 +338,7 @@ class PlaceHierarchyListModule extends AbstractModule implements ModuleListInter * * @return array{columns:array<array<Place>>,place:Place,tree:Tree,col_class:string}|null */ - private function getHierarchy(Place $place): ?array + private function getHierarchy(Place $place): array|null { $child_places = $place->getChildPlaces(); $numfound = count($child_places); diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php index 17ca03e065..722ae6d63a 100644 --- a/app/Module/RelationshipsChartModule.php +++ b/app/Module/RelationshipsChartModule.php @@ -131,7 +131,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * * @return Menu|null */ - public function chartBoxMenu(Individual $individual): ?Menu + public function chartBoxMenu(Individual $individual): Menu|null { return $this->chartMenu($individual); } diff --git a/app/Module/ReportsMenuModule.php b/app/Module/ReportsMenuModule.php index 59f72204cc..456f2de7f5 100644 --- a/app/Module/ReportsMenuModule.php +++ b/app/Module/ReportsMenuModule.php @@ -84,7 +84,7 @@ class ReportsMenuModule extends AbstractModule implements ModuleMenuInterface * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $request = Registry::container()->get(ServerRequestInterface::class); $xref = Validator::attributes($request)->isXref()->string('xref', ''); diff --git a/app/Module/SearchMenuModule.php b/app/Module/SearchMenuModule.php index f06468abac..947978b843 100644 --- a/app/Module/SearchMenuModule.php +++ b/app/Module/SearchMenuModule.php @@ -76,7 +76,7 @@ class SearchMenuModule extends AbstractModule implements ModuleMenuInterface * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $submenu = [ $this->menuSearchGeneral($tree), @@ -130,7 +130,7 @@ class SearchMenuModule extends AbstractModule implements ModuleMenuInterface * * @return Menu|null */ - protected function menuSearchAndReplace(Tree $tree): ?Menu + protected function menuSearchAndReplace(Tree $tree): Menu|null { if (Auth::isEditor($tree)) { $url = route(SearchReplacePage::class, ['tree' => $tree->name()]); diff --git a/app/Module/SourcesTabModule.php b/app/Module/SourcesTabModule.php index e6d316576c..6f2743596b 100644 --- a/app/Module/SourcesTabModule.php +++ b/app/Module/SourcesTabModule.php @@ -33,7 +33,7 @@ class SourcesTabModule extends AbstractModule implements ModuleTabInterface use ModuleTabTrait; /** @var Collection<array-key,Fact>|null */ - private ?Collection $facts = null; + private Collection|null $facts = null; private ClipboardService $clipboard_service; diff --git a/app/Module/StoriesModule.php b/app/Module/StoriesModule.php index ef65a1c2b5..1d537b03df 100644 --- a/app/Module/StoriesModule.php +++ b/app/Module/StoriesModule.php @@ -184,7 +184,7 @@ class StoriesModule extends AbstractModule implements ModuleConfigInterface, Mod * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { return new Menu($this->title(), route('module', [ 'module' => $this->name(), diff --git a/app/Module/TimelineChartModule.php b/app/Module/TimelineChartModule.php index 20ad73f12a..1544a3f9cf 100644 --- a/app/Module/TimelineChartModule.php +++ b/app/Module/TimelineChartModule.php @@ -160,7 +160,7 @@ class TimelineChartModule extends AbstractModule implements ModuleChartInterface // Find the requested individuals. $individuals = (new Collection($xrefs)) ->uniqueStrict() - ->map(static fn(string $xref): ?Individual => Registry::individualFactory()->make($xref, $tree)) + ->map(static fn(string $xref): Individual|null => Registry::individualFactory()->make($xref, $tree)) ->filter() ->filter(GedcomRecord::accessFilter()); @@ -179,9 +179,9 @@ class TimelineChartModule extends AbstractModule implements ModuleChartInterface ]); } - $individuals = array_map(static fn(string $xref): ?Individual => Registry::individualFactory()->make($xref, $tree), $xrefs); + $individuals = array_map(static fn(string $xref): Individual|null => Registry::individualFactory()->make($xref, $tree), $xrefs); - $individuals = array_filter($individuals, static fn(?Individual $individual): bool => $individual instanceof Individual && $individual->canShow()); + $individuals = array_filter($individuals, static fn(Individual|null $individual): bool => $individual instanceof Individual && $individual->canShow()); if ($ajax) { $this->layout = 'layouts/ajax'; @@ -237,9 +237,9 @@ class TimelineChartModule extends AbstractModule implements ModuleChartInterface protected function chart(Tree $tree, array $xrefs, int $scale): ResponseInterface { /** @var Individual[] $individuals */ - $individuals = array_map(static fn(string $xref): ?Individual => Registry::individualFactory()->make($xref, $tree), $xrefs); + $individuals = array_map(static fn(string $xref): Individual|null => Registry::individualFactory()->make($xref, $tree), $xrefs); - $individuals = array_filter($individuals, static fn(?Individual $individual): bool => $individual instanceof Individual && $individual->canShow()); + $individuals = array_filter($individuals, static fn(Individual|null $individual): bool => $individual instanceof Individual && $individual->canShow()); $baseyear = (int) date('Y'); $topyear = 0; diff --git a/app/Module/TreesMenuModule.php b/app/Module/TreesMenuModule.php index 71e7c35180..79df0ffbc1 100644 --- a/app/Module/TreesMenuModule.php +++ b/app/Module/TreesMenuModule.php @@ -85,7 +85,7 @@ class TreesMenuModule extends AbstractModule implements ModuleMenuInterface * * @return Menu|null */ - public function getMenu(Tree $tree): ?Menu + public function getMenu(Tree $tree): Menu|null { $trees = $this->tree_service->all(); diff --git a/app/Module/UserFavoritesModule.php b/app/Module/UserFavoritesModule.php index a8e334817b..ce92c83b0c 100644 --- a/app/Module/UserFavoritesModule.php +++ b/app/Module/UserFavoritesModule.php @@ -252,14 +252,7 @@ class UserFavoritesModule extends AbstractModule implements ModuleBlockInterface ]); } - /** - * @param string $type - * @param string $xref - * @param Tree $tree - * - * @return GedcomRecord|null - */ - private function getRecordForType(string $type, string $xref, Tree $tree): ?GedcomRecord + private function getRecordForType(string $type, string $xref, Tree $tree): GedcomRecord|null { switch ($type) { case 'indi': diff --git a/app/PlaceLocation.php b/app/PlaceLocation.php index e3e7fc3cd1..a9b4716213 100644 --- a/app/PlaceLocation.php +++ b/app/PlaceLocation.php @@ -71,7 +71,7 @@ class PlaceLocation * * @return int|null */ - public function id(): ?int + public function id(): int|null { // The "top-level" location won't exist in the database. if ($this->parts->isEmpty()) { @@ -169,20 +169,16 @@ class PlaceLocation /** * Latitude of the location. - * - * @return float|null */ - public function latitude(): ?float + public function latitude(): float|null { return $this->details()->latitude; } /** * Longitude of the location. - * - * @return float|null */ - public function longitude(): ?float + public function longitude(): float|null { return $this->details()->longitude; } diff --git a/app/Relationship.php b/app/Relationship.php index 02ba2d3eaa..6204a15d60 100644 --- a/app/Relationship.php +++ b/app/Relationship.php @@ -103,7 +103,7 @@ class Relationship * * @return array<string>|null [nominative, genitive] or null */ - public function match(array $nodes, array $patterns): ?array + public function match(array $nodes, array $patterns): array|null { $captures = []; diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 3d84016408..e56e681069 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1899,7 +1899,7 @@ class ReportParserGenerate extends ReportParserBase ->groupBy(['xref']); }) ->get() - ->map(fn (object $row): ?GedcomRecord => Registry::gedcomRecordFactory()->make($row->xref, $this->tree, $row->new_gedcom ?: $row->old_gedcom)) + ->map(fn (object $row): GedcomRecord|null => Registry::gedcomRecordFactory()->make($row->xref, $this->tree, $row->new_gedcom ?: $row->old_gedcom)) ->filter() ->all(); break; diff --git a/app/Services/DataFixService.php b/app/Services/DataFixService.php index fd4e32bd5c..1bd50737b9 100644 --- a/app/Services/DataFixService.php +++ b/app/Services/DataFixService.php @@ -45,14 +45,8 @@ class DataFixService { /** * Since we know the type, this is quicker than calling Registry::gedcomRecordFactory()->make(). - * - * @param string $xref - * @param Tree $tree - * @param string $type - * - * @return GedcomRecord|null */ - public function getRecordByType(string $xref, Tree $tree, string $type): ?GedcomRecord + public function getRecordByType(string $xref, Tree $tree, string $type): GedcomRecord|null { switch ($type) { case Family::RECORD_TYPE: diff --git a/app/Services/GedcomService.php b/app/Services/GedcomService.php index 996ec9f1a0..8855b76922 100644 --- a/app/Services/GedcomService.php +++ b/app/Services/GedcomService.php @@ -174,34 +174,17 @@ class GedcomService return $tag; } - /** - * @param string $text - * - * @return float|null - */ - public function readLatitude(string $text): ?float + public function readLatitude(string $text): float|null { return $this->readDegrees($text, Gedcom::LATITUDE_NORTH, Gedcom::LATITUDE_SOUTH); } - /** - * @param string $text - * - * @return float|null - */ - public function readLongitude(string $text): ?float + public function readLongitude(string $text): float|null { return $this->readDegrees($text, Gedcom::LONGITUDE_EAST, Gedcom::LONGITUDE_WEST); } - /** - * @param string $text - * @param string $positive - * @param string $negative - * - * @return float|null - */ - private function readDegrees(string $text, string $positive, string $negative): ?float + private function readDegrees(string $text, string $positive, string $negative): float|null { $text = trim($text); $hemisphere = substr($text, 0, 1); diff --git a/app/Services/HomePageService.php b/app/Services/HomePageService.php index 624a79c5e1..be53606e3a 100644 --- a/app/Services/HomePageService.php +++ b/app/Services/HomePageService.php @@ -385,6 +385,7 @@ class HomePageService */ private function filterActiveBlocks(Collection $blocks, Collection $active_blocks): Collection { - return $blocks->map(static fn(string $block_name): ?ModuleBlockInterface => $active_blocks->filter(static fn(ModuleInterface $block): bool => $block->name() === $block_name)->first())->filter(); + return $blocks->map(static fn(string $block_name): ModuleBlockInterface|null => $active_blocks->filter(static fn(ModuleInterface $block): bool => $block->name() === $block_name)->first()) + ->filter(); } } diff --git a/app/Services/MapDataService.php b/app/Services/MapDataService.php index cf11db4e41..f11a27eb37 100644 --- a/app/Services/MapDataService.php +++ b/app/Services/MapDataService.php @@ -175,7 +175,7 @@ class MapDataService * * @return void */ - public function deleteUnusedLocations(?int $parent_location_id, array $parent_place_ids): void + public function deleteUnusedLocations(int|null $parent_location_id, array $parent_place_ids): void { if ($parent_location_id === null) { $location_query = DB::table('place_location') @@ -212,7 +212,7 @@ class MapDataService * * @return Collection<int,object> */ - public function getPlaceListLocation(?int $parent_id): Collection + public function getPlaceListLocation(int|null $parent_id): Collection { $prefix = DB::connection()->getTablePrefix(); diff --git a/app/Services/ModuleService.php b/app/Services/ModuleService.php index 9c19525a1e..6b889e7a8a 100644 --- a/app/Services/ModuleService.php +++ b/app/Services/ModuleService.php @@ -696,7 +696,7 @@ class ModuleService return strlen($module_name) <= 30; }) - ->map(static function (string $filename): ?ModuleCustomInterface { + ->map(static function (string $filename): ModuleCustomInterface|null { $module = self::load($filename); if ($module instanceof ModuleCustomInterface) { @@ -713,12 +713,8 @@ class ModuleService /** * Load a custom module in a static scope, to prevent it from modifying local or object variables. - * - * @param string $filename - * - * @return ModuleInterface|null */ - private static function load(string $filename): ?ModuleInterface + private static function load(string $filename): ModuleInterface|null { try { return include $filename; @@ -829,13 +825,8 @@ class ModuleService /** * Find a specified module, if it is currently active. - * - * @param string $module_name - * @param bool $include_disabled - * - * @return ModuleInterface|null */ - public function findByName(string $module_name, bool $include_disabled = false): ?ModuleInterface + public function findByName(string $module_name, bool $include_disabled = false): ModuleInterface|null { return $this->all($include_disabled) ->first(static fn(ModuleInterface $module): bool => $module->name() === $module_name); diff --git a/app/Services/UserService.php b/app/Services/UserService.php index f468155dce..aa4d5c5491 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -44,15 +44,11 @@ class UserService { /** * Find the user with a specified user_id. - * - * @param int|null $user_id - * - * @return User|null */ - public function find(?int $user_id): ?User + public function find(int|null $user_id): User|null { return Registry::cache()->array() - ->remember('user-' . $user_id, static fn(): ?User => DB::table('user') + ->remember('user-' . $user_id, static fn(): User|null => DB::table('user') ->where('user_id', '=', $user_id) ->get() ->map(User::rowMapper()) @@ -61,12 +57,8 @@ class UserService /** * Find the user with a specified email address. - * - * @param string $email - * - * @return User|null */ - public function findByEmail(string $email): ?User + public function findByEmail(string $email): User|null { return DB::table('user') ->where('email', '=', $email) @@ -77,12 +69,8 @@ class UserService /** * Find the user with a specified user_name or email address. - * - * @param string $identifier - * - * @return User|null */ - public function findByIdentifier(string $identifier): ?User + public function findByIdentifier(string $identifier): User|null { return DB::table('user') ->where('user_name', '=', $identifier) @@ -113,12 +101,8 @@ class UserService /** * Find the user with a specified password reset token. - * - * @param string $token - * - * @return User|null */ - public function findByToken(string $token): ?User + public function findByToken(string $token): User|null { return DB::table('user') ->join('user_setting AS us1', 'us1.user_id', '=', 'user.user_id') @@ -135,12 +119,8 @@ class UserService /** * Find the user with a specified user_name. - * - * @param string $user_name - * - * @return User|null */ - public function findByUserName(string $user_name): ?User + public function findByUserName(string $user_name): User|null { return DB::table('user') ->where('user_name', '=', $user_name) diff --git a/app/Statistics.php b/app/Statistics.php index 4a1bdcb1eb..8117d8ddc2 100644 --- a/app/Statistics.php +++ b/app/Statistics.php @@ -2796,7 +2796,7 @@ class Statistics implements * * @return string|null */ - public function callBlock(string $block = '', ...$params): ?string + public function callBlock(string $block = '', ...$params): string|null { /** @var ModuleBlockInterface|null $module */ $module = $this->module_service diff --git a/app/Statistics/Repository/EventRepository.php b/app/Statistics/Repository/EventRepository.php index c41bee6986..303614d508 100644 --- a/app/Statistics/Repository/EventRepository.php +++ b/app/Statistics/Repository/EventRepository.php @@ -218,7 +218,7 @@ class EventRepository implements EventRepositoryInterface * * @return object{id:string,year:int,fact:string,type:string}|null */ - private function eventQuery(string $direction): ?object + private function eventQuery(string $direction): object|null { return DB::table('dates') ->select(['d_gid as id', 'd_year as year', 'd_fact AS fact', 'd_type AS type']) diff --git a/app/Statistics/Repository/FamilyDatesRepository.php b/app/Statistics/Repository/FamilyDatesRepository.php index 7fdfc4e954..1c1d69a034 100644 --- a/app/Statistics/Repository/FamilyDatesRepository.php +++ b/app/Statistics/Repository/FamilyDatesRepository.php @@ -69,7 +69,7 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface * * @return object{id:string,year:int,fact:string,type:string}|null */ - private function eventQuery(string $fact, string $operation): ?object + private function eventQuery(string $fact, string $operation): object|null { return DB::table('dates') ->select(['d_gid as id', 'd_year as year', 'd_fact AS fact', 'd_type AS type']) diff --git a/app/SurnameTradition/DefaultSurnameTradition.php b/app/SurnameTradition/DefaultSurnameTradition.php index 8a3c1dd8d3..7a3d80e34c 100644 --- a/app/SurnameTradition/DefaultSurnameTradition.php +++ b/app/SurnameTradition/DefaultSurnameTradition.php @@ -86,7 +86,7 @@ class DefaultSurnameTradition implements SurnameTraditionInterface * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { return [ $this->buildName('//', ['TYPE' => NameType::VALUE_BIRTH]), @@ -155,7 +155,7 @@ class DefaultSurnameTradition implements SurnameTraditionInterface * * @return string */ - protected function extractName(?Individual $individual): string + protected function extractName(Individual|null $individual): string { if ($individual instanceof Individual) { $fact = $individual diff --git a/app/SurnameTradition/IcelandicSurnameTradition.php b/app/SurnameTradition/IcelandicSurnameTradition.php index e29703e7bd..8a26ed17f9 100644 --- a/app/SurnameTradition/IcelandicSurnameTradition.php +++ b/app/SurnameTradition/IcelandicSurnameTradition.php @@ -71,7 +71,7 @@ class IcelandicSurnameTradition extends DefaultSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_GIVN, $this->extractName($father), $match) === 1) { switch ($sex) { diff --git a/app/SurnameTradition/LithuanianSurnameTradition.php b/app/SurnameTradition/LithuanianSurnameTradition.php index e300e6d0a0..c10184e587 100644 --- a/app/SurnameTradition/LithuanianSurnameTradition.php +++ b/app/SurnameTradition/LithuanianSurnameTradition.php @@ -87,7 +87,7 @@ class LithuanianSurnameTradition extends PaternalSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SURN, $this->extractName($father), $match) === 1) { if ($sex === 'F') { diff --git a/app/SurnameTradition/MatrilinealSurnameTradition.php b/app/SurnameTradition/MatrilinealSurnameTradition.php index 69c077c48c..37cb179d7c 100644 --- a/app/SurnameTradition/MatrilinealSurnameTradition.php +++ b/app/SurnameTradition/MatrilinealSurnameTradition.php @@ -59,7 +59,7 @@ class MatrilinealSurnameTradition extends DefaultSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SPFX_SURN, $this->extractName($mother), $match) === 1) { $name = $match['NAME']; diff --git a/app/SurnameTradition/PatrilinealSurnameTradition.php b/app/SurnameTradition/PatrilinealSurnameTradition.php index 4abe682cf4..6ebc014e0e 100644 --- a/app/SurnameTradition/PatrilinealSurnameTradition.php +++ b/app/SurnameTradition/PatrilinealSurnameTradition.php @@ -59,7 +59,7 @@ class PatrilinealSurnameTradition extends DefaultSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SPFX_SURN, $this->extractName($father), $match) === 1) { $name = $match['NAME']; diff --git a/app/SurnameTradition/PolishSurnameTradition.php b/app/SurnameTradition/PolishSurnameTradition.php index 73724975e9..1214b1ba15 100644 --- a/app/SurnameTradition/PolishSurnameTradition.php +++ b/app/SurnameTradition/PolishSurnameTradition.php @@ -77,7 +77,7 @@ class PolishSurnameTradition extends PaternalSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SURN, $this->extractName($father), $match) === 1) { if ($sex === 'F') { diff --git a/app/SurnameTradition/PortugueseSurnameTradition.php b/app/SurnameTradition/PortugueseSurnameTradition.php index 7ed078ffb9..24215b19ac 100644 --- a/app/SurnameTradition/PortugueseSurnameTradition.php +++ b/app/SurnameTradition/PortugueseSurnameTradition.php @@ -72,7 +72,7 @@ class PortugueseSurnameTradition extends DefaultSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SURNS, $this->extractName($father), $match_father) === 1) { $father_surname = $match_father['SURN2']; diff --git a/app/SurnameTradition/SpanishSurnameTradition.php b/app/SurnameTradition/SpanishSurnameTradition.php index faebe7a06f..fe407fbb3f 100644 --- a/app/SurnameTradition/SpanishSurnameTradition.php +++ b/app/SurnameTradition/SpanishSurnameTradition.php @@ -72,7 +72,7 @@ class SpanishSurnameTradition extends DefaultSurnameTradition * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array { if (preg_match(self::REGEX_SURNS, $this->extractName($father), $match_father) === 1) { $father_surname = $match_father['SURN1']; diff --git a/app/SurnameTradition/SurnameTraditionInterface.php b/app/SurnameTradition/SurnameTraditionInterface.php index f121779900..88178be028 100644 --- a/app/SurnameTradition/SurnameTraditionInterface.php +++ b/app/SurnameTradition/SurnameTraditionInterface.php @@ -57,7 +57,7 @@ interface SurnameTraditionInterface * * @return array<int,string> */ - public function newChildNames(?Individual $father, ?Individual $mother, string $sex): array; + public function newChildNames(Individual|null $father, Individual|null $mother, string $sex): array; /** * What name is given to a new parent diff --git a/app/Validator.php b/app/Validator.php index 382e0ca00e..ae8c16a338 100644 --- a/app/Validator.php +++ b/app/Validator.php @@ -125,7 +125,7 @@ class Validator */ public function isBetween(int $minimum, int $maximum): self { - $this->rules[] = static function (?int $value) use ($minimum, $maximum): ?int { + $this->rules[] = static function (int|null $value) use ($minimum, $maximum): int|null { if (is_int($value) && $value >= $minimum && $value <= $maximum) { return $value; } @@ -163,7 +163,7 @@ class Validator */ public function isNotEmpty(): self { - $this->rules[] = static fn (?string $value): ?string => $value !== null && $value !== '' ? $value : null; + $this->rules[] = static fn (string|null $value): string|null => $value !== null && $value !== '' ? $value : null; return $this; } @@ -175,7 +175,7 @@ class Validator { $base_url = $this->request->getAttribute('base_url', ''); - $this->rules[] = static function (?string $value) use ($base_url): ?string { + $this->rules[] = static function (string|null $value) use ($base_url): string|null { if ($value !== null) { $value_info = parse_url($value); $base_url_info = parse_url($base_url); @@ -204,7 +204,7 @@ class Validator */ public function isTag(): self { - $this->rules[] = static function (?string $value): ?string { + $this->rules[] = static function (string|null $value): string|null { if ($value !== null && preg_match('/^' . Gedcom::REGEX_TAG . '$/', $value) === 1) { return $value; } @@ -279,7 +279,7 @@ class Validator throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); } - $callback = static fn (?array $value, Closure $rule): ?array => $rule($value); + $callback = static fn (array|null $value, Closure $rule): array|null => $rule($value); return array_reduce($this->rules, $callback, $value) ?? []; } @@ -300,7 +300,7 @@ class Validator $value = null; } - $callback = static fn (?float $value, Closure $rule): ?float => $rule($value); + $callback = static fn (?float $value, Closure $rule): float|null => $rule($value); $value = array_reduce($this->rules, $callback, $value) ?? $default; @@ -333,7 +333,7 @@ class Validator $value = null; } - $callback = static fn (?int $value, Closure $rule): ?int => $rule($value); + $callback = static fn (int|null $value, Closure $rule): int|null => $rule($value); $value = array_reduce($this->rules, $callback, $value) ?? $default; @@ -374,7 +374,7 @@ class Validator $value = null; } - $callback = static fn (?string $value, Closure $rule): ?string => $rule($value); + $callback = static fn (string|null $value, Closure $rule): string|null => $rule($value); $value = array_reduce($this->rules, $callback, $value) ?? $default; @@ -401,12 +401,7 @@ class Validator throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); } - /** - * @param string $parameter - * - * @return Tree|null - */ - public function treeOptional(string $parameter = 'tree'): ?Tree + public function treeOptional(string $parameter = 'tree'): Tree|null { $value = $this->parameters[$parameter] ?? null; @@ -417,11 +412,6 @@ class Validator throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); } - /** - * @param string $parameter - * - * @return UserInterface - */ public function user(string $parameter = 'user'): UserInterface { $value = $this->parameters[$parameter] ?? null; diff --git a/resources/views/chart-box.phtml b/resources/views/chart-box.phtml index b6ad94684a..a8bbaabd7c 100644 --- a/resources/views/chart-box.phtml +++ b/resources/views/chart-box.phtml @@ -27,7 +27,7 @@ if ($individual === null) { $module_service = Registry::container()->get(ModuleService::class); -$menus = $module_service->findByComponent(ModuleChartInterface::class, $individual->tree(), Auth::user())->map(static function (ModuleChartInterface $module) use ($individual): ?Menu { +$menus = $module_service->findByComponent(ModuleChartInterface::class, $individual->tree(), Auth::user())->map(static function (ModuleChartInterface $module) use ($individual): Menu|null { return $module->chartBoxMenu($individual); })->filter(); diff --git a/resources/views/record-page-links.phtml b/resources/views/record-page-links.phtml index 4662833b66..f4b269b7a0 100644 --- a/resources/views/record-page-links.phtml +++ b/resources/views/record-page-links.phtml @@ -15,16 +15,16 @@ use Fisharebest\Webtrees\Tree; use Illuminate\Support\Collection; /** - * @var string $details - * @var ?Collection<int,Family> $linked_families - * @var ?Collection<int,Individual> $linked_individuals - * @var ?Collection<int,Location> $linked_locations - * @var ?Collection<int,Media> $linked_media_objects - * @var ?Collection<int,Note> $linked_notes - * @var ?Collection<int,Repository> $linked_repositories - * @var ?Collection<int,Source> $linked_sources - * @var ?Collection<int,Submitter> $linked_submitters - * @var Tree $tree + * @var string $details + * @var Collection<int,Family>|null $linked_families + * @var Collection<int,Individual>|null $linked_individuals + * @var Collection<int,Location>|null $linked_locations + * @var Collection<int,Media>|null $linked_media_objects + * @var Collection<int,Note>|null $linked_notes + * @var Collection<int,Repository>|null $linked_repositories + * @var Collection<int,Source>|null $linked_sources + * @var Collection<int,Submitter>|null $linked_submitters + * @var Tree $tree */ ?> |
