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
|
public function getExtension(): CompilerExtensions
|
||||||
{
|
{
|
||||||
// TODO: Update usages from here
|
|
||||||
return $this->extension;
|
return $this->extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,9 +242,12 @@
|
||||||
throw new ConfigurationException('The property \'project.compiler.extension\' must not be null.');
|
throw new ConfigurationException('The property \'project.compiler.extension\' must not be null.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new self(Functions::array_bc($data, 'extension'),
|
$extension = CompilerExtensions::tryFrom(Functions::array_bc($data, 'extension'));
|
||||||
Functions::array_bc($data, 'maximum_version'),
|
if($extension === null)
|
||||||
Functions::array_bc($data, 'minimum_version')
|
{
|
||||||
);
|
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