Throw FileNotFoundException when FileSource path does not exist

Closes #1649.
This commit is contained in:
David Sevilla Martín 2018-11-20 19:27:06 -05:00 committed by Franz Liedke
parent bd210636e8
commit 84b4f4832d

View File

@ -11,6 +11,8 @@
namespace Flarum\Frontend\Compiler\Source;
use InvalidArgumentException;
class FileSource implements SourceInterface
{
/**
@ -23,6 +25,10 @@ class FileSource implements SourceInterface
*/
public function __construct(string $path)
{
if (! file_exists($path)) {
throw new InvalidArgumentException("File not found at path: $path");
}
$this->path = $path;
}