Skip to content

Commit 2371ce0

Browse files
committed
Use generic boolean error format
1 parent 509b3d8 commit 2371ce0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Filterer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ final class Filterer implements FiltererInterface
6464
/**
6565
* @var string
6666
*/
67-
const INVALID_THROW_ON_ERROR_VALUE_ERROR_FORMAT = (
68-
FilterOptions::THROW_ON_ERROR . " for field '%s' was not a boolean value"
69-
);
67+
const INVALID_BOOLEAN_FILTER_OPTION = "%s for field '%s' was not a boolean value";
7068

7169
/**
7270
* @var array
@@ -623,7 +621,7 @@ private static function validateThrowOnError(array &$filters, string $field) : b
623621
$throwOnError = $filters[FilterOptions::THROW_ON_ERROR];
624622
if ($throwOnError !== true && $throwOnError !== false) {
625623
throw new InvalidArgumentException(
626-
sprintf(self::INVALID_THROW_ON_ERROR_VALUE_ERROR_FORMAT, $field)
624+
sprintf(self::INVALID_BOOLEAN_FILTER_OPTION, FilterOptions::THROW_ON_ERROR, $field)
627625
);
628626
}
629627

tests/FiltererTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ public function executeThrowsOnError()
411411
public function executeValidatesThrowsOnError()
412412
{
413413
$this->expectException(InvalidArgumentException::class);
414-
$this->expectExceptionMessage(sprintf(Filterer::INVALID_THROW_ON_ERROR_VALUE_ERROR_FORMAT, 'id'));
414+
$this->expectExceptionMessage(
415+
sprintf(Filterer::INVALID_BOOLEAN_FILTER_OPTION, FilterOptions::THROW_ON_ERROR, 'id')
416+
);
415417
$specification = [
416418
'id' => [
417419
FilterOptions::THROW_ON_ERROR => 'abc',

0 commit comments

Comments
 (0)