Improve error handling for compiler extensions
This commit is contained in:
parent
3160ddfa27
commit
3adc1b81fb
1 changed files with 7 additions and 5 deletions
|
@ -103,7 +103,6 @@
|
|||
*/
|
||||
public function getExtension(): CompilerExtensions
|
||||
{
|
||||
// TODO: Update usages from here
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
|
@ -243,9 +242,12 @@
|
|||
throw new ConfigurationException('The property \'project.compiler.extension\' must not be null.');
|
||||
}
|
||||
|
||||
return new self(Functions::array_bc($data, 'extension'),
|
||||
Functions::array_bc($data, 'maximum_version'),
|
||||
Functions::array_bc($data, 'minimum_version')
|
||||
);
|
||||
$extension = CompilerExtensions::tryFrom(Functions::array_bc($data, 'extension'));
|
||||
if($extension === null)
|
||||
{
|
||||
throw new ConfigurationException('The property \'project.compiler.extension\' is not a valid extension');
|
||||
}
|
||||
|
||||
return new self($extension, Functions::array_bc($data, 'maximum_version'), Functions::array_bc($data, 'minimum_version'));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue