mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Throw FileNotFoundException when FileSource path does not exist
Closes #1649.
This commit is contained in:
parent
bd210636e8
commit
84b4f4832d
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace Flarum\Frontend\Compiler\Source;
|
namespace Flarum\Frontend\Compiler\Source;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
class FileSource implements SourceInterface
|
class FileSource implements SourceInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +25,10 @@ class FileSource implements SourceInterface
|
||||||
*/
|
*/
|
||||||
public function __construct(string $path)
|
public function __construct(string $path)
|
||||||
{
|
{
|
||||||
|
if (! file_exists($path)) {
|
||||||
|
throw new InvalidArgumentException("File not found at path: $path");
|
||||||
|
}
|
||||||
|
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user