Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForFileCouldNotBeFound PHP Method

createForFileCouldNotBeFound() public static method

public static createForFileCouldNotBeFound ( string $file, integer $code, Throwable $previous = null ) : InvalidArgumentException
$file string
$code integer
$previous Throwable
return InvalidArgumentException
    public static function createForFileCouldNotBeFound(string $file, int $code = 0, \Throwable $previous = null) : \InvalidArgumentException
    {
        return new \InvalidArgumentException(sprintf('The file "%s" could not be found.', $file), $code, $previous);
    }

Usage Example

Esempio n. 1
0
 /**
  * {@inheritDoc}
  *
  * @param string $file Local PHP file
  */
 public function parse(string $file) : array
 {
     if (false === file_exists($file)) {
         throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
     }
     $data = (include $file);
     if (false === is_array($data)) {
         throw TypeErrorFactory::createForInvalidFixtureFileReturnedData($file);
     }
     return $data;
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForFileCouldNotBeFound