mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 21:18:41 +01:00
Throw exception when registering an invalid source
This commit is contained in:
parent
a26ebd8ae8
commit
a08a048061
@ -79,11 +79,11 @@ abstract class Source implements IteratorAggregate
|
||||
public function register(string ...$customSource): void
|
||||
{
|
||||
foreach ($customSource as $class) {
|
||||
if (is_subclass_of($class, Source::class)) {
|
||||
static::$customSources[] = $class;
|
||||
if (!is_subclass_of($class, Source::class)) {
|
||||
throw SourceException::invalidSource($class);
|
||||
}
|
||||
|
||||
throw SourceException::invalidSource($class);
|
||||
static::$customSources[] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user