summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2022-02-05 12:35:21 +0000
committerGreg Roach <greg@subaqua.co.uk>2022-02-06 12:26:14 +0000
commit7fa97a692e549953cc46c515f488c131f1cf8cd8 (patch)
treeb4230049a1423ddcd2dff8b6f077accf061c3297 /app
parent6dbfdb0c27cfefb7a183c5539ae7948df08837ee (diff)
downloadwebtrees-7fa97a692e549953cc46c515f488c131f1cf8cd8.tar.gz
webtrees-7fa97a692e549953cc46c515f488c131f1cf8cd8.tar.bz2
webtrees-7fa97a692e549953cc46c515f488c131f1cf8cd8.zip
Strict types
Diffstat (limited to 'app')
-rw-r--r--app/Date.php4
-rw-r--r--app/Fact.php2
-rw-r--r--app/Individual.php10
-rw-r--r--app/Module/InteractiveTree/TreeView.php16
-rw-r--r--app/Module/UpcomingAnniversariesModule.php2
-rw-r--r--app/Report/RightToLeftSupport.php16
6 files changed, 24 insertions, 26 deletions
diff --git a/app/Date.php b/app/Date.php
index 852e0cad46..684506b5a6 100644
--- a/app/Date.php
+++ b/app/Date.php
@@ -154,7 +154,7 @@ class Date
}
}
// If the date is different from the unconverted date, add it to the date string.
- if ($d1 != $d1tmp && $d1tmp !== '') {
+ if ($d1 !== $d1tmp && $d1tmp !== '') {
if ($tree instanceof Tree) {
if ($CALENDAR_FORMAT !== 'none') {
$conv1 .= ' <span dir="' . I18N::direction() . '">(<a href="' . e($d1conv->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d1tmp . '</a>)</span>';
@@ -165,7 +165,7 @@ class Date
$conv1 .= ' <span dir="' . I18N::direction() . '">(' . $d1tmp . ')</span>';
}
}
- if ($this->date2 !== null && $d2 != $d2tmp && $d1tmp != '') {
+ if ($this->date2 !== null && $d2 !== $d2tmp && $d1tmp !== '') {
if ($tree instanceof Tree) {
$conv2 .= ' <span dir="' . I18N::direction() . '">(<a href="' . e($d2conv->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d2tmp . '</a>)</span>';
} else {
diff --git a/app/Fact.php b/app/Fact.php
index d342db6724..a2472dc5fa 100644
--- a/app/Fact.php
+++ b/app/Fact.php
@@ -727,7 +727,7 @@ class Fact
$ret = $factsort[$atag] - $factsort[$btag];
// If facts are the same then put dated facts before non-dated facts
- if ($ret == 0) {
+ if ($ret === 0) {
if ($a->attribute('DATE') !== '' && $b->attribute('DATE') === '') {
return -1;
}
diff --git a/app/Individual.php b/app/Individual.php
index a61893a34f..0a8c2ea714 100644
--- a/app/Individual.php
+++ b/app/Individual.php
@@ -41,14 +41,12 @@ class Individual extends GedcomRecord
protected const ROUTE_NAME = IndividualPage::class;
- /** @var int used in some lists to keep track of this individual’s generation in that list */
- public $generation;
+ /** Used in some lists to keep track of this individual’s generation in that list */
+ public ?int $generation = null;
- /** @var Date The estimated date of birth */
- private $estimated_birth_date;
+ private ?Date $estimated_birth_date = null;
- /** @var Date The estimated date of death */
- private $estimated_death_date;
+ private ?Date $estimated_death_date = null;
/**
* A closure which will compare individuals by birth date.
diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php
index f1861ceb9a..2b301c2b52 100644
--- a/app/Module/InteractiveTree/TreeView.php
+++ b/app/Module/InteractiveTree/TreeView.php
@@ -199,16 +199,16 @@ class TreeView
}
}
$tc = count($children2draw);
- if ($tc) {
+ if ($tc > 0) {
$f2load = implode(',', $f2load);
$nbc = 0;
foreach ($children2draw as $child) {
$nbc++;
- if ($tc == 1) {
+ if ($tc === 1) {
$co = 'c'; // unique
- } elseif ($nbc == 1) {
+ } elseif ($nbc === 1) {
$co = 't'; // first
- } elseif ($nbc == $tc) {
+ } elseif ($nbc === $tc) {
$co = 'b'; //last
} else {
$co = 'h';
@@ -216,7 +216,7 @@ class TreeView
$html .= $this->drawPerson($child, $gen - 1, -1, null, $co, false);
}
if (!$ajax) {
- $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine();
+ $html = '<td align="right"' . ($gen === 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine();
}
}
@@ -309,7 +309,7 @@ class TreeView
if ($parent instanceof Individual) {
$u = $unique ? 'c' : 't';
- $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $primaryChildFamily->xref() . '@' . $u . '"' : '') . '>';
+ $html .= '<tr><td ' . ($gen === 0 ? ' abbr="p' . $primaryChildFamily->xref() . '@' . $u . '"' : '') . '>';
$html .= $this->drawPerson($parent, $gen - 1, 1, $primaryChildFamily, $u, false);
$html .= '</td></tr>';
}
@@ -319,8 +319,8 @@ class TreeView
$nb = count($fop);
foreach ($fop as $p) {
$n++;
- $u = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h');
- $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $p[1]->xref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u, false) . '</td></tr>';
+ $u = $unique ? 'c' : ($n === $nb || empty($p[1]) ? 'b' : 'h');
+ $html .= '<tr><td ' . ($gen === 0 ? ' abbr="p' . $p[1]->xref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u, false) . '</td></tr>';
}
}
$html .= '</tbody></table></td>';
diff --git a/app/Module/UpcomingAnniversariesModule.php b/app/Module/UpcomingAnniversariesModule.php
index 24e034cb78..3614116559 100644
--- a/app/Module/UpcomingAnniversariesModule.php
+++ b/app/Module/UpcomingAnniversariesModule.php
@@ -155,7 +155,7 @@ class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockI
$facts = $calendar_service->getEventsList($startjd, $endjd, $events_filter, $filter, $sortStyle, $tree);
if ($facts->isEmpty()) {
- if ($endjd == $startjd) {
+ if ($endjd === $startjd) {
$content = view('modules/upcoming_events/empty', [
'message' => I18N::translate('No events exist for tomorrow.'),
]);
diff --git a/app/Report/RightToLeftSupport.php b/app/Report/RightToLeftSupport.php
index e58d4cecaa..3caa069a28 100644
--- a/app/Report/RightToLeftSupport.php
+++ b/app/Report/RightToLeftSupport.php
@@ -56,17 +56,17 @@ class RightToLeftSupport
private const LENGTH_START = 5;
private const LENGTH_END = 6;
- /** @var string Were we previously processing LTR or RTL. */
- private static $previousState;
+ /* Were we previously processing LTR or RTL. */
+ private static string $previousState;
- /** @var string Are we currently processing LTR or RTL. */
- private static $currentState;
+ /* Are we currently processing LTR or RTL. */
+ private static string $currentState;
- /** @var string Text waiting to be processed. */
- private static $waitingText;
+ /* Text waiting to be processed. */
+ private static string $waitingText;
- /** @var int Offset into the text. */
- private static $posSpanStart;
+ /* Offset into the text. */
+ private static int $posSpanStart;
/**
* This function strips &lrm; and &rlm; from the input string. It should be used for all