Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Assert.php

function Assert::fileExists

Same name in this branch
  1. 11.1.x vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit\Framework\Assert::fileExists()

Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.

Parameters

mixed $value:

string $message:

Throws

InvalidArgumentException

2 calls to Assert::fileExists()
Assert::directory in vendor/webmozart/assert/src/Assert.php
Assert::file in vendor/webmozart/assert/src/Assert.php

File

vendor/webmozart/assert/src/Assert.php, line 1427

Class

Assert
Efficient assertions to validate the input/output of your methods.

Namespace

Webmozart\Assert

Code

public static function fileExists($value, $message = '') {
    static::string($value);
    if (!\file_exists($value)) {
        static::reportInvalidArgument(\sprintf($message ?: 'The file %s does not exist.', static::valueToString($value)));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal