Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return true if the given function has been defined
<?php function_exists(string $function): bool
<?php public function dump(mixed ...$arguments): self
{
if (function_exists('dump')) {
dump($this->value, ...$arguments);
} else {
var_dump($this->value);
<?php public function dd(mixed ...$arguments): void
{
if (function_exists('dd')) {
dd($this->value, ...$arguments);
}
<?php public function ray(mixed ...$arguments): self
{
if (function_exists('ray')) {
ray($this->value, ...$arguments);
}
<?php use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
if (! function_exists('expect')) {
<?php }
}
if (! function_exists('beforeAll')) {
<?php }
}
if (! function_exists('beforeEach')) {
<?php }
}
if (! function_exists('dataset')) {
<?php }
}
if (! function_exists('describe')) {
<?php }
}
if (! function_exists('uses')) {
<?php }
}
if (! function_exists('test')) {
<?php }
}
if (! function_exists('it')) {
<?php }
}
if (! function_exists('todo')) {
<?php }
}
if (! function_exists('afterEach')) {
<?php }
}
if (! function_exists('afterAll')) {
<?php {
foreach ($classesOrFunctions as $classOrFunction) {
$isClass = class_exists($classOrFunction) || trait_exists($classOrFunction);
$isMethod = function_exists($classOrFunction);
if (! $isClass && ! $isMethod) {
throw new InvalidArgumentException(sprintf('No class or method named "%s" has been found.', $classOrFunction));