X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconfig%2FResource%2FFileResource.php;fp=vendor%2Fsymfony%2Fconfig%2FResource%2FFileResource.php;h=6ad130518854c1609190f5792e586cde2c31f55b;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=00b2957ca5191ecb635ae47842703620a768048d;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/config/Resource/FileResource.php b/vendor/symfony/config/Resource/FileResource.php index 00b2957ca..6ad130518 100644 --- a/vendor/symfony/config/Resource/FileResource.php +++ b/vendor/symfony/config/Resource/FileResource.php @@ -29,10 +29,16 @@ class FileResource implements SelfCheckingResourceInterface, \Serializable * Constructor. * * @param string $resource The file path to the resource + * + * @throws \InvalidArgumentException */ public function __construct($resource) { $this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false); + + if (false === $this->resource) { + throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $resource)); + } } /** @@ -40,11 +46,11 @@ class FileResource implements SelfCheckingResourceInterface, \Serializable */ public function __toString() { - return (string) $this->resource; + return $this->resource; } /** - * {@inheritdoc} + * @return string The canonicalized, absolute path to the resource */ public function getResource() { @@ -56,11 +62,7 @@ class FileResource implements SelfCheckingResourceInterface, \Serializable */ public function isFresh($timestamp) { - if (false === $this->resource || !file_exists($this->resource)) { - return false; - } - - return filemtime($this->resource) <= $timestamp; + return file_exists($this->resource) && @filemtime($this->resource) <= $timestamp; } public function serialize()