summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-03-02 14:08:17 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-03-02 17:01:21 +0000
commit4a71b7346c8c75c2985a810609839dcdae84e371 (patch)
treecefd54b25bf178657412c3837720311ade37c8bc
parentb5979037de52280b1023c9eb58518a3089e7d267 (diff)
downloadwebtrees-4a71b7346c8c75c2985a810609839dcdae84e371.tar.gz
webtrees-4a71b7346c8c75c2985a810609839dcdae84e371.tar.bz2
webtrees-4a71b7346c8c75c2985a810609839dcdae84e371.zip
Feedback from vimeo/psalm
-rw-r--r--app/Census/CensusColumnSurnameGivenNameInitial.php6
-rw-r--r--app/Database.php1
2 files changed, 5 insertions, 2 deletions
diff --git a/app/Census/CensusColumnSurnameGivenNameInitial.php b/app/Census/CensusColumnSurnameGivenNameInitial.php
index 69f06fd86e..6a9a0b43d3 100644
--- a/app/Census/CensusColumnSurnameGivenNameInitial.php
+++ b/app/Census/CensusColumnSurnameGivenNameInitial.php
@@ -36,10 +36,12 @@ class CensusColumnSurnameGivenNameInitial extends CensusColumnFullName
{
$name = $this->nameAtCensusDate($individual, $this->date());
$given = $name['givn'];
- if (strpos($given, ' ') === false) {
+ $space_pos = strpos($given, ' ');
+
+ if ($space_pos === false) {
return $name['surname'] . ', ' . $given;
}
- return $name['surname'] . ', ' . substr($given, 0, strpos($given, ' ') + 2);
+ return $name['surname'] . ', ' . substr($given, 0, $space_pos + 2);
}
}
diff --git a/app/Database.php b/app/Database.php
index e47dc57c28..b5004f5623 100644
--- a/app/Database.php
+++ b/app/Database.php
@@ -83,6 +83,7 @@ class Database
Builder::macro('whereContains', function ($column, string $search, string $boolean = 'and'): Builder {
$search = strtr($search, ['\\' => '\\\\', '%' => '\\%', '_' => '\\_', ' ' => '%']);
+ /** @psalm-suppress InvalidScope - The scope of $this depends on its use, not its definition */
return $this->where($column, 'LIKE', '%' . $search . '%', $boolean);
});
}