diff options
| -rw-r--r-- | app/Census/CensusColumnSurnameGivenNameInitial.php | 6 | ||||
| -rw-r--r-- | app/Database.php | 1 |
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); }); } |
