From 203ece598582838b476c7d51463669fb8a616d81 Mon Sep 17 00:00:00 2001 From: Bradley Date: Thu, 8 Aug 2024 16:50:35 +0100 Subject: [PATCH] Adjust error message, shorten parameter name --- src/Twig/Component/Badge.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Twig/Component/Badge.php b/src/Twig/Component/Badge.php index 048f8b3..d25d1cf 100644 --- a/src/Twig/Component/Badge.php +++ b/src/Twig/Component/Badge.php @@ -19,22 +19,22 @@ final class Badge } /** - * @param BadgeableInterface $object The object to be converted into a badge - * @param string $class Extra classes you want to add to the badge template - * @param ?string $colour Specify the colour for an objectless badge + * @param BadgeableInterface $obj The object to be converted into a badge + * @param string $class Extra classes you want to add to the badge template + * @param ?string $colour Specify the colour for an objectless badge */ - public function mount(?BadgeableInterface $object = null, string $class = '', string $colour = null, bool $outline = false): void + public function mount(?BadgeableInterface $obj = null, string $class = '', string $colour = null, bool $outline = false): void { - if (!$object && !$colour) { - throw new \RuntimeException(sprintf("You must specify either a colour for the badge or an instance of %s.", BadgeableInterface::class)); + if (!$obj && !$colour) { + throw new \RuntimeException(sprintf("You must specify either a colour an instance of \"%s\".", BadgeableInterface::class)); } - if ($object && $colour) { - throw new \RuntimeException(sprintf("You have specified both the colour \"%s\" and an instance of \"%s\". Please use one or the other.", $colour, $object::class)); + if ($obj && $colour) { + throw new \RuntimeException(sprintf("You have specified both the colour \"%s\" and an instance of \"%s\". Please use one or the other.", $colour, $obj::class)); } - if ($object) { - $palette = $object->getBadgeColour()->getPalette(); + if ($obj) { + $palette = $obj->getBadgeColour()->getPalette(); } if ($colour) {