summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Http/RequestHandlers/NotePage.php2
-rw-r--r--app/Http/RequestHandlers/SearchAdvancedPage.php3
-rw-r--r--app/Http/RequestHandlers/SearchPhoneticPage.php3
-rw-r--r--app/Module/ModuleSidebarTrait.php2
-rw-r--r--app/Module/ModuleTabTrait.php2
-rw-r--r--app/Module/RelationshipsChartModule.php6
-rw-r--r--app/Module/ResearchTaskModule.php3
-rw-r--r--resources/views/admin/merge-records-step-2.phtml6
-rw-r--r--resources/views/admin/trees-check.phtml2
-rw-r--r--resources/views/modules/clippings/show.phtml2
-rw-r--r--resources/views/modules/gedcom_news/list.phtml2
-rw-r--r--resources/views/modules/gedcom_stats/statistics.phtml2
-rw-r--r--resources/views/modules/media/tab.phtml2
-rw-r--r--resources/views/modules/notes/tab.phtml2
-rw-r--r--resources/views/modules/stories/tab.phtml2
-rw-r--r--resources/views/place-events.phtml8
-rw-r--r--resources/views/repository-page.phtml2
-rw-r--r--resources/views/search-advanced-page.phtml2
-rw-r--r--resources/views/search-general-page.phtml2
-rw-r--r--resources/views/search-phonetic-page.phtml2
-rw-r--r--resources/views/search-results.phtml10
-rw-r--r--tests/app/Http/Controllers/Admin/UpgradeControllerTest.php2
-rw-r--r--tests/app/Http/Middleware/HandleExceptionsTest.php4
23 files changed, 37 insertions, 36 deletions
diff --git a/app/Http/RequestHandlers/NotePage.php b/app/Http/RequestHandlers/NotePage.php
index d496349967..267e02b474 100644
--- a/app/Http/RequestHandlers/NotePage.php
+++ b/app/Http/RequestHandlers/NotePage.php
@@ -82,7 +82,7 @@ class NotePage implements RequestHandlerInterface
'families' => $note->linkedFamilies('NOTE'),
'individuals' => $note->linkedIndividuals('NOTE'),
'note' => $note,
- 'notes' => new Collection([]),
+ 'notes' => new Collection(),
'media_objects' => $note->linkedMedia('NOTE'),
'meta_robots' => 'index,follow',
'sources' => $note->linkedSources('NOTE'),
diff --git a/app/Http/RequestHandlers/SearchAdvancedPage.php b/app/Http/RequestHandlers/SearchAdvancedPage.php
index 2bec3948fb..ab9a30beec 100644
--- a/app/Http/RequestHandlers/SearchAdvancedPage.php
+++ b/app/Http/RequestHandlers/SearchAdvancedPage.php
@@ -24,6 +24,7 @@ use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\SearchService;
use Fisharebest\Webtrees\Tree;
+use Illuminate\Support\Collection;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -161,7 +162,7 @@ class SearchAdvancedPage implements RequestHandlerInterface
if (array_filter($fields) !== []) {
$individuals = $this->search_service->searchIndividualsAdvanced([$tree], $fields, $modifiers);
} else {
- $individuals = [];
+ $individuals = new Collection();
}
$title = I18N::translate('Advanced search');
diff --git a/app/Http/RequestHandlers/SearchPhoneticPage.php b/app/Http/RequestHandlers/SearchPhoneticPage.php
index aea0c68872..aa72df6d52 100644
--- a/app/Http/RequestHandlers/SearchPhoneticPage.php
+++ b/app/Http/RequestHandlers/SearchPhoneticPage.php
@@ -25,6 +25,7 @@ use Fisharebest\Webtrees\Services\SearchService;
use Fisharebest\Webtrees\Services\TreeService;
use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\Tree;
+use Illuminate\Support\Collection;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -93,7 +94,7 @@ class SearchPhoneticPage implements RequestHandlerInterface
$search_trees = [$tree];
}
- $individuals = [];
+ $individuals = new Collection();
if ($lastname !== '' || $firstname !== '' || $place !== '') {
$individuals = $this->search_service->searchIndividualsPhonetic($soundex, $lastname, $firstname, $place, $search_trees);
diff --git a/app/Module/ModuleSidebarTrait.php b/app/Module/ModuleSidebarTrait.php
index 368ed8d17a..15a6127d87 100644
--- a/app/Module/ModuleSidebarTrait.php
+++ b/app/Module/ModuleSidebarTrait.php
@@ -84,6 +84,6 @@ trait ModuleSidebarTrait
*/
public function supportedFacts(): Collection
{
- return new Collection([]);
+ return new Collection();
}
}
diff --git a/app/Module/ModuleTabTrait.php b/app/Module/ModuleTabTrait.php
index 6e18368be0..be8a905c2b 100644
--- a/app/Module/ModuleTabTrait.php
+++ b/app/Module/ModuleTabTrait.php
@@ -112,7 +112,7 @@ trait ModuleTabTrait
*/
public function supportedFacts(): Collection
{
- return new Collection([]);
+ return new Collection();
}
/**
diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php
index bb2899ad10..83d882e2e3 100644
--- a/app/Module/RelationshipsChartModule.php
+++ b/app/Module/RelationshipsChartModule.php
@@ -306,7 +306,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte
foreach ($paths as $path) {
// Extract the relationship names between pairs of individuals
$relationships = $this->oldStyleRelationshipPath($tree, $path);
- if (empty($relationships)) {
+ if ($relationships === []) {
// Cannot see one of the families/individuals, due to privacy;
continue;
}
@@ -492,7 +492,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte
$graph = [];
foreach ($rows as $row) {
- if (empty($ancestors) || in_array($row->l_from, $ancestors, true) && !in_array($row->l_to, $exclude, true)) {
+ if ($ancestors === [] || in_array($row->l_from, $ancestors, true) && !in_array($row->l_to, $exclude, true)) {
$graph[$row->l_from][$row->l_to] = 1;
$graph[$row->l_to][$row->l_from] = 1;
}
@@ -585,7 +585,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte
$xref1,
$xref2,
];
- while (!empty($queue)) {
+ while ($queue !== []) {
$parents = DB::table('link AS l1')
->join('link AS l2', static function (JoinClause $join): void {
$join
diff --git a/app/Module/ResearchTaskModule.php b/app/Module/ResearchTaskModule.php
index b8b99a2ff1..c161be0bb6 100644
--- a/app/Module/ResearchTaskModule.php
+++ b/app/Module/ResearchTaskModule.php
@@ -87,7 +87,6 @@ class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface
$individuals = $this->individualsWithTasks($tree, $end_jd);
$families = $this->familiesWithTasks($tree, $end_jd);
- /** @var GedcomRecord[] $records */
$records = $individuals->merge($families);
$tasks = [];
@@ -109,7 +108,7 @@ class ResearchTaskModule extends AbstractModule implements ModuleBlockInterface
}
}
- if (empty($records)) {
+ if ($records->isEmpty()) {
$content = '<p>' . I18N::translate('There are no research tasks in this family tree.') . '</p>';
} else {
$content = view('modules/todo/research-tasks', ['tasks' => $tasks]);
diff --git a/resources/views/admin/merge-records-step-2.phtml b/resources/views/admin/merge-records-step-2.phtml
index e7f2375386..d01d61062d 100644
--- a/resources/views/admin/merge-records-step-2.phtml
+++ b/resources/views/admin/merge-records-step-2.phtml
@@ -27,7 +27,7 @@ use Fisharebest\Webtrees\I18N;
</h2>
</div>
<div class="card-body">
- <?php if (!empty($facts)) : ?>
+ <?php if ($facts !== []) : ?>
<table class="table table-bordered table-sm">
<thead>
<tr>
@@ -74,7 +74,7 @@ use Fisharebest\Webtrees\I18N;
</h2>
</div>
<div class="card-body">
- <?php if (!empty($facts1)) : ?>
+ <?php if ($facts1 !== []) : ?>
<table class="table table-bordered table-sm">
<thead>
<tr>
@@ -120,7 +120,7 @@ use Fisharebest\Webtrees\I18N;
</h2>
</div>
<div class="card-body">
- <?php if (!empty($facts2)) : ?>
+ <?php if ($facts2 !== []) : ?>
<table class="table table-bordered table-sm">
<thead>
<tr>
diff --git a/resources/views/admin/trees-check.phtml b/resources/views/admin/trees-check.phtml
index 2632a5c6dd..ecac10b2b8 100644
--- a/resources/views/admin/trees-check.phtml
+++ b/resources/views/admin/trees-check.phtml
@@ -22,7 +22,7 @@ use Fisharebest\Webtrees\I18N;
<li class="list-group-item list-group-item-warning"><?= $warning ?></li>
<?php endforeach ?>
- <?php if (empty($errors) && empty($warnings)) : ?>
+ <?php if ($errors === [] && $warnings === []) : ?>
<li class="list-group-item"><?= I18N::translate('No errors have been found.') ?></li>
<?php endif ?>
</ul>
diff --git a/resources/views/modules/clippings/show.phtml b/resources/views/modules/clippings/show.phtml
index b7a9798fbb..0c0ba3ae3d 100644
--- a/resources/views/modules/clippings/show.phtml
+++ b/resources/views/modules/clippings/show.phtml
@@ -8,7 +8,7 @@ use Fisharebest\Webtrees\I18N; ?>
<?= I18N::translate('The clippings cart allows you to take extracts from this family tree and download them as a GEDCOM file.') ?>
</p>
-<?php if (empty($records)) : ?>
+<?php if ($records === []) : ?>
<p>
<?= I18N::translate('Your clippings cart is empty.') ?>
</p>
diff --git a/resources/views/modules/gedcom_news/list.phtml b/resources/views/modules/gedcom_news/list.phtml
index a6c36462c6..6061e79fd8 100644
--- a/resources/views/modules/gedcom_news/list.phtml
+++ b/resources/views/modules/gedcom_news/list.phtml
@@ -5,7 +5,7 @@ use Fisharebest\Webtrees\I18N;
?>
-<?php if (empty($articles)) : ?>
+<?php if ($articles->isEmpty()) : ?>
<?= I18N::translate('No news articles have been submitted.') ?>
<?php endif ?>
diff --git a/resources/views/modules/gedcom_stats/statistics.phtml b/resources/views/modules/gedcom_stats/statistics.phtml
index 6277320039..15d2a69574 100644
--- a/resources/views/modules/gedcom_stats/statistics.phtml
+++ b/resources/views/modules/gedcom_stats/statistics.phtml
@@ -232,7 +232,7 @@
</div>
</div>
-<?php if (!empty($surnames)) : ?>
+<?php if ($surnames !== '') : ?>
<div class="clearfix">
<p>
<strong>
diff --git a/resources/views/modules/media/tab.phtml b/resources/views/modules/media/tab.phtml
index 3f39ab4b0c..12df6dc1f1 100644
--- a/resources/views/modules/media/tab.phtml
+++ b/resources/views/modules/media/tab.phtml
@@ -10,7 +10,7 @@
<?php FunctionsPrintFacts::printMainMedia($fact, 4) ?>
<?php endforeach ?>
- <?php if (empty($facts)) : ?>
+ <?php if ($facts->isEmpty()) : ?>
<tr>
<td colspan="2">
<?= I18N::translate('There are no media objects for this individual.') ?>
diff --git a/resources/views/modules/notes/tab.phtml b/resources/views/modules/notes/tab.phtml
index 5ee1ebb3cf..7ba1e4e1b8 100644
--- a/resources/views/modules/notes/tab.phtml
+++ b/resources/views/modules/notes/tab.phtml
@@ -25,7 +25,7 @@ use Fisharebest\Webtrees\View;
<?php FunctionsPrintFacts::printMainNotes($fact, 4) ?>
<?php endforeach ?>
- <?php if (empty($facts)) : ?>
+ <?php if ($facts->isEmpty()) : ?>
<tr>
<td colspan="2">
<?= I18N::translate('There are no notes for this individual.') ?>
diff --git a/resources/views/modules/stories/tab.phtml b/resources/views/modules/stories/tab.phtml
index a52f296f98..1305d5a820 100644
--- a/resources/views/modules/stories/tab.phtml
+++ b/resources/views/modules/stories/tab.phtml
@@ -21,7 +21,7 @@ use Fisharebest\Webtrees\I18N;
<?php endif ?>
<?php endforeach ?>
- <?php if ($is_admin && empty($stories)) : ?>
+ <?php if ($is_admin && $stories === []) : ?>
<div>
<a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'xref' => $individual->xref(), 'tree' => $tree->name()])) ?>">
<?= I18N::translate('Add a story') ?>
diff --git a/resources/views/place-events.phtml b/resources/views/place-events.phtml
index 37766a0431..90defa7c57 100644
--- a/resources/views/place-events.phtml
+++ b/resources/views/place-events.phtml
@@ -2,13 +2,13 @@
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
- <a class="nav-link active<?= empty($indilist) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals">
+ <a class="nav-link active<?= $indilist === [] ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals">
<?= I18N::translate('Individuals') ?>
<?= view('components/badge', ['count' => count($indilist)]) ?>
</a>
</li>
<li class="nav-item">
- <a class="nav-link<?= empty($famlist) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families">
+ <a class="nav-link<?= $famlist === [] ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families">
<?= I18N::translate('Families') ?>
<?= view('components/badge', ['count' => count($famlist)]) ?>
</a>
@@ -16,7 +16,7 @@
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" role="tabpanel" id="individuals">
- <?php if (empty($indilist)) : ?>
+ <?php if ($indilist === []) : ?>
<p><?= I18N::translate('No results found.') ?></p>
<?php else : ?>
<?= view('lists/individuals-table', [
@@ -28,7 +28,7 @@
</div>
<div class="tab-pane fade" role="tabpanel" id="families">
- <?php if (empty($famlist)) : ?>
+ <?php if ($famlist === []) : ?>
<p><?= I18N::translate('No results found.') ?></p>
<?php else : ?>
<?= view('lists/families-table', ['families' => $famlist, 'tree' => $tree]) ?>
diff --git a/resources/views/repository-page.phtml b/resources/views/repository-page.phtml
index ece5b25199..f5e25faf1d 100644
--- a/resources/views/repository-page.phtml
+++ b/resources/views/repository-page.phtml
@@ -40,7 +40,7 @@ use Fisharebest\Webtrees\I18N;
</a>
</li>
<li class="nav-item">
- <a class="nav-link<?= empty($sources) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources">
+ <a class="nav-link<?= $sources->isEmpty() ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#sources">
<?= I18N::translate('Sources') ?>
<?= view('components/badge', ['count' => count($sources)]) ?>
</a>
diff --git a/resources/views/search-advanced-page.phtml b/resources/views/search-advanced-page.phtml
index 5512e60ae9..a002855cdf 100644
--- a/resources/views/search-advanced-page.phtml
+++ b/resources/views/search-advanced-page.phtml
@@ -76,7 +76,7 @@ use Fisharebest\Webtrees\I18N;
</div>
<?php if (true) : ?>
- <?php if (empty($individuals)) : ?>
+ <?php if ($individuals->isEmpty()) : ?>
<div class="alert alert-info row">
<?= I18N::translate('No results found.') ?>
</div>
diff --git a/resources/views/search-general-page.phtml b/resources/views/search-general-page.phtml
index 2b0af959d9..032d83ec00 100644
--- a/resources/views/search-general-page.phtml
+++ b/resources/views/search-general-page.phtml
@@ -108,7 +108,7 @@ use Fisharebest\Webtrees\I18N;
</form>
<?php if ($query !== '') : ?>
- <?php if (empty($individuals) && empty($families) && empty($repositories) && empty($sources) && empty($notes)) : ?>
+ <?php if ($individuals->isEmpty() && $families->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?>
<div class="alert alert-info row">
<?= I18N::translate('No results found.') ?>
</div>
diff --git a/resources/views/search-phonetic-page.phtml b/resources/views/search-phonetic-page.phtml
index 61e1c66d6f..3ebe495dc4 100644
--- a/resources/views/search-phonetic-page.phtml
+++ b/resources/views/search-phonetic-page.phtml
@@ -109,7 +109,7 @@ use Fisharebest\Webtrees\I18N;
</form>
<?php if ($firstname !== '' || $lastname !== '' || $place !== '') : ?>
- <?php if (empty($individuals)) : ?>
+ <?php if ($individuals->isEmpty()) : ?>
<div class="alert alert-info row">
<?= I18N::translate('No results found.') ?>
</div>
diff --git a/resources/views/search-results.phtml b/resources/views/search-results.phtml
index 8e21ab740f..0a89b35ff1 100644
--- a/resources/views/search-results.phtml
+++ b/resources/views/search-results.phtml
@@ -5,7 +5,7 @@
<ul class="nav nav-tabs wt-search-results-tabs" role="tablist">
<?php if ($search_individuals) : ?>
<li class="nav-item">
- <a class="nav-link <?= empty($individuals) ? 'text-muted' : '' ?>" id="individuals-tab" data-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
+ <a class="nav-link <?= $individuals->isEmpty() ? 'text-muted' : '' ?>" id="individuals-tab" data-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
<?= I18N::translate('Individuals') ?>
<span class="badge badge-secondary">
<?= I18N::number(count($individuals)) ?>
@@ -16,7 +16,7 @@
<?php if ($search_families) : ?>
<li class="nav-item">
- <a class="nav-link <?= empty($families) ? 'text-muted' : '' ?>" id="families-tab" data-toggle="tab" href="#families" role="tab" aria-controls="families">
+ <a class="nav-link <?= $families->isEmpty() ? 'text-muted' : '' ?>" id="families-tab" data-toggle="tab" href="#families" role="tab" aria-controls="families">
<?= I18N::translate('Families') ?>
<span class="badge badge-secondary">
<?= I18N::number(count($families)) ?>
@@ -27,7 +27,7 @@
<?php if ($search_sources) : ?>
<li class="nav-item">
- <a class="nav-link <?= empty($sources) ? 'text-muted' : '' ?>" id="sources-tab" data-toggle="tab" href="#sources" role="tab" aria-controls="sources">
+ <a class="nav-link <?= $sources->isEmpty() ? 'text-muted' : '' ?>" id="sources-tab" data-toggle="tab" href="#sources" role="tab" aria-controls="sources">
<?= I18N::translate('Sources') ?>
<span class="badge badge-secondary">
<?= I18N::number(count($sources)) ?>
@@ -38,7 +38,7 @@
<?php if ($search_repositories) : ?>
<li class="nav-item">
- <a class="nav-link <?= empty($repositories) ? 'text-muted' : '' ?>" id="repositories-tab" data-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
+ <a class="nav-link <?= $repositories->isEmpty() ? 'text-muted' : '' ?>" id="repositories-tab" data-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
<?= I18N::translate('Repositories') ?>
<span class="badge badge-secondary">
<?= I18N::number(count($repositories)) ?>
@@ -49,7 +49,7 @@
<?php if ($search_notes) : ?>
<li class="nav-item">
- <a class="nav-link <?= empty($notes) ? 'text-muted' : '' ?>" id="notes-tab" data-toggle="tab" href="#notes" role="tab" aria-controls="notes">
+ <a class="nav-link <?= $notes->isEmpty() ? 'text-muted' : '' ?>" id="notes-tab" data-toggle="tab" href="#notes" role="tab" aria-controls="notes">
<?= I18N::translate('Notes') ?>
<span class="badge badge-secondary">
<?= I18N::number(count($notes)) ?>
diff --git a/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php b/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php
index e0c33f7208..82e303f417 100644
--- a/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php
+++ b/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php
@@ -293,7 +293,7 @@ class UpgradeControllerTest extends TestCase
public function testStepUnzip(): void
{
$mock_upgrade_service = $this->createMock(UpgradeService::class);
- $mock_upgrade_service->method('webtreesZipContents')->willReturn(new Collection([]));
+ $mock_upgrade_service->method('webtreesZipContents')->willReturn(new Collection());
$controller = new UpgradeController(
new TreeService(),
$mock_upgrade_service
diff --git a/tests/app/Http/Middleware/HandleExceptionsTest.php b/tests/app/Http/Middleware/HandleExceptionsTest.php
index d9c3c39477..1f24f56c7f 100644
--- a/tests/app/Http/Middleware/HandleExceptionsTest.php
+++ b/tests/app/Http/Middleware/HandleExceptionsTest.php
@@ -48,8 +48,8 @@ class HandleExceptionsTest extends TestCase
$handler->method('handle')->willThrowException(new InternalServerErrorException('eek'));
$module_service = $this->createMock(ModuleService::class);
- $module_service->method('findByInterface')->willReturn(new Collection([]));
- $module_service->method('findByComponent')->willReturn(new Collection([]));
+ $module_service->method('findByInterface')->willReturn(new Collection());
+ $module_service->method('findByComponent')->willReturn(new Collection());
app()->instance(ModuleService::class, $module_service);
$request = self::createRequest();