Skip to content

Commit 5f1cf0c

Browse files
committed
Replace exceptions with assertions
1 parent bde0dd4 commit 5f1cf0c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/core/src/Auth/Process/StatisticsWithAttribute.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ public function __construct(array &$config, $reserved)
4848
parent::__construct($config, $reserved);
4949

5050
if (array_key_exists('attributename', $config)) {
51-
if (!is_string($config['attributename'])) {
52-
throw new Exception('Invalid attribute name given to core:StatisticsWithAttribute filter.');
53-
}
51+
Assert::stringNotEmpty(
52+
$config['attributename'],
53+
'Invalid attribute name given to core:StatisticsWithAttribute filter.',
54+
);
5455
$this->attribute = $config['attributename'];
5556
}
5657

5758
if (array_key_exists('type', $config)) {
58-
if (!is_string($config['type'])) {
59-
throw new Exception('Invalid typeTag given to core:StatisticsWithAttribute filter.');
60-
}
59+
Assert::stringNotEmpty($config['type'], 'Invalid typeTag given to core:StatisticsWithAttribute filter.');
6160
$this->typeTag = $config['type'];
6261
}
6362

0 commit comments

Comments
 (0)