Skip to content

Commit

Permalink
Strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Roach committed Oct 16, 2019
1 parent 962ead5 commit 381e28f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/Functions/FunctionsPrintFacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function printFact(Fact $fact, GedcomRecord $record): void
// Who is this fact about? Need it to translate fact label correctly
if ($parent instanceof Family && $record instanceof Individual) {
// Family event
$label_person = $fact->record()->spouse($record);
$label_person = $parent->spouse($record);
} else {
// Individual event
$label_person = $parent;
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/AdminTreesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ private function duplicateRecords(Tree $tree): array
$sources = DB::table('sources')
->where('s_file', '=', $tree->id())
->groupBy(['s_name'])
->having(new Expression('COUNT(s_id)'), '>', 1)
->having(new Expression('COUNT(s_id)'), '>', '1')
->select([new Expression('GROUP_CONCAT(s_id) AS xrefs')])
->pluck('xrefs')
->map(static function (string $xrefs) use ($tree): array {
Expand All @@ -2008,7 +2008,7 @@ private function duplicateRecords(Tree $tree): array
->where('d_file', '=', $tree->id())
->whereIn('d_fact', ['BIRT', 'CHR', 'BAPM', 'DEAT', 'BURI'])
->groupBy(['d_year', 'd_month', 'd_day', 'd_type', 'd_fact', 'n_type', 'n_full'])
->having(new Expression('COUNT(DISTINCT d_gid)'), '>', 1)
->having(new Expression('COUNT(DISTINCT d_gid)'), '>', '1')
->select([new Expression('GROUP_CONCAT(d_gid) AS xrefs')])
->distinct()
->pluck('xrefs')
Expand All @@ -2021,9 +2021,9 @@ private function duplicateRecords(Tree $tree): array

$families = DB::table('families')
->where('f_file', '=', $tree->id())
->groupBy(new Expression('LEAST(f_husb, f_wife)'))
->groupBy(new Expression('GREATEST(f_husb, f_wife)'))
->having(new Expression('COUNT(f_id)'), '>', 1)
->groupBy([new Expression('LEAST(f_husb, f_wife)')])
->groupBy([new Expression('GREATEST(f_husb, f_wife)')])
->having(new Expression('COUNT(f_id)'), '>', '1')
->select([new Expression('GROUP_CONCAT(f_id) AS xrefs')])
->pluck('xrefs')
->map(static function (string $xrefs) use ($tree): array {
Expand All @@ -2037,7 +2037,7 @@ private function duplicateRecords(Tree $tree): array
->where('m_file', '=', $tree->id())
->where('descriptive_title', '<>', '')
->groupBy(['descriptive_title'])
->having(new Expression('COUNT(m_id)'), '>', 1)
->having(new Expression('COUNT(m_id)'), '>', '1')
->select([new Expression('GROUP_CONCAT(m_id) AS xrefs')])
->pluck('xrefs')
->map(static function (string $xrefs) use ($tree): array {
Expand Down
20 changes: 8 additions & 12 deletions app/Http/Middleware/WrapHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,18 @@ public function __construct(string $handler)
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (is_string($this->handler)) {
if (Str::contains($this->handler, self::SCOPE_OPERATOR)) {
[$class, $method] = explode(self::SCOPE_OPERATOR, $this->handler);
if (Str::contains($this->handler, self::SCOPE_OPERATOR)) {
[$class, $method] = explode(self::SCOPE_OPERATOR, $this->handler);

if (substr_compare($class, '\\', 0, 1) !== 0) {
$class = self::CONTROLLER_NAMESPACE . $class;
}

$controller = app($class);

return $controller->$method($request);
if (substr_compare($class, '\\', 0, 1) !== 0) {
$class = self::CONTROLLER_NAMESPACE . $class;
}

return app($this->handler)->handle($request);
$controller = app($class);

return $controller->$method($request);
}

return $this->handler->handle($request);
return app($this->handler)->handle($request);
}
}
4 changes: 2 additions & 2 deletions app/Report/ReportParserGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ protected function getPersonNameStartHandler(array $attrs): void
);
$name = strip_tags($name);
if (!empty($attrs['truncate'])) {
$name = Str::limit($name, $attrs['truncate'], I18N::translate(''));
$name = Str::limit($name, (int) $attrs['truncate'], I18N::translate(''));
} else {
$addname = $record->alternateName();
$addname = preg_replace(
Expand Down Expand Up @@ -1047,7 +1047,7 @@ protected function gedcomValueStartHandler(array $attrs): void

if (!empty($attrs['truncate'])) {
$value = strip_tags($value);
$value = Str::limit($value, $attrs['truncate'], I18N::translate(''));
$value = Str::limit($value, (int) $attrs['truncate'], I18N::translate(''));
}
$this->current_element->addText($value);
}
Expand Down

0 comments on commit 381e28f

Please sign in to comment.