Skip to content

Commit

Permalink
Fix rendering problem
Browse files Browse the repository at this point in the history
  • Loading branch information
BentiGorlich committed Sep 13, 2024
1 parent 5b218fc commit e1b3ea8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Twig/Runtime/FrontExtensionRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ public function getClass(mixed $object): string

public function getSubjectType(mixed $object): string
{
return match (\get_class($object)) {
Entry::class => 'entry',
EntryComment::class => 'entry_comment',
Post::class => 'post',
PostComment::class => 'post_comment',
default => null,
};
if ($object instanceof Entry) {
return 'entry';
} elseif ($object instanceof EntryComment) {
return 'entry_comment';
} elseif ($object instanceof Post) {
return 'post';
} elseif ($object instanceof PostComment) {
return 'post_comment';
} else {
throw new \LogicException('unknown class '.\get_class($object));
}
}
}

0 comments on commit e1b3ea8

Please sign in to comment.