Supported Versions: PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8
Checks if the given key or index exists in the array
<?php array_key_exists(string|int|float|bool|resource|null $key, array $array): bool
<?php public static function hasExtend(string $name): bool
{
return array_key_exists($name, static::$extends);
}
}
<?php throw new TestDescriptionMissing($method->filename);
}
if (array_key_exists($method->description, $this->methods)) {
throw new TestAlreadyExist($method->filename, $method->description);
}
<?php ]);
foreach ($options as $option) {
if (! array_key_exists('arg', $option)) {
continue;
}
<?php public function handleArguments(array $arguments): array
{
if (! array_key_exists(1, $arguments)) {
return $arguments;
}
if ($arguments[1] !== self::INIT_OPTION) {
<?php $placesToCheck = [$_SERVER, $_ENV];
foreach ($placesToCheck as $location) {
if (array_key_exists(self::GLOBAL_PREFIX.$key, $location)) {
return json_decode((string) $location[self::GLOBAL_PREFIX.$key], true, 512, JSON_THROW_ON_ERROR)['value'] ?? null;
}
<?php public function handleArguments(array $arguments): array
{
if (! array_key_exists('COLLISION_PRINTER', $_SERVER)) {
return $arguments;
}
<?php {
$filename = Reflection::getFileNameFromClosure($closure);
if (array_key_exists($filename, $this->state)) {
throw new AfterAllAlreadyExist($filename);
}
<?php public function set(string $filename, AfterEachCall $afterEachCall, Closure $afterEachTestCase): void
{
if (array_key_exists($filename, $this->state)) {
$fromAfterEachTestCase = $this->state[$filename];
$afterEachTestCase = ChainableClosure::bound($fromAfterEachTestCase, $afterEachTestCase)
<?php {
$filename = Reflection::getFileNameFromClosure($closure);
if (array_key_exists($filename, $this->state)) {
throw new BeforeAllAlreadyExist($filename);
}
<?php public function set(string $filename, BeforeEachCall $beforeEachCall, Closure $beforeEachTestCall, Closure $beforeEachTestCase): void
{
if (array_key_exists($filename, $this->state)) {
[$fromBeforeEachTestCall, $fromBeforeEachTestCase] = $this->state[$filename];
$beforeEachTestCall = ChainableClosure::unbound($fromBeforeEachTestCall, $beforeEachTestCall);
<?php {
$datasetKey = "$scope".self::SEPARATOR."$name";
if (array_key_exists("$datasetKey", self::$datasets)) {
throw new DatasetAlreadyExists($name, $scope);
}
<?php public static function has(string $filename, string $description): bool
{
return array_key_exists($filename.self::SEPARATOR.$description, self::$withs);
}
<?php $hooks = array_map(fn (Closure $hook): array => [$hook], $hooks);
foreach ($paths as $path) {
if (array_key_exists($path, $this->uses)) {
$this->uses[$path] = [
[...$this->uses[$path][0], ...$classOrTraits],
[...$this->uses[$path][1], ...$groups],
<?php }
}
if (! array_key_exists($method->filename, $this->testCases)) {
$this->testCases[$method->filename] = new TestCaseFactory($method->filename);
}
<?php public function makeIfNeeded(string $filename): void
{
if (! array_key_exists($filename, $this->testCases)) {
return;
}