diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-02-04 14:28:18 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-02-04 15:59:00 +0000 |
| commit | 24f2a3af38709f9bf0a739b30264240d20ba34e8 (patch) | |
| tree | 3e1418b4d3a327a1cf10708b29079eea6664d120 /app | |
| parent | 5ee0e1c4682ba45eab113157c38012830963e411 (diff) | |
| download | webtrees-24f2a3af38709f9bf0a739b30264240d20ba34e8.tar.gz webtrees-24f2a3af38709f9bf0a739b30264240d20ba34e8.tar.bz2 webtrees-24f2a3af38709f9bf0a739b30264240d20ba34e8.zip | |
Code style
Diffstat (limited to 'app')
121 files changed, 304 insertions, 276 deletions
diff --git a/app/Census/AbstractCensusColumn.php b/app/Census/AbstractCensusColumn.php index 2eac37ce85..73d0a59871 100644 --- a/app/Census/AbstractCensusColumn.php +++ b/app/Census/AbstractCensusColumn.php @@ -125,7 +125,7 @@ class AbstractCensusColumn * * @param Individual $individual * - * @return string[] + * @return array<string> */ protected function nameAtCensusDate(Individual $individual): array { diff --git a/app/CommonMark/XrefParser.php b/app/CommonMark/XrefParser.php index ce175ba9bd..1d0afad4ab 100644 --- a/app/CommonMark/XrefParser.php +++ b/app/CommonMark/XrefParser.php @@ -50,7 +50,7 @@ class XrefParser implements InlineParserInterface /** * We are only interested in text that begins with '@'. * - * @return string[] + * @return array<string> */ public function getCharacters(): array { diff --git a/app/Date.php b/app/Date.php index 808a31bb76..2a88c67554 100644 --- a/app/Date.php +++ b/app/Date.php @@ -106,10 +106,10 @@ class Date * * @param string $date * - * @throws DomainException * @return AbstractCalendarDate + * @throws DomainException */ - private function parseDate($date): AbstractCalendarDate + private function parseDate(string $date): AbstractCalendarDate { // Valid calendar escape specified? - use it if (preg_match('/^(@#D(?:GREGORIAN|JULIAN|HEBREW|HIJRI|JALALI|FRENCH R|ROMAN)+@) ?(.*)/', $date, $match)) { @@ -223,7 +223,7 @@ class Date /** * A list of supported calendars and their names. * - * @return string[] + * @return array<string> */ public static function calendarNames(): array { diff --git a/app/DebugBar.php b/app/DebugBar.php index c235ea0423..0cc6e73209 100644 --- a/app/DebugBar.php +++ b/app/DebugBar.php @@ -136,7 +136,7 @@ class DebugBar * * @return void */ - public static function addMessage($message, $label = 'info', $isString = true): void + public static function addMessage(string $message, $label = 'info', $isString = true): void { if (self::$debugbar instanceof StandardDebugBar) { $collector = self::$debugbar->getCollector('messages'); @@ -150,11 +150,11 @@ class DebugBar /** * Start a timer. * - * @param string $name + * @param string $name * * @return void */ - public static function startMeasure($name): void + public static function startMeasure(string $name): void { if (self::$debugbar instanceof StandardDebugBar) { $collector = self::$debugbar->getCollector('time'); @@ -172,7 +172,7 @@ class DebugBar * * @return void */ - public static function stopMeasure($name): void + public static function stopMeasure(string $name): void { if (self::$debugbar instanceof StandardDebugBar) { $collector = self::$debugbar->getCollector('time'); diff --git a/app/Fact.php b/app/Fact.php index 6b5eb15b06..86925160f9 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -179,7 +179,7 @@ class Fact * * @throws InvalidArgumentException */ - public function __construct($gedcom, GedcomRecord $parent, $id) + public function __construct(string $gedcom, GedcomRecord $parent, string $id) { if (preg_match('/^1 (' . Gedcom::REGEX_TAG . ')/', $gedcom, $match)) { $this->gedcom = $gedcom; @@ -261,7 +261,7 @@ class Fact * * @return string */ - public function attribute($tag): string + public function attribute(string $tag): string { if (preg_match('/\n2 (?:' . $tag . ') ?(.*(?:(?:\n3 CONT ?.*)*)*)/', $this->gedcom, $match)) { return preg_replace("/\n3 CONT ?/", "\n", $match[1]); @@ -439,7 +439,7 @@ class Fact * * @deprecated since 2.0.5. Will be removed in 2.1.0 */ - public function setTag($tag): void + public function setTag(string $tag): void { $this->tag = $tag; } @@ -527,7 +527,7 @@ class Fact /** * Source citations linked to this fact * - * @return string[] + * @return array<string> */ public function getCitations(): array { diff --git a/app/Factories/AbstractGedcomRecordFactory.php b/app/Factories/AbstractGedcomRecordFactory.php index 580b878b99..43b2acdc2c 100644 --- a/app/Factories/AbstractGedcomRecordFactory.php +++ b/app/Factories/AbstractGedcomRecordFactory.php @@ -68,9 +68,9 @@ abstract class AbstractGedcomRecordFactory * @param string $gedcom * @param string $xref * - * @return mixed|string + * @return string */ - protected function extractXref(string $gedcom, string $xref) + protected function extractXref(string $gedcom, string $xref): string { if (preg_match('/^0 @(' . Gedcom::REGEX_XREF . ')@/', $gedcom, $match)) { return $match[1]; diff --git a/app/Family.php b/app/Family.php index 29113270d4..aa2a50f666 100644 --- a/app/Family.php +++ b/app/Family.php @@ -375,7 +375,7 @@ class Family extends GedcomRecord /** * Derived classes should redefine this function, otherwise the object will have no name * - * @return string[][] + * @return array<array<string>> */ public function getAllNames(): array { diff --git a/app/FlashMessages.php b/app/FlashMessages.php index f6240b4aab..6f038a03b8 100644 --- a/app/FlashMessages.php +++ b/app/FlashMessages.php @@ -37,7 +37,7 @@ class FlashMessages * * @return void */ - public static function addMessage($text, $status = 'info'): void + public static function addMessage(string $text, $status = 'info'): void { $message = new stdClass(); $message->text = $text; diff --git a/app/Functions/Functions.php b/app/Functions/Functions.php index f5e7ee2a02..746f247ccb 100644 --- a/app/Functions/Functions.php +++ b/app/Functions/Functions.php @@ -38,7 +38,7 @@ class Functions * * @return string */ - public static function fileUploadErrorText($error_code): string + public static function fileUploadErrorText(int $error_code): string { switch ($error_code) { case UPLOAD_ERR_OK: @@ -89,7 +89,7 @@ class Functions * * @return string the subrecord that was found or an empty string "" if not found. */ - public static function getSubRecord($level, $tag, string $gedrec, int $num = 1): string + public static function getSubRecord(int $level, string $tag, string $gedrec, int $num = 1): string { if ($gedrec === '') { return ''; @@ -131,7 +131,7 @@ class Functions * * @return string a string with all CONT lines merged */ - public static function getCont($nlevel, $nrec): string + public static function getCont(int $nlevel, string $nrec): string { $text = ''; @@ -370,7 +370,7 @@ class Functions * * @return string */ - public static function cousinName($n, $sex): string + public static function cousinName(int $n, string $sex): string { if ($sex === 'M') { switch ($n) { @@ -592,7 +592,7 @@ class Functions * * @return string */ - public static function getRelationshipNameFromPath($path, Individual $person1 = null, Individual $person2 = null): string + public static function getRelationshipNameFromPath(string $path, Individual $person1 = null, Individual $person2 = null): string { if (!preg_match('/^(mot|fat|par|hus|wif|spo|son|dau|chi|bro|sis|sib)*$/', $path)) { return '<span class="error">' . $path . '</span>'; diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index ffbefa7ed5..421c1f3008 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -95,7 +95,7 @@ class FunctionsEdit * * @return string */ - public static function editLanguageCheckboxes($parameter_name, $languages): string + public static function editLanguageCheckboxes(string $parameter_name, array $languages): string { return view('edit/language-checkboxes', ['languages' => $languages]); } @@ -103,7 +103,7 @@ class FunctionsEdit /** * A list of access levels (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsAccessLevels(): array { @@ -113,7 +113,7 @@ class FunctionsEdit /** * A list of active languages (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsActiveLanguages(): array { @@ -128,7 +128,7 @@ class FunctionsEdit /** * A list of calendar conversions (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsCalendarConversions(): array { @@ -138,7 +138,7 @@ class FunctionsEdit /** * A list of contact methods (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsContactMethods(): array { @@ -148,7 +148,7 @@ class FunctionsEdit /** * A list of hide/show options (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsHideShow(): array { @@ -161,11 +161,11 @@ class FunctionsEdit /** * A list of integers (e.g. for an edit control). * - * @param int[] $integers + * @param array<int> $integers * - * @return string[] + * @return array<int,string> */ - public static function numericOptions($integers): array + public static function numericOptions(array $integers): array { $array = []; foreach ($integers as $integer) { @@ -182,7 +182,7 @@ class FunctionsEdit /** * A list of no/yes options (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsNoYes(): array { @@ -197,9 +197,9 @@ class FunctionsEdit * * @param string $relationship * - * @return string[] + * @return array<string> */ - public static function optionsRelationships($relationship): array + public static function optionsRelationships(string $relationship): array { $relationships = GedcomCodeRela::getValues(); // The user is allowed to specify values that aren't in the list. @@ -215,9 +215,9 @@ class FunctionsEdit * * @param bool $include_empty * - * @return string[] + * @return array<string> */ - public static function optionsRestrictions($include_empty): array + public static function optionsRestrictions(bool $include_empty): array { $options = [ 'none' => I18N::translate('Show to visitors'), @@ -236,7 +236,7 @@ class FunctionsEdit /** * A list of GEDCOM restrictions for privacy rules. * - * @return string[] + * @return array<string> */ public static function optionsRestrictionsRule(): array { @@ -246,7 +246,7 @@ class FunctionsEdit /** * A list of temple options (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsTemples(): array { @@ -256,7 +256,7 @@ class FunctionsEdit /** * A list of user options (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public static function optionsUsers(): array { @@ -286,7 +286,7 @@ class FunctionsEdit * * @return string */ - public static function addSimpleTag(Tree $tree, $tag, $upperlevel = '', $label = ''): string + public static function addSimpleTag(Tree $tree, string $tag, string $upperlevel = '', string $label = ''): string { $localization_service = app(LocalizationService::class); @@ -619,7 +619,7 @@ class FunctionsEdit * * @return void */ - public static function addSimpleTags(Tree $tree, $fact): void + public static function addSimpleTags(Tree $tree, string $fact): void { // For new individuals, these facts default to "Y" if ($fact === 'MARR') { @@ -654,7 +654,7 @@ class FunctionsEdit * * @return void */ - public static function createAddForm(Tree $tree, $fact): void + public static function createAddForm(Tree $tree, string $fact): void { self::$tags = []; @@ -847,7 +847,7 @@ class FunctionsEdit * * @return void */ - public static function insertMissingSubtags(Tree $tree, $level1tag, $add_date = false): void + public static function insertMissingSubtags(Tree $tree, string $level1tag, bool $add_date = false): void { // handle MARRiage TYPE $type_val = ''; diff --git a/app/Functions/FunctionsExport.php b/app/Functions/FunctionsExport.php index 5747a2ab9f..3902bd77c1 100644 --- a/app/Functions/FunctionsExport.php +++ b/app/Functions/FunctionsExport.php @@ -64,7 +64,7 @@ class FunctionsExport * * @return string */ - public static function reformatRecord($rec): string + public static function reformatRecord(string $rec): string { $newrec = ''; foreach (preg_split('/[\r\n]+/', $rec, -1, PREG_SPLIT_NO_EMPTY) as $line) { @@ -178,7 +178,7 @@ class FunctionsExport * * @return string */ - private static function convertMediaPath($rec, $path): string + private static function convertMediaPath(string $rec, string $path): string { if ($path && preg_match('/\n1 FILE (.+)/', $rec, $match)) { $old_file_name = $match[1]; diff --git a/app/Functions/FunctionsPrint.php b/app/Functions/FunctionsPrint.php index 84a2b0e915..7963faa44f 100644 --- a/app/Functions/FunctionsPrint.php +++ b/app/Functions/FunctionsPrint.php @@ -87,7 +87,7 @@ class FunctionsPrint * * @return string */ - private static function printNoteRecord(Tree $tree, $text, $nlevel, $nrec): string + private static function printNoteRecord(Tree $tree, string $text, int $nlevel, string $nrec): string { $text .= Functions::getCont($nlevel, $nrec); @@ -147,7 +147,7 @@ class FunctionsPrint * * @return string HTML */ - public static function printFactNotes(Tree $tree, $factrec, $level): string + public static function printFactNotes(Tree $tree, string $factrec, int $level): string { $data = ''; $previous_spos = 0; @@ -516,7 +516,7 @@ class FunctionsPrint * * @return void */ - public static function printAddNewFact(GedcomRecord $record, Collection $usedfacts, $type): void + public static function printAddNewFact(GedcomRecord $record, Collection $usedfacts, string $type): void { $tree = $record->tree(); diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php index 030f4efbe3..cc5a66e6d3 100644 --- a/app/Functions/FunctionsPrintFacts.php +++ b/app/Functions/FunctionsPrintFacts.php @@ -588,7 +588,7 @@ class FunctionsPrintFacts * * @return string HTML text */ - public static function printFactSources(Tree $tree, $factrec, $level): string + public static function printFactSources(Tree $tree, string $factrec, int $level): string { $data = ''; $nlevel = $level + 1; @@ -658,7 +658,7 @@ class FunctionsPrintFacts * * @return void */ - public static function printMediaLinks(Tree $tree, $factrec, $level): void + public static function printMediaLinks(Tree $tree, string $factrec, int $level): void { $nlevel = $level + 1; if (preg_match_all("/$level OBJE @(.*)@/", $factrec, $omatch, PREG_SET_ORDER) === 0) { @@ -880,7 +880,7 @@ class FunctionsPrintFacts * * @param string $srec * - * @return string[]|string[][] + * @return array<array<string>> */ public static function getSourceStructure(string $srec): array { diff --git a/app/Functions/FunctionsRtl.php b/app/Functions/FunctionsRtl.php index 28df40e703..374fa8ee14 100644 --- a/app/Functions/FunctionsRtl.php +++ b/app/Functions/FunctionsRtl.php @@ -77,7 +77,7 @@ class FunctionsRtl * * @return string The input string, with ‎ and ‏ stripped */ - public static function stripLrmRlm($inputText): string + public static function stripLrmRlm(string $inputText): string { return str_replace([ self::UTF8_LRM, @@ -514,7 +514,7 @@ class FunctionsRtl * * @return string */ - public static function starredName($textSpan, $direction): string + public static function starredName(string $textSpan, string $direction): string { // To avoid a TCPDF bug that mixes up the word order, insert those <u> and </u> tags // only when page and span directions are identical. @@ -597,7 +597,7 @@ class FunctionsRtl * * @return void */ - public static function breakCurrentSpan(&$result): void + public static function breakCurrentSpan(string &$result): void { // Interrupt the current span, insert that <br>, and then continue the current span $result .= self::$waitingText; @@ -614,7 +614,7 @@ class FunctionsRtl * * @return void */ - public static function beginCurrentSpan(&$result): void + public static function beginCurrentSpan(string &$result): void { if (self::$currentState === 'LTR') { $result .= self::START_LTR; @@ -634,7 +634,7 @@ class FunctionsRtl * * @return void */ - public static function finishCurrentSpan(&$result, $theEnd = false): void + public static function finishCurrentSpan(string &$result, bool $theEnd = false): void { $textSpan = substr($result, self::$posSpanStart); $result = substr($result, 0, self::$posSpanStart); diff --git a/app/GedcomCode/GedcomCodeAdop.php b/app/GedcomCode/GedcomCodeAdop.php index 9d0ff665cf..c04f1c9cff 100644 --- a/app/GedcomCode/GedcomCodeAdop.php +++ b/app/GedcomCode/GedcomCodeAdop.php @@ -41,7 +41,7 @@ class GedcomCodeAdop /** * A list of all possible values for PEDI * - * @return string[] + * @return array<string> */ public static function getValues(): array { diff --git a/app/GedcomCode/GedcomCodeLang.php b/app/GedcomCode/GedcomCodeLang.php index 23d9ae1a88..16d0eabbda 100644 --- a/app/GedcomCode/GedcomCodeLang.php +++ b/app/GedcomCode/GedcomCodeLang.php @@ -141,7 +141,7 @@ class GedcomCodeLang /** * A list of all possible values for LANG fields. * - * @return string[] + * @return array<string> */ public static function getValues(): array { diff --git a/app/GedcomCode/GedcomCodeName.php b/app/GedcomCode/GedcomCodeName.php index b5a85da4ee..acc29461b6 100644 --- a/app/GedcomCode/GedcomCodeName.php +++ b/app/GedcomCode/GedcomCodeName.php @@ -185,7 +185,7 @@ class GedcomCodeName * * @param GedcomRecord|null $record * - * @return string[] + * @return array<string> */ public static function getValues(GedcomRecord $record = null): array { diff --git a/app/GedcomCode/GedcomCodePedi.php b/app/GedcomCode/GedcomCodePedi.php index 8115a47f80..817e2d1206 100644 --- a/app/GedcomCode/GedcomCodePedi.php +++ b/app/GedcomCode/GedcomCodePedi.php @@ -40,12 +40,12 @@ class GedcomCodePedi /** * Translate a code, for an optional record * - * @param string $type + * @param string $type * @param GedcomRecord|null $record * * @return string */ - public static function getValue($type, GedcomRecord $record = null): string + public static function getValue(string $type, GedcomRecord $record = null): string { if ($record instanceof Individual) { $sex = $record->sex(); @@ -117,7 +117,7 @@ class GedcomCodePedi * * @param GedcomRecord|null $record * - * @return string[] + * @return array<string> */ public static function getValues(GedcomRecord $record = null): array { diff --git a/app/GedcomCode/GedcomCodeQuay.php b/app/GedcomCode/GedcomCodeQuay.php index dd8233d89a..2c4355c6fb 100644 --- a/app/GedcomCode/GedcomCodeQuay.php +++ b/app/GedcomCode/GedcomCodeQuay.php @@ -64,7 +64,7 @@ class GedcomCodeQuay /** * A list of all possible values for QUAY * - * @return string[] + * @return array<string> */ public static function getValues(): array { diff --git a/app/GedcomCode/GedcomCodeRela.php b/app/GedcomCode/GedcomCodeRela.php index f3f537907b..bdbfe3944c 100644 --- a/app/GedcomCode/GedcomCodeRela.php +++ b/app/GedcomCode/GedcomCodeRela.php @@ -359,7 +359,7 @@ class GedcomCodeRela * * @param GedcomRecord|null $record * - * @return string[] + * @return array<string> */ public static function getValues(GedcomRecord $record = null): array { diff --git a/app/GedcomCode/GedcomCodeStat.php b/app/GedcomCode/GedcomCodeStat.php index 25f9fd6bf4..2e126f437a 100644 --- a/app/GedcomCode/GedcomCodeStat.php +++ b/app/GedcomCode/GedcomCodeStat.php @@ -32,7 +32,7 @@ class GedcomCodeStat * * @param string $tag * - * @return string[] + * @return array<string> */ public static function statusCodes(string $tag): array { @@ -150,7 +150,7 @@ class GedcomCodeStat * * @param string $tag * - * @return string[] + * @return array<string> */ public static function statusNames(string $tag): array { diff --git a/app/GedcomCode/GedcomCodeTemp.php b/app/GedcomCode/GedcomCodeTemp.php index 0293ee19ee..c7dd62ed04 100644 --- a/app/GedcomCode/GedcomCodeTemp.php +++ b/app/GedcomCode/GedcomCodeTemp.php @@ -33,7 +33,7 @@ class GedcomCodeTemp * * @return bool */ - public static function isTagLDS($tag): bool + public static function isTagLDS(string $tag): bool { return $tag === 'BAPL' || $tag === 'CONL' || $tag === 'ENDL' || $tag === 'SLGC' || $tag === 'SLGS'; } @@ -47,7 +47,7 @@ class GedcomCodeTemp * @link http://en.wikipedia.org/wiki/List_of_temples_of_The_Church_of_Jesus_Christ_of_Latter-day_Saints * @link http://www.ldschurchtemples.com/codes/ * - * @return string[] + * @return array<string> */ public static function templeCodes(): array { @@ -693,7 +693,7 @@ class GedcomCodeTemp /** * A sorted list of all temple names * - * @return string[] + * @return array<string> */ public static function templeNames(): array { diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index 0051ac5c05..5bd27fa68d 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -395,7 +395,7 @@ class GedcomRecord /** * Derived classes should redefine this function, otherwise the object will have no name * - * @return string[][] + * @return array<array<string>> */ public function getAllNames(): array { @@ -498,7 +498,7 @@ class GedcomRecord * * @return string */ - public function __toString() + public function __toString(): string { return $this->xref . '@' . $this->tree->id(); } diff --git a/app/GedcomTag.php b/app/GedcomTag.php index 522c9650c2..d38545940e 100644 --- a/app/GedcomTag.php +++ b/app/GedcomTag.php @@ -404,7 +404,7 @@ class GedcomTag * * @return bool */ - public static function isTag($tag): bool + public static function isTag(string $tag): bool { return in_array($tag, self::ALL_TAGS, true); } @@ -416,7 +416,7 @@ class GedcomTag * * @return string */ - public static function getLabel($tag): string + public static function getLabel(string $tag): string { switch ($tag) { case 'ABBR': @@ -1275,7 +1275,7 @@ class GedcomTag * * @return string */ - public static function getLabelValue($tag, $value, GedcomRecord $record = null, $element = 'div'): string + public static function getLabelValue(string $tag, string $value, GedcomRecord $record = null, $element = 'div'): string { return '<' . $element . ' class="fact_' . $tag . '">' . @@ -1289,9 +1289,9 @@ class GedcomTag * * @param string $fact_type * - * @return string[] + * @return array<string> */ - public static function getPicklistFacts($fact_type): array + public static function getPicklistFacts(string $fact_type): array { switch ($fact_type) { case Individual::RECORD_TYPE: @@ -1514,7 +1514,7 @@ class GedcomTag /** * A list of all possible values for 1 FILE/2 FORM/3 TYPE * - * @return string[] + * @return array<string> */ public static function getFileFormTypes(): array { diff --git a/app/Helpers/functions.php b/app/Helpers/functions.php index 6cf4384fa2..b0349acb49 100644 --- a/app/Helpers/functions.php +++ b/app/Helpers/functions.php @@ -73,7 +73,7 @@ function asset(string $path): string * * @return string */ -function csrf_field() +function csrf_field(): string { return '<input type="hidden" name="_csrf" value="' . e(WebtreesSession::getCsrfToken()) . '">'; } @@ -83,7 +83,7 @@ function csrf_field() * * @return string */ -function csrf_token() +function csrf_token(): string { return WebtreesSession::getCsrfToken(); } @@ -198,7 +198,7 @@ function route(string $route_name, array $parameters = []): string * * @return string */ -function view(string $name, array $data = []) +function view(string $name, array $data = []): string { return WebtreesView::make($name, $data); } diff --git a/app/Html.php b/app/Html.php index 2e0b1b4287..90a2fff3d5 100644 --- a/app/Html.php +++ b/app/Html.php @@ -59,12 +59,12 @@ class Html /** * Encode a URL. * - * @param string $path - * @param mixed[] $data + * @param string $path + * @param array<mixed> $data * * @return string */ - public static function url($path, array $data): string + public static function url(string $path, array $data): string { $path = strtr($path, [' ' => '%20']); @@ -82,7 +82,7 @@ class Html * * @return string */ - public static function filename($filename): string + public static function filename(string $filename): string { return '<samp class="filename" dir="ltr">' . e($filename) . '</samp>'; } diff --git a/app/Http/Middleware/ClientIp.php b/app/Http/Middleware/ClientIp.php index b59c909d89..a4f238afe8 100644 --- a/app/Http/Middleware/ClientIp.php +++ b/app/Http/Middleware/ClientIp.php @@ -51,7 +51,7 @@ class ClientIp extends \Middlewares\ClientIp * @param ServerRequestInterface $request * @param string $attribute * - * @return string[] + * @return array<string> */ private function getCommaSeparatedAttribute(ServerRequestInterface $request, string $attribute): array { diff --git a/app/Http/RequestHandlers/CheckTree.php b/app/Http/RequestHandlers/CheckTree.php index dd45c90e2e..90ad683b6a 100644 --- a/app/Http/RequestHandlers/CheckTree.php +++ b/app/Http/RequestHandlers/CheckTree.php @@ -294,7 +294,7 @@ class CheckTree implements RequestHandlerInterface * * @return string */ - private function checkLinkMessage(Tree $tree, string $type1, string $xref1, string $type2, $xref2): string + private function checkLinkMessage(Tree $tree, string $type1, string $xref1, string $type2, string $xref2): string { /* I18N: The placeholders are GEDCOM XREFs and tags. e.g. “INDI I123 contains a FAMC link to F234.” */ return I18N::translate( diff --git a/app/Http/RequestHandlers/ControlPanel.php b/app/Http/RequestHandlers/ControlPanel.php index db34c7ad21..4aef586e7d 100644 --- a/app/Http/RequestHandlers/ControlPanel.php +++ b/app/Http/RequestHandlers/ControlPanel.php @@ -208,7 +208,7 @@ class ControlPanel implements RequestHandlerInterface /** * Count the number of pending changes in each tree. * - * @return string[] + * @return array<string> */ private function totalChanges(): array { diff --git a/app/Http/RequestHandlers/DeleteRecord.php b/app/Http/RequestHandlers/DeleteRecord.php index 4e20b453d3..b147d1db07 100644 --- a/app/Http/RequestHandlers/DeleteRecord.php +++ b/app/Http/RequestHandlers/DeleteRecord.php @@ -105,7 +105,7 @@ class DeleteRecord implements RequestHandlerInterface * * @return string */ - private function removeLinks($gedrec, $xref): string + private function removeLinks(string $gedrec, string $xref): string { $gedrec = preg_replace('/\n1 ' . Gedcom::REGEX_TAG . ' @' . $xref . '@(\n[2-9].*)*/', '', $gedrec); $gedrec = preg_replace('/\n2 ' . Gedcom::REGEX_TAG . ' @' . $xref . '@(\n[3-9].*)*/', '', $gedrec); diff --git a/app/Http/RequestHandlers/HelpText.php b/app/Http/RequestHandlers/HelpText.php index 23f1aa58e4..b51f0dfed7 100644 --- a/app/Http/RequestHandlers/HelpText.php +++ b/app/Http/RequestHandlers/HelpText.php @@ -304,7 +304,7 @@ class HelpText implements RequestHandlerInterface * * @param string[]|int[] $gedcom_dates * - * @return string[] + * @return array<string> */ private function formatDates(array $gedcom_dates): array { diff --git a/app/Http/RequestHandlers/SearchAdvancedPage.php b/app/Http/RequestHandlers/SearchAdvancedPage.php index 2a115f9d4e..7b41d4b940 100644 --- a/app/Http/RequestHandlers/SearchAdvancedPage.php +++ b/app/Http/RequestHandlers/SearchAdvancedPage.php @@ -235,7 +235,7 @@ class SearchAdvancedPage implements RequestHandlerInterface /** * For the advanced search * - * @return string[] + * @return array<string> */ private function dateOptions(): array { @@ -252,7 +252,7 @@ class SearchAdvancedPage implements RequestHandlerInterface /** * For the advanced search * - * @return string[] + * @return array<string> */ private function nameOptions(): array { diff --git a/app/Http/RequestHandlers/SearchGeneralPage.php b/app/Http/RequestHandlers/SearchGeneralPage.php index 299b16af8a..2993f448d3 100644 --- a/app/Http/RequestHandlers/SearchGeneralPage.php +++ b/app/Http/RequestHandlers/SearchGeneralPage.php @@ -190,7 +190,7 @@ class SearchGeneralPage implements RequestHandlerInterface * * @param string $query * - * @return string[] + * @return array<string> */ private function extractSearchTerms(string $query): array { diff --git a/app/Http/RequestHandlers/SetupWizard.php b/app/Http/RequestHandlers/SetupWizard.php index 0819939517..795ba0c674 100644 --- a/app/Http/RequestHandlers/SetupWizard.php +++ b/app/Http/RequestHandlers/SetupWizard.php @@ -380,7 +380,7 @@ class SetupWizard implements RequestHandlerInterface * * @return string */ - private function checkAdminUser($wtname, $wtuser, $wtpass, $wtemail): string + private function checkAdminUser(string $wtname, string $wtuser, string $wtpass, string $wtemail): string { if ($wtname === '' || $wtuser === '' || $wtpass === '' || $wtemail === '') { return I18N::translate('You must enter all the administrator account fields.'); diff --git a/app/Http/RequestHandlers/TreePrivacyPage.php b/app/Http/RequestHandlers/TreePrivacyPage.php index 97b6a6c45d..e55b735744 100644 --- a/app/Http/RequestHandlers/TreePrivacyPage.php +++ b/app/Http/RequestHandlers/TreePrivacyPage.php @@ -134,7 +134,7 @@ class TreePrivacyPage implements RequestHandlerInterface * * @param Tree $tree * - * @return string[] + * @return array<string> */ private function tagsForPrivacy(Tree $tree): array { diff --git a/app/Http/RequestHandlers/UpgradeWizardPage.php b/app/Http/RequestHandlers/UpgradeWizardPage.php index 179731ffc3..906a43b3d2 100644 --- a/app/Http/RequestHandlers/UpgradeWizardPage.php +++ b/app/Http/RequestHandlers/UpgradeWizardPage.php @@ -100,7 +100,7 @@ class UpgradeWizardPage implements RequestHandlerInterface /** - * @return string[] + * @return array<string> */ private function wizardSteps(): array { diff --git a/app/Individual.php b/app/Individual.php index c5bbd0f70c..b5fed84776 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -200,7 +200,7 @@ class Individual extends GedcomRecord * * @return bool */ - private static function isRelated(Individual $target, $distance): bool + private static function isRelated(Individual $target, int $distance): bool { static $cache = null; @@ -432,7 +432,7 @@ class Individual extends GedcomRecord * * @return string */ - public function displayImage($width, $height, $fit, $attributes): string + public function displayImage(int $width, int $height, string $fit, array $attributes): string { $media_file = $this->findHighlightedMediaFile(); diff --git a/app/Log.php b/app/Log.php index 480227f930..0a75b06a17 100644 --- a/app/Log.php +++ b/app/Log.php @@ -42,7 +42,7 @@ class Log * * @return void */ - public static function addAuthenticationLog($message): void + public static function addAuthenticationLog(string $message): void { self::addLog($message, self::TYPE_AUTHENTICATION); } @@ -56,7 +56,7 @@ class Log * * @return void */ - private static function addLog($message, $log_type, Tree $tree = null): void + private static function addLog(string $message, string $log_type, Tree $tree = null): void { if (app()->has(ServerRequestInterface::class)) { $request = app(ServerRequestInterface::class); @@ -83,7 +83,7 @@ class Log * * @return void */ - public static function addConfigurationLog($message, Tree $tree = null): void + public static function addConfigurationLog(string $message, Tree $tree = null): void { self::addLog($message, self::TYPE_CONFIGURATION, $tree); } @@ -96,7 +96,7 @@ class Log * * @return void */ - public static function addEditLog($message, Tree $tree): void + public static function addEditLog(string $message, Tree $tree): void { self::addLog($message, self::TYPE_EDIT, $tree); } @@ -108,7 +108,7 @@ class Log * * @return void */ - public static function addErrorLog($message): void + public static function addErrorLog(string $message): void { self::addLog($message, self::TYPE_ERROR); } @@ -120,7 +120,7 @@ class Log * * @return void */ - public static function addMediaLog($message): void + public static function addMediaLog(string $message): void { self::addLog($message, self::TYPE_MEDIA); } @@ -135,7 +135,7 @@ class Log * * @return void */ - public static function addSearchLog($message, array $trees): void + public static function addSearchLog(string $message, array $trees): void { foreach ($trees as $tree) { self::addLog($message, self::TYPE_SEARCH, $tree); diff --git a/app/Media.php b/app/Media.php index d7321ef2d2..f5c3f38577 100644 --- a/app/Media.php +++ b/app/Media.php @@ -183,14 +183,14 @@ class Media extends GedcomRecord /** * Display an image-thumbnail or a media-icon, and add markup for image viewers such as colorbox. * - * @param int $width Pixels - * @param int $height Pixels - * @param string $fit "crop" or "contain" - * @param string[] $attributes Additional HTML attributes + * @param int $width Pixels + * @param int $height Pixels + * @param string $fit "crop" or "contain" + * @param array<string,string> $attributes Additional HTML attributes * * @return string */ - public function displayImage($width, $height, $fit, $attributes = []): string + public function displayImage(int $width, int $height, string $fit, array $attributes = []): string { // Display the first image foreach ($this->mediaFiles() as $media_file) { diff --git a/app/MediaFile.php b/app/MediaFile.php index 0f08108fe1..283b22b698 100644 --- a/app/MediaFile.php +++ b/app/MediaFile.php @@ -78,7 +78,7 @@ class MediaFile * @param string $gedcom * @param Media $media */ - public function __construct($gedcom, Media $media) + public function __construct(string $gedcom, Media $media) { $this->media = $media; $this->fact_id = md5($gedcom); @@ -172,14 +172,14 @@ class MediaFile /** * Display an image-thumbnail or a media-icon, and add markup for image viewers such as colorbox. * - * @param int $width Pixels - * @param int $height Pixels - * @param string $fit "crop" or "contain" - * @param string[] $image_attributes Additional HTML attributes + * @param int $width Pixels + * @param int $height Pixels + * @param string $fit "crop" or "contain" + * @param array<string,string> $image_attributes Additional HTML attributes * * @return string */ - public function displayImage($width, $height, $fit, $image_attributes = []): string + public function displayImage(int $width, int $height, string $fit, array $image_attributes = []): string { if ($this->isExternal()) { $src = $this->multimedia_file_refn; @@ -236,7 +236,7 @@ class MediaFile * * @return string */ - public function imageUrl($width, $height, $fit): string + public function imageUrl(int $width, int $height, string $fit): string { // Sign the URL, to protect against mass-resize attacks. $glide_key = Site::getPreference('glide-key'); @@ -307,7 +307,7 @@ class MediaFile * * @param FilesystemInterface $data_filesystem * - * @return string[] + * @return array<string> */ public function attributes(FilesystemInterface $data_filesystem): array { diff --git a/app/Menu.php b/app/Menu.php index 94c3e905b6..f596a38863 100644 --- a/app/Menu.php +++ b/app/Menu.php @@ -52,8 +52,13 @@ class Menu * @param string[] $attrs Optional attributes, such as onclick or data-xxx * @param Menu[] $submenus Any submenus */ - public function __construct($label, $link = '#', $class = '', array $attrs = [], array $submenus = []) - { + public function __construct( + string $label, + string $link = '#', + string $class = '', + array $attrs = [], + array $submenus = [] + ) { $this ->setLabel($label) ->setLink($link) @@ -82,7 +87,7 @@ class Menu /** * Get the optional attributes. * - * @return string[] + * @return array<string> */ public function getAttrs(): array { @@ -120,7 +125,7 @@ class Menu * * @return $this */ - public function setClass($class): self + public function setClass(string $class): self { $this->class = $class; @@ -144,7 +149,7 @@ class Menu * * @return $this */ - public function setLabel($label): self + public function setLabel(string $label): self { $this->label = $label; @@ -168,7 +173,7 @@ class Menu * * @return $this */ - public function setLink($link): self + public function setLink(string $link): self { $this->link = $link; @@ -182,7 +187,7 @@ class Menu * * @return $this */ - public function addSubmenu($menu): self + public function addSubmenu(Menu $menu): self { $this->submenus[] = $menu; diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php index fa40fbc2e6..4d4d5a051f 100644 --- a/app/Module/AncestorsChartModule.php +++ b/app/Module/AncestorsChartModule.php @@ -268,7 +268,7 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac /** * This chart can display its output in a number of styles * - * @return string[] + * @return array<string> */ protected function styles(): array { diff --git a/app/Module/BingWebmasterToolsModule.php b/app/Module/BingWebmasterToolsModule.php index 80c29e3663..52e4cfeae1 100644 --- a/app/Module/BingWebmasterToolsModule.php +++ b/app/Module/BingWebmasterToolsModule.php @@ -84,7 +84,7 @@ class BingWebmasterToolsModule extends AbstractModule implements ModuleAnalytics /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/BranchesListModule.php b/app/Module/BranchesListModule.php index 478d4a25f4..f5e053a436 100644 --- a/app/Module/BranchesListModule.php +++ b/app/Module/BranchesListModule.php @@ -149,7 +149,7 @@ class BranchesListModule extends AbstractModule implements ModuleListInterface, } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { @@ -495,7 +495,7 @@ class BranchesListModule extends AbstractModule implements ModuleListInterface, * * @return string */ - private static function sosaGeneration($sosa): string + private static function sosaGeneration(int $sosa): string { $generation = (int) log($sosa, 2) + 1; diff --git a/app/Module/CensusAssistantModule.php b/app/Module/CensusAssistantModule.php index 5ed6079250..0a3ca87946 100644 --- a/app/Module/CensusAssistantModule.php +++ b/app/Module/CensusAssistantModule.php @@ -173,7 +173,7 @@ class CensusAssistantModule extends AbstractModule * * @return string */ - private function createNoteText(CensusInterface $census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes): string + private function createNoteText(CensusInterface $census, string $ca_title, string $ca_place, string $ca_citation, array $ca_individuals, string $ca_notes): string { $text = $ca_title . "\n" . $ca_citation . "\n" . $ca_place . "\n\n|"; diff --git a/app/Module/ClippingsCartModule.php b/app/Module/ClippingsCartModule.php index 1e9d2e98ac..250a12b24e 100644 --- a/app/Module/ClippingsCartModule.php +++ b/app/Module/ClippingsCartModule.php @@ -474,7 +474,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Family $family * - * @return string[] + * @return array<string> */ private function familyOptions(Family $family): array { @@ -612,7 +612,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Individual $individual * - * @return string[] + * @return array<string> */ private function individualOptions(Individual $individual): array { @@ -763,7 +763,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Media $media * - * @return string[] + * @return array<string> */ private function mediaOptions(Media $media): array { @@ -831,7 +831,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Note $note * - * @return string[] + * @return array<string> */ private function noteOptions(Note $note): array { @@ -899,7 +899,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Repository $repository * - * @return string[] + * @return array<string> */ private function repositoryOptions(Repository $repository): array { @@ -967,7 +967,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface /** * @param Source $source * - * @return string[] + * @return array<string> */ private function sourceOptions(Source $source): array { diff --git a/app/Module/CloudsTheme.php b/app/Module/CloudsTheme.php index ff94734999..6b8a9ca231 100644 --- a/app/Module/CloudsTheme.php +++ b/app/Module/CloudsTheme.php @@ -98,7 +98,7 @@ class CloudsTheme extends AbstractModule implements ModuleThemeInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Module/ColorsTheme.php b/app/Module/ColorsTheme.php index 85615bcbc0..22f40bc689 100644 --- a/app/Module/ColorsTheme.php +++ b/app/Module/ColorsTheme.php @@ -103,7 +103,7 @@ class ColorsTheme extends CloudsTheme /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { @@ -144,7 +144,7 @@ class ColorsTheme extends CloudsTheme } /** - * @return string[] + * @return array<string> */ private function palettes(): array { diff --git a/app/Module/DescendancyChartModule.php b/app/Module/DescendancyChartModule.php index aa18b6233d..76d6ea5b73 100644 --- a/app/Module/DescendancyChartModule.php +++ b/app/Module/DescendancyChartModule.php @@ -257,7 +257,7 @@ class DescendancyChartModule extends AbstractModule implements ModuleChartInterf /** * This chart can display its output in a number of styles * - * @return string[] + * @return array<string> */ protected function styles(): array { diff --git a/app/Module/DescendancyModule.php b/app/Module/DescendancyModule.php index ad9355bed3..47db4db94b 100644 --- a/app/Module/DescendancyModule.php +++ b/app/Module/DescendancyModule.php @@ -236,7 +236,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface * * @return string */ - public function loadSpouses(Individual $individual, $generations): string + public function loadSpouses(Individual $individual, int $generations): string { $out = ''; if ($individual->canShow()) { @@ -259,7 +259,7 @@ class DescendancyModule extends AbstractModule implements ModuleSidebarInterface * * @return string */ - public function loadChildren(Family $family, $generations): string + public function loadChildren(Family $family, int $generations): string { $out = ''; if ($family->canShow()) { diff --git a/app/Module/FabTheme.php b/app/Module/FabTheme.php index e916bf2e5d..68cfe4e0fa 100644 --- a/app/Module/FabTheme.php +++ b/app/Module/FabTheme.php @@ -70,7 +70,7 @@ class FabTheme extends AbstractModule implements ModuleThemeInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Module/FixMissingMarriedNames.php b/app/Module/FixMissingMarriedNames.php index 1e8a8606d8..fc564687d9 100644 --- a/app/Module/FixMissingMarriedNames.php +++ b/app/Module/FixMissingMarriedNames.php @@ -213,7 +213,7 @@ class FixMissingMarriedNames extends AbstractModule implements ModuleDataFixInte * * @param Individual $record * - * @return string[] + * @return array<string> */ private function surnamesToAdd(Individual $record): array { @@ -249,7 +249,7 @@ class FixMissingMarriedNames extends AbstractModule implements ModuleDataFixInte * * @param GedcomRecord $record * - * @return string[] + * @return array<string> */ private function surnames(GedcomRecord $record): array { diff --git a/app/Module/GoogleAnalyticsModule.php b/app/Module/GoogleAnalyticsModule.php index f1e2b9abd4..514b3b0ded 100644 --- a/app/Module/GoogleAnalyticsModule.php +++ b/app/Module/GoogleAnalyticsModule.php @@ -77,7 +77,7 @@ class GoogleAnalyticsModule extends AbstractModule implements ModuleAnalyticsInt /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/GoogleWebmasterToolsModule.php b/app/Module/GoogleWebmasterToolsModule.php index af819c5650..d1a44952e5 100644 --- a/app/Module/GoogleWebmasterToolsModule.php +++ b/app/Module/GoogleWebmasterToolsModule.php @@ -84,7 +84,7 @@ class GoogleWebmasterToolsModule extends AbstractModule implements ModuleAnalyti /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/IndividualFactsTabModule.php b/app/Module/IndividualFactsTabModule.php index 7c6d4b0049..d9067fa683 100644 --- a/app/Module/IndividualFactsTabModule.php +++ b/app/Module/IndividualFactsTabModule.php @@ -296,7 +296,7 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf * * @return Fact[] */ - private function childFacts(Individual $person, Family $family, $option, $relation, Date $min_date, Date $max_date): array + private function childFacts(Individual $person, Family $family, string $option, string $relation, Date $min_date, Date $max_date): array { $SHOW_RELATIVES_EVENTS = $person->tree()->getPreference('SHOW_RELATIVES_EVENTS'); diff --git a/app/Module/IndividualListModule.php b/app/Module/IndividualListModule.php index d2b54ad661..f6bb08a3ec 100644 --- a/app/Module/IndividualListModule.php +++ b/app/Module/IndividualListModule.php @@ -147,7 +147,7 @@ class IndividualListModule extends AbstractModule implements ModuleListInterface } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { @@ -835,7 +835,7 @@ class IndividualListModule extends AbstractModule implements ModuleListInterface * * @return Family[] */ - public function families(Tree $tree, $surn, $salpha, $galpha, $marnm, LocaleInterface $locale): array + public function families(Tree $tree, string $surn, string $salpha, string $galpha, bool $marnm, LocaleInterface $locale): array { $list = []; foreach ($this->individuals($tree, $surn, $salpha, $galpha, $marnm, true, $locale) as $indi) { diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php index 268ea0dab6..2d787f2dcc 100644 --- a/app/Module/InteractiveTree/TreeView.php +++ b/app/Module/InteractiveTree/TreeView.php @@ -52,7 +52,7 @@ class TreeView * @param Individual $individual Draw the chart for this individual * @param int $generations number of generations to draw * - * @return string[] HTML and Javascript + * @return array<string> HTML and Javascript */ public function drawViewport(Individual $individual, int $generations): array { diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php index b40cce2b7f..85550ef0fc 100644 --- a/app/Module/LifespansChartModule.php +++ b/app/Module/LifespansChartModule.php @@ -326,7 +326,7 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac * @param Date $end * @param Tree $tree * - * @return string[] + * @return array<string> */ protected function findIndividualsByDate(Date $start, Date $end, Tree $tree): array { @@ -348,7 +348,7 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac * @param Place $place * @param Tree $tree * - * @return string[] + * @return array<string> */ protected function findIndividualsByPlace(Place $place, Tree $tree): array { @@ -369,7 +369,7 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac * * @param Individual $individual * - * @return string[] + * @return array<string> */ protected function closeFamily(Individual $individual): array { diff --git a/app/Module/MatomoAnalyticsModule.php b/app/Module/MatomoAnalyticsModule.php index edaccc3a11..28bb5636ab 100644 --- a/app/Module/MatomoAnalyticsModule.php +++ b/app/Module/MatomoAnalyticsModule.php @@ -75,7 +75,7 @@ class MatomoAnalyticsModule extends AbstractModule implements ModuleAnalyticsInt /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/MediaListModule.php b/app/Module/MediaListModule.php index c297bec685..704404eca6 100644 --- a/app/Module/MediaListModule.php +++ b/app/Module/MediaListModule.php @@ -118,7 +118,7 @@ class MediaListModule extends AbstractModule implements ModuleListInterface, Req } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { @@ -227,7 +227,7 @@ class MediaListModule extends AbstractModule implements ModuleListInterface, Req * * @param Tree $tree * - * @return string[] + * @return array<string> */ private function allFolders(Tree $tree): array { diff --git a/app/Module/MinimalTheme.php b/app/Module/MinimalTheme.php index 9fdceee64a..ca3a7f2f08 100644 --- a/app/Module/MinimalTheme.php +++ b/app/Module/MinimalTheme.php @@ -70,7 +70,7 @@ class MinimalTheme extends AbstractModule implements ModuleThemeInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Module/ModuleAnalyticsInterface.php b/app/Module/ModuleAnalyticsInterface.php index 03a37df984..2a8134ca37 100644 --- a/app/Module/ModuleAnalyticsInterface.php +++ b/app/Module/ModuleAnalyticsInterface.php @@ -44,7 +44,7 @@ interface ModuleAnalyticsInterface extends ModuleInterface /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array; diff --git a/app/Module/ModuleAnalyticsTrait.php b/app/Module/ModuleAnalyticsTrait.php index 099368b06d..4062359b2b 100644 --- a/app/Module/ModuleAnalyticsTrait.php +++ b/app/Module/ModuleAnalyticsTrait.php @@ -62,7 +62,7 @@ trait ModuleAnalyticsTrait /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/ModuleChartInterface.php b/app/Module/ModuleChartInterface.php index a68555b4be..4fc09fc9a9 100644 --- a/app/Module/ModuleChartInterface.php +++ b/app/Module/ModuleChartInterface.php @@ -74,7 +74,7 @@ interface ModuleChartInterface extends ModuleInterface /** * Attributes for the URL. * - * @return string[] + * @return array<string> */ public function chartUrlAttributes(): array; } diff --git a/app/Module/ModuleChartTrait.php b/app/Module/ModuleChartTrait.php index 8c11ceb8a9..4646c5a621 100644 --- a/app/Module/ModuleChartTrait.php +++ b/app/Module/ModuleChartTrait.php @@ -99,7 +99,7 @@ trait ModuleChartTrait /** * Attributes for the URL. * - * @return string[] + * @return array<string> */ public function chartUrlAttributes(): array { diff --git a/app/Module/ModuleListInterface.php b/app/Module/ModuleListInterface.php index 84a74f9243..cf83607e12 100644 --- a/app/Module/ModuleListInterface.php +++ b/app/Module/ModuleListInterface.php @@ -64,7 +64,7 @@ interface ModuleListInterface extends ModuleInterface /** * Attributes for the URL. * - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array; diff --git a/app/Module/ModuleListTrait.php b/app/Module/ModuleListTrait.php index 2c74e6e47e..6ca0206fdf 100644 --- a/app/Module/ModuleListTrait.php +++ b/app/Module/ModuleListTrait.php @@ -88,7 +88,7 @@ trait ModuleListTrait /** * Attributes for the URL. * - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/ModuleThemeInterface.php b/app/Module/ModuleThemeInterface.php index 1c77288ffe..25dc31f058 100644 --- a/app/Module/ModuleThemeInterface.php +++ b/app/Module/ModuleThemeInterface.php @@ -74,7 +74,7 @@ interface ModuleThemeInterface extends ModuleInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array; } diff --git a/app/Module/ModuleThemeTrait.php b/app/Module/ModuleThemeTrait.php index 02b8985663..4023625f03 100644 --- a/app/Module/ModuleThemeTrait.php +++ b/app/Module/ModuleThemeTrait.php @@ -523,7 +523,7 @@ trait ModuleThemeTrait /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Module/NoteListModule.php b/app/Module/NoteListModule.php index 270adb73e2..3de45fb21c 100644 --- a/app/Module/NoteListModule.php +++ b/app/Module/NoteListModule.php @@ -105,7 +105,7 @@ class NoteListModule extends AbstractModule implements ModuleListInterface, Requ } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/PedigreeChartModule.php b/app/Module/PedigreeChartModule.php index c7e9fa4772..2e740e85d3 100644 --- a/app/Module/PedigreeChartModule.php +++ b/app/Module/PedigreeChartModule.php @@ -375,7 +375,7 @@ class PedigreeChartModule extends AbstractModule implements ModuleChartInterface /** * This chart can display its output in a number of styles * - * @return string[] + * @return array<string> */ protected function styles(): array { diff --git a/app/Module/PlaceHierarchyListModule.php b/app/Module/PlaceHierarchyListModule.php index 541e6bdf44..469957855c 100644 --- a/app/Module/PlaceHierarchyListModule.php +++ b/app/Module/PlaceHierarchyListModule.php @@ -133,7 +133,7 @@ class PlaceHierarchyListModule extends AbstractModule implements ModuleListInter } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php index 05eb1f9138..273656a86d 100644 --- a/app/Module/RelationshipsChartModule.php +++ b/app/Module/RelationshipsChartModule.php @@ -433,7 +433,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte /** * Possible options for the ancestors option * - * @return string[] + * @return array<string> */ private function ancestorsOptions(): array { @@ -446,7 +446,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte /** * Possible options for the recursion option * - * @return string[] + * @return array<string> */ private function recursionConfigOptions(): array { @@ -467,10 +467,14 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * @param int $recursion How many levels of recursion to use * @param bool $ancestor Restrict to relationships via a common ancestor * - * @return string[][] + * @return array<array<string>> */ - private function calculateRelationships(Individual $individual1, Individual $individual2, $recursion, $ancestor = false): array - { + private function calculateRelationships( + Individual $individual1, + Individual $individual2, + int $recursion, + bool $ancestor = false + ): array { $tree = $individual1->tree(); $rows = DB::table('link') @@ -571,9 +575,9 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * @param string $xref2 * @param int $tree_id * - * @return string[] + * @return array<string> */ - private function allAncestors($xref1, $xref2, $tree_id): array + private function allAncestors(string $xref1, string $xref2, int $tree_id): array { $ancestors = [ $xref1, @@ -616,9 +620,9 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * @param string $xref2 * @param int $tree_id * - * @return string[] + * @return array<string> */ - private function excludeFamilies($xref1, $xref2, $tree_id): array + private function excludeFamilies(string $xref1, string $xref2, int $tree_id): array { return DB::table('link AS l1') ->join('link AS l2', static function (JoinClause $join): void { @@ -642,7 +646,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * @param Tree $tree * @param string[] $path Alternately Individual / Family * - * @return string[] + * @return array<string> */ private function oldStyleRelationshipPath(Tree $tree, array $path): array { @@ -701,7 +705,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte * * @param int $max_recursion * - * @return string[] + * @return array<string> */ private function recursionOptions(int $max_recursion): array { diff --git a/app/Module/RepositoryListModule.php b/app/Module/RepositoryListModule.php index ea21f4745d..263c310cbe 100644 --- a/app/Module/RepositoryListModule.php +++ b/app/Module/RepositoryListModule.php @@ -108,7 +108,7 @@ class RepositoryListModule extends AbstractModule implements ModuleListInterface } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/SourceListModule.php b/app/Module/SourceListModule.php index caed1bd836..bc279dcc4c 100644 --- a/app/Module/SourceListModule.php +++ b/app/Module/SourceListModule.php @@ -107,7 +107,7 @@ class SourceListModule extends AbstractModule implements ModuleListInterface, Re } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/StatcounterModule.php b/app/Module/StatcounterModule.php index 19d80e3725..6a3b11836d 100644 --- a/app/Module/StatcounterModule.php +++ b/app/Module/StatcounterModule.php @@ -74,7 +74,7 @@ class StatcounterModule extends AbstractModule implements ModuleAnalyticsInterfa /** * The parameters that need to be embedded in the snippet. * - * @return string[] + * @return array<string> */ public function analyticsParameters(): array { diff --git a/app/Module/StatisticsChartModule.php b/app/Module/StatisticsChartModule.php index e5cb4b78c5..eef0c446f7 100644 --- a/app/Module/StatisticsChartModule.php +++ b/app/Module/StatisticsChartModule.php @@ -764,7 +764,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa } /** - * @return string[] + * @return array<string> */ private function axisAll(): array { @@ -774,7 +774,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa } /** - * @return string[] + * @return array<string> */ private function axisSexes(): array { @@ -787,7 +787,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa /** * Labels for the X axis * - * @return string[] + * @return array<string> */ private function axisMonths(): array { @@ -812,7 +812,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa * * @param string $boundaries_csv * - * @return string[] + * @return array<string> */ private function axisYears(string $boundaries_csv): array { @@ -912,7 +912,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa * * @return int|string */ - private function findAxisEntry($value, $axis) + private function findAxisEntry($value, array $axis) { if (is_numeric($value)) { $value = (int) $value; diff --git a/app/Module/SubmitterListModule.php b/app/Module/SubmitterListModule.php index fa642fbef9..8b421455b4 100644 --- a/app/Module/SubmitterListModule.php +++ b/app/Module/SubmitterListModule.php @@ -118,7 +118,7 @@ class SubmitterListModule extends AbstractModule implements ModuleListInterface, } /** - * @return string[] + * @return array<string> */ public function listUrlAttributes(): array { diff --git a/app/Module/WebtreesTheme.php b/app/Module/WebtreesTheme.php index 36ed0e654d..c801418e63 100644 --- a/app/Module/WebtreesTheme.php +++ b/app/Module/WebtreesTheme.php @@ -69,7 +69,7 @@ class WebtreesTheme extends AbstractModule implements ModuleThemeInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Module/XeneaTheme.php b/app/Module/XeneaTheme.php index 2892850c10..bad116c084 100644 --- a/app/Module/XeneaTheme.php +++ b/app/Module/XeneaTheme.php @@ -70,7 +70,7 @@ class XeneaTheme extends AbstractModule implements ModuleThemeInterface /** * A list of CSS files to include for this page. * - * @return string[] + * @return array<string> */ public function stylesheets(): array { diff --git a/app/Report/AbstractRenderer.php b/app/Report/AbstractRenderer.php index 565d546e4d..cf358e7657 100644 --- a/app/Report/AbstractRenderer.php +++ b/app/Report/AbstractRenderer.php @@ -157,7 +157,22 @@ abstract class AbstractRenderer * * @return ReportBaseCell */ - abstract public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell; + abstract public function createCell( + int $width, + int $height, + $border, + string $align, + string $bgcolor, + string $style, + int $ln, + $top, + $left, + int $fill, + int $stretch, + string $bocolor, + string $tcolor, + bool $reseth + ): ReportBaseCell; /** * Create a new TextBox object. @@ -261,7 +276,7 @@ abstract class AbstractRenderer * * @return ReportBaseFootnote */ - abstract public function createFootnote($style): ReportBaseFootnote; + abstract public function createFootnote(string $style): ReportBaseFootnote; /** * Initial Setup diff --git a/app/Report/HtmlRenderer.php b/app/Report/HtmlRenderer.php index 7bbae8617f..3d88dbef65 100644 --- a/app/Report/HtmlRenderer.php +++ b/app/Report/HtmlRenderer.php @@ -305,14 +305,14 @@ class HtmlRenderer extends AbstractRenderer * @param mixed $top Y-position * @param mixed $left X-position * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 1 - * @param int $stretch Stretch carachter mode + * @param int $stretch Stretch character mode * @param string $bocolor Border color * @param string $tcolor Text color * @param bool $reseth * * @return ReportBaseCell */ - public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell + public function createCell(int $width, int $height, $border, string $align, string $bgcolor, string $style, int $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell { return new ReportHtmlCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth); } @@ -372,7 +372,7 @@ class HtmlRenderer extends AbstractRenderer * * @return ReportBaseFootnote */ - public function createFootnote($style): ReportBaseFootnote + public function createFootnote(string $style): ReportBaseFootnote { return new ReportHtmlFootnote($style); } @@ -670,7 +670,7 @@ class HtmlRenderer extends AbstractRenderer * * @return void */ - public function setX($x): void + public function setX(float $x): void { $this->X = $x; } @@ -684,7 +684,7 @@ class HtmlRenderer extends AbstractRenderer * * @return void */ - public function setY($y): void + public function setY(float $y): void { $this->Y = $y; if ($this->maxY < $y) { @@ -702,7 +702,7 @@ class HtmlRenderer extends AbstractRenderer * * @return void */ - public function setXy($x, $y): void + public function setXy(float $x, float $y): void { $this->setX($x); $this->setY($y); @@ -747,7 +747,7 @@ class HtmlRenderer extends AbstractRenderer * * @return void */ - public function write($text, $color = '', $useclass = true): void + public function write(string $text, string $color = '', bool $useclass = true): void { $style = $this->getStyle($this->getCurrentStyle()); $htmlcode = '<span dir="' . I18N::direction() . '"'; diff --git a/app/Report/PdfRenderer.php b/app/Report/PdfRenderer.php index bc46b7e553..3bd8b8c7e6 100644 --- a/app/Report/PdfRenderer.php +++ b/app/Report/PdfRenderer.php @@ -540,7 +540,7 @@ class PdfRenderer extends AbstractRenderer * * @return ReportBaseCell */ - public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell + public function createCell(int $width, int $height, $border, string $align, string $bgcolor, string $style, int $ln, $top, $left, int $fill, int $stretch, string $bocolor, string $tcolor, bool $reseth): ReportBaseCell { return new ReportPdfCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth); } @@ -600,7 +600,7 @@ class PdfRenderer extends AbstractRenderer * * @return ReportBaseFootnote */ - public function createFootnote($style): ReportBaseFootnote + public function createFootnote(string $style): ReportBaseFootnote { return new ReportPdfFootnote($style); } diff --git a/app/Report/ReportBaseCell.php b/app/Report/ReportBaseCell.php index 1a765b8074..91f9a0a8f0 100644 --- a/app/Report/ReportBaseCell.php +++ b/app/Report/ReportBaseCell.php @@ -135,10 +135,10 @@ class ReportBaseCell extends ReportBaseElement * @param bool $reseth */ public function __construct( - $width, - $height, + int $width, + int $height, $border, - $align, + string $align, string $bgcolor, string $style, int $ln, diff --git a/app/Report/ReportBaseText.php b/app/Report/ReportBaseText.php index 2c790338e9..cd197d702e 100644 --- a/app/Report/ReportBaseText.php +++ b/app/Report/ReportBaseText.php @@ -57,7 +57,7 @@ class ReportBaseText extends ReportBaseElement * @param string $style The name of the text style * @param string $color HTML color code */ - public function __construct($style, $color) + public function __construct(string $style, string $color) { $this->text = ''; $this->color = $color; diff --git a/app/Report/ReportHtmlText.php b/app/Report/ReportHtmlText.php index 32030df732..ec9dc23706 100644 --- a/app/Report/ReportHtmlText.php +++ b/app/Report/ReportHtmlText.php @@ -37,7 +37,7 @@ class ReportHtmlText extends ReportBaseText * * @return void */ - public function render($renderer, $attrib = true) + public function render($renderer, bool $attrib = true) { // Set up the style if ($renderer->getCurrentStyle() !== $this->styleName) { diff --git a/app/Report/ReportParserBase.php b/app/Report/ReportParserBase.php index 3ae516e3e3..1c2786a240 100644 --- a/app/Report/ReportParserBase.php +++ b/app/Report/ReportParserBase.php @@ -146,7 +146,7 @@ class ReportParserBase * * @return void */ - protected function characterData($parser, $data): void + protected function characterData($parser, string $data): void { $this->text .= $data; } diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index b7e1147e6c..2cd5c55c36 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -276,7 +276,7 @@ class ReportParserGenerate extends ReportParserBase * * @return void */ - protected function characterData($parser, $data): void + protected function characterData($parser, string $data): void { if ($this->print_data && $this->process_gedcoms === 0 && $this->process_ifs === 0 && $this->process_repeats === 0) { $this->current_element->addText($data); @@ -603,8 +603,8 @@ class ReportParserGenerate extends ReportParserBase $this->print_data = true; $this->current_element = $this->report_root->createCell( - $width, - $height, + (int) $width, + (int) $height, $border, $align, $bgcolor, diff --git a/app/Services/AdminService.php b/app/Services/AdminService.php index 6eb2a0eae6..0e31189715 100644 --- a/app/Services/AdminService.php +++ b/app/Services/AdminService.php @@ -189,7 +189,7 @@ class AdminService * * @param Tree $tree * - * @return string[] + * @return array<string> */ public function duplicateXrefs(Tree $tree): array { diff --git a/app/Services/CalendarService.php b/app/Services/CalendarService.php index 2f97b9d37c..4975d68daf 100644 --- a/app/Services/CalendarService.php +++ b/app/Services/CalendarService.php @@ -59,7 +59,7 @@ class CalendarService * @param string $calendar * @param int $year * - * @return string[] + * @return array<string> */ public function calendarMonthsInYear(string $calendar, int $year): array { @@ -269,7 +269,7 @@ class CalendarService * * @return Fact[] */ - public function getAnniversaryEvents($jd, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array + public function getAnniversaryEvents(int $jd, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array { $found_facts = []; diff --git a/app/Services/EmailService.php b/app/Services/EmailService.php index bba246a7aa..4f49d6e388 100644 --- a/app/Services/EmailService.php +++ b/app/Services/EmailService.php @@ -226,7 +226,7 @@ class EmailService /** * A list SSL modes (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public function mailSslOptions(): array { @@ -242,7 +242,7 @@ class EmailService /** * A list SSL modes (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public function mailTransportOptions(): array { diff --git a/app/Services/GedcomEditService.php b/app/Services/GedcomEditService.php index 0d302ea9cb..0a468f1ba5 100644 --- a/app/Services/GedcomEditService.php +++ b/app/Services/GedcomEditService.php @@ -284,7 +284,7 @@ class GedcomEditService * * @return string */ - public function addNewFact(ServerRequestInterface $request, Tree $tree, $fact): string + public function addNewFact(ServerRequestInterface $request, Tree $tree, string $fact): string { $params = (array) $request->getParsedBody(); diff --git a/app/Services/GedcomService.php b/app/Services/GedcomService.php index 6f6e01033a..97bc00c8db 100644 --- a/app/Services/GedcomService.php +++ b/app/Services/GedcomService.php @@ -256,7 +256,7 @@ class GedcomService * * @param string $text * - * @return string[] + * @return array<string> */ public function readPlace(string $text): array { diff --git a/app/Services/MessageService.php b/app/Services/MessageService.php index 2cbe91c1e7..7ea8fef105 100644 --- a/app/Services/MessageService.php +++ b/app/Services/MessageService.php @@ -218,7 +218,7 @@ class MessageService /** * A list of contact methods (e.g. for an edit control). * - * @return string[] + * @return array<string> */ public function contactMethods(): array { diff --git a/app/Services/MigrationService.php b/app/Services/MigrationService.php index 46e5ecab5e..b61f35d00a 100644 --- a/app/Services/MigrationService.php +++ b/app/Services/MigrationService.php @@ -41,10 +41,10 @@ class MigrationService * @param string $schema_name Which schema to update. * @param int $target_version Upgrade to this version * - * @throws PDOException * @return bool Were any updates applied + * @throws PDOException */ - public function updateSchema($namespace, $schema_name, $target_version): bool + public function updateSchema(string $namespace, string $schema_name, int $target_version): bool { try { $current_version = (int) Site::getPreference($schema_name); diff --git a/app/Services/TimeoutService.php b/app/Services/TimeoutService.php index 45836b6527..d59cce78fa 100644 --- a/app/Services/TimeoutService.php +++ b/app/Services/TimeoutService.php @@ -40,7 +40,7 @@ class TimeoutService /** * TimeoutService constructor. * - * @param float $start_time + * @param float|null $start_time */ public function __construct(float $start_time = null) { diff --git a/app/Services/TreeService.php b/app/Services/TreeService.php index 0c6296fc58..7809dd1ebd 100644 --- a/app/Services/TreeService.php +++ b/app/Services/TreeService.php @@ -139,7 +139,7 @@ class TreeService /** * All trees, name => title * - * @return string[] + * @return array<string> */ public function titles(): array { diff --git a/app/Services/UserService.php b/app/Services/UserService.php index c9d1f90da5..70af99a2b1 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -50,7 +50,7 @@ class UserService * * @return User|null */ - public function find($user_id): ?User + public function find(?int $user_id): ?User { return Registry::cache()->array()->remember('user-' . $user_id, static function () use ($user_id): ?User { return DB::table('user') @@ -68,7 +68,7 @@ class UserService * * @return User|null */ - public function findByEmail($email): ?User + public function findByEmail(string $email): ?User { return DB::table('user') ->where('email', '=', $email) @@ -84,7 +84,7 @@ class UserService * * @return User|null */ - public function findByIdentifier($identifier): ?User + public function findByIdentifier(string $identifier): ?User { return DB::table('user') ->where('user_name', '=', $identifier) @@ -142,7 +142,7 @@ class UserService * * @return User|null */ - public function findByUserName($user_name): ?User + public function findByUserName(string $user_name): ?User { return DB::table('user') ->where('user_name', '=', $user_name) diff --git a/app/Site.php b/app/Site.php index 2260830858..ff1631215e 100644 --- a/app/Site.php +++ b/app/Site.php @@ -75,7 +75,7 @@ class Site * * @return void */ - public static function setPreference($setting_name, $setting_value): void + public static function setPreference(string $setting_name, string $setting_value): void { // The database column is only this long. $setting_value = mb_substr($setting_value, 0, 2000); diff --git a/app/Soundex.php b/app/Soundex.php index b61a25b96f..a676b931c5 100644 --- a/app/Soundex.php +++ b/app/Soundex.php @@ -3482,7 +3482,7 @@ class Soundex /** * Which algorithms are supported. * - * @return string[] + * @return array<string> */ public static function getAlgorithms(): array { @@ -3502,7 +3502,7 @@ class Soundex * * @return bool */ - public static function compare($soundex1, $soundex2): bool + public static function compare(string $soundex1, string $soundex2): bool { if ($soundex1 !== '' && $soundex2 !== '') { return array_intersect(explode(':', $soundex1), explode(':', $soundex2)) !== []; @@ -3574,9 +3574,9 @@ class Soundex * * @param string $name * - * @return string[] List of possible DM codes for the word. + * @return array<string> List of possible DM codes for the word. */ - private static function daitchMokotoffWord($name): array + private static function daitchMokotoffWord(string $name): array { // Apply special transformation rules to the input string $name = I18N::strtoupper($name); diff --git a/app/Statistics.php b/app/Statistics.php index 70028f2651..7715a5fb8b 100644 --- a/app/Statistics.php +++ b/app/Statistics.php @@ -2888,7 +2888,7 @@ class Statistics implements * * @param string $text * - * @return string[] + * @return array<string> */ private function getTags(string $text): array { diff --git a/app/Statistics/Google/ChartDistribution.php b/app/Statistics/Google/ChartDistribution.php index 2b2be65e2d..73e72d6dd3 100644 --- a/app/Statistics/Google/ChartDistribution.php +++ b/app/Statistics/Google/ChartDistribution.php @@ -88,7 +88,7 @@ class ChartDistribution /** * Returns the country names for each language. * - * @return string[] + * @return array<string> */ private function getIso3166Countries(): array { diff --git a/app/Statistics/Repository/FamilyRepository.php b/app/Statistics/Repository/FamilyRepository.php index ae129fdb38..01936d27fe 100644 --- a/app/Statistics/Repository/FamilyRepository.php +++ b/app/Statistics/Repository/FamilyRepository.php @@ -1377,13 +1377,13 @@ class FamilyRepository /** * General query on ages at marriage. * - * @param string $sex "M" or "F" + * @param string $sex "M" or "F" * @param int $year1 * @param int $year2 * * @return array<stdClass> */ - public function statsMarrAgeQuery($sex, $year1 = -1, $year2 = -1): array + public function statsMarrAgeQuery(string $sex, int $year1 = -1, int $year2 = -1): array { $prefix = DB::connection()->getTablePrefix(); diff --git a/app/Statistics/Repository/GedcomRepository.php b/app/Statistics/Repository/GedcomRepository.php index 1ef978f2df..e2aa3bceb6 100644 --- a/app/Statistics/Repository/GedcomRepository.php +++ b/app/Statistics/Repository/GedcomRepository.php @@ -52,7 +52,7 @@ class GedcomRepository implements GedcomRepositoryInterface /** * Get information from the GEDCOM's HEAD record. * - * @return string[] + * @return array<string> */ private function gedcomHead(): array { diff --git a/app/Statistics/Repository/HitCountRepository.php b/app/Statistics/Repository/HitCountRepository.php index 65793b52cc..8b463d9e96 100644 --- a/app/Statistics/Repository/HitCountRepository.php +++ b/app/Statistics/Repository/HitCountRepository.php @@ -59,7 +59,7 @@ class HitCountRepository implements HitCountRepositoryInterface * * @return string */ - private function hitCountQuery($page_name, string $page_parameter = ''): string + private function hitCountQuery(string $page_name, string $page_parameter = ''): string { if ($page_name === '') { // index.php?context=gedcom diff --git a/app/Statistics/Repository/LatestUserRepository.php b/app/Statistics/Repository/LatestUserRepository.php index dcef4e3bd5..6d393f8721 100644 --- a/app/Statistics/Repository/LatestUserRepository.php +++ b/app/Statistics/Repository/LatestUserRepository.php @@ -83,6 +83,10 @@ class LatestUserRepository implements LatestUserRepositoryInterface ->orderByDesc('us.setting_value') ->value('user_id'); + if ($user_id !== null) { + $user_id = (int) $user_id; + } + $user = $this->user_service->find($user_id) ?? Auth::user(); return $user; diff --git a/app/Statistics/Service/CountryService.php b/app/Statistics/Service/CountryService.php index e9efab9373..e8eb9a9559 100644 --- a/app/Statistics/Service/CountryService.php +++ b/app/Statistics/Service/CountryService.php @@ -29,7 +29,7 @@ class CountryService /** * Country codes and names * - * @return string[] + * @return array<string> */ public function getAllCountries(): array { @@ -550,7 +550,7 @@ class CountryService * NOTE: this is not 1:1. ENG/SCO/WAL/NIR => GB * NOTE: this also includes champman codes and others. Should it? * - * @return string[] + * @return array<string> */ public function iso3166(): array { diff --git a/app/SurnameTradition.php b/app/SurnameTradition.php index 77fa838869..18d3b60a7b 100644 --- a/app/SurnameTradition.php +++ b/app/SurnameTradition.php @@ -42,7 +42,7 @@ class SurnameTradition * * @return SurnameTraditionInterface */ - public static function create($name): SurnameTraditionInterface + public static function create(string $name): SurnameTraditionInterface { switch ($name) { case 'paternal': @@ -69,7 +69,7 @@ class SurnameTradition /** * A list of known surname traditions, with their descriptions * - * @return string[] + * @return array<string> */ public static function allDescriptions(): array { diff --git a/app/SurnameTradition/DefaultSurnameTradition.php b/app/SurnameTradition/DefaultSurnameTradition.php index 5d9bc65a65..01e10a0696 100644 --- a/app/SurnameTradition/DefaultSurnameTradition.php +++ b/app/SurnameTradition/DefaultSurnameTradition.php @@ -63,7 +63,7 @@ class DefaultSurnameTradition implements SurnameTraditionInterface * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -78,7 +78,7 @@ class DefaultSurnameTradition implements SurnameTraditionInterface * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -93,7 +93,7 @@ class DefaultSurnameTradition implements SurnameTraditionInterface * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/IcelandicSurnameTradition.php b/app/SurnameTradition/IcelandicSurnameTradition.php index 9c04012a92..6b02b46ea9 100644 --- a/app/SurnameTradition/IcelandicSurnameTradition.php +++ b/app/SurnameTradition/IcelandicSurnameTradition.php @@ -44,7 +44,7 @@ class IcelandicSurnameTradition extends DefaultSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -70,7 +70,7 @@ class IcelandicSurnameTradition extends DefaultSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -90,7 +90,7 @@ class IcelandicSurnameTradition extends DefaultSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/LithuanianSurnameTradition.php b/app/SurnameTradition/LithuanianSurnameTradition.php index 4f293e6af6..ebecd52b31 100644 --- a/app/SurnameTradition/LithuanianSurnameTradition.php +++ b/app/SurnameTradition/LithuanianSurnameTradition.php @@ -57,7 +57,7 @@ class LithuanianSurnameTradition extends PaternalSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -86,7 +86,7 @@ class LithuanianSurnameTradition extends PaternalSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -108,7 +108,7 @@ class LithuanianSurnameTradition extends PaternalSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/MatrilinealSurnameTradition.php b/app/SurnameTradition/MatrilinealSurnameTradition.php index 431f8f4cdb..3f69957dce 100644 --- a/app/SurnameTradition/MatrilinealSurnameTradition.php +++ b/app/SurnameTradition/MatrilinealSurnameTradition.php @@ -31,7 +31,7 @@ class MatrilinealSurnameTradition extends DefaultSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -54,7 +54,7 @@ class MatrilinealSurnameTradition extends DefaultSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { diff --git a/app/SurnameTradition/PaternalSurnameTradition.php b/app/SurnameTradition/PaternalSurnameTradition.php index 819487db82..232d96eaf5 100644 --- a/app/SurnameTradition/PaternalSurnameTradition.php +++ b/app/SurnameTradition/PaternalSurnameTradition.php @@ -40,7 +40,7 @@ class PaternalSurnameTradition extends PatrilinealSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -71,7 +71,7 @@ class PaternalSurnameTradition extends PatrilinealSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/PatrilinealSurnameTradition.php b/app/SurnameTradition/PatrilinealSurnameTradition.php index b64f407988..0eebd0f556 100644 --- a/app/SurnameTradition/PatrilinealSurnameTradition.php +++ b/app/SurnameTradition/PatrilinealSurnameTradition.php @@ -31,7 +31,7 @@ class PatrilinealSurnameTradition extends DefaultSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -54,7 +54,7 @@ class PatrilinealSurnameTradition extends DefaultSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -72,12 +72,12 @@ class PatrilinealSurnameTradition extends DefaultSurnameTradition } /** - * @param string $name A name - * @param string[] $inflections A list of inflections + * @param string $name A name + * @param array<string,string> $inflections A list of inflections * * @return string An inflected name */ - protected function inflect($name, $inflections): string + protected function inflect(string $name, array $inflections): string { foreach ($inflections as $from => $to) { $name = preg_replace('~' . $from . '~u', $to, $name); diff --git a/app/SurnameTradition/PolishSurnameTradition.php b/app/SurnameTradition/PolishSurnameTradition.php index 938e290b29..e48224e7cc 100644 --- a/app/SurnameTradition/PolishSurnameTradition.php +++ b/app/SurnameTradition/PolishSurnameTradition.php @@ -47,7 +47,7 @@ class PolishSurnameTradition extends PaternalSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -76,7 +76,7 @@ class PolishSurnameTradition extends PaternalSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -98,7 +98,7 @@ class PolishSurnameTradition extends PaternalSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/PortugueseSurnameTradition.php b/app/SurnameTradition/PortugueseSurnameTradition.php index 054570d320..ebc40f8d33 100644 --- a/app/SurnameTradition/PortugueseSurnameTradition.php +++ b/app/SurnameTradition/PortugueseSurnameTradition.php @@ -35,7 +35,7 @@ class PortugueseSurnameTradition extends DefaultSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -63,7 +63,7 @@ class PortugueseSurnameTradition extends DefaultSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -93,7 +93,7 @@ class PortugueseSurnameTradition extends DefaultSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/SpanishSurnameTradition.php b/app/SurnameTradition/SpanishSurnameTradition.php index 09d9f60bb7..b732cde395 100644 --- a/app/SurnameTradition/SpanishSurnameTradition.php +++ b/app/SurnameTradition/SpanishSurnameTradition.php @@ -35,7 +35,7 @@ class SpanishSurnameTradition extends DefaultSurnameTradition * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array { @@ -63,7 +63,7 @@ class SpanishSurnameTradition extends DefaultSurnameTradition * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array { @@ -93,7 +93,7 @@ class SpanishSurnameTradition extends DefaultSurnameTradition * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array { diff --git a/app/SurnameTradition/SurnameTraditionInterface.php b/app/SurnameTradition/SurnameTraditionInterface.php index 5e14dd7e7d..92a9ef6191 100644 --- a/app/SurnameTradition/SurnameTraditionInterface.php +++ b/app/SurnameTradition/SurnameTraditionInterface.php @@ -46,7 +46,7 @@ interface SurnameTraditionInterface * @param string $mother_name A GEDCOM NAME * @param string $child_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newChildNames(string $father_name, string $mother_name, string $child_sex): array; @@ -56,7 +56,7 @@ interface SurnameTraditionInterface * @param string $child_name A GEDCOM NAME * @param string $parent_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newParentNames(string $child_name, string $parent_sex): array; @@ -66,7 +66,7 @@ interface SurnameTraditionInterface * @param string $spouse_name A GEDCOM NAME * @param string $spouse_sex M, F or U * - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) + * @return array<string,string> Associative array of GEDCOM name parts (SURN, _MARNM, etc.) */ public function newSpouseNames(string $spouse_name, string $spouse_sex): array; } diff --git a/app/User.php b/app/User.php index 8a0d7caf6a..0b77d4f3b9 100644 --- a/app/User.php +++ b/app/User.php @@ -88,7 +88,7 @@ class User implements UserInterface * * @return User */ - public function setEmail($email): User + public function setEmail(string $email): User { if ($this->email !== $email) { $this->email = $email; @@ -120,7 +120,7 @@ class User implements UserInterface * * @return User */ - public function setRealName($real_name): User + public function setRealName(string $real_name): User { if ($this->real_name !== $real_name) { $this->real_name = $real_name; @@ -152,7 +152,7 @@ class User implements UserInterface * * @return $this */ - public function setUserName($user_name): self + public function setUserName(string $user_name): self { if ($this->user_name !== $user_name) { $this->user_name = $user_name; diff --git a/app/View.php b/app/View.php index 1460c04c3d..2012c9077b 100644 --- a/app/View.php +++ b/app/View.php @@ -277,7 +277,7 @@ class View * * @return string */ - public static function make($name, $data = []): string + public static function make(string $name, array $data = []): string { $view = new self($name, $data); diff --git a/app/Webtrees.php b/app/Webtrees.php index d3c4bee1e1..eb6e73cacf 100644 --- a/app/Webtrees.php +++ b/app/Webtrees.php @@ -181,7 +181,7 @@ class Webtrees /** * The webtrees application is built from middleware. * - * @return string[] + * @return array<string> */ public function middleware(): array { |
