enum_exists

Supported Versions: PHP 8 >= 8.1.0
Checks if the enum has been defined
<?php enum_exists(string $enum, bool $autoload = true): bool
<?php             return $target->setRelation($key, $value);

        }



        if (array_key_exists($key, $target->getCasts()) && enum_exists($target->getCasts()[$key]) && $value === '') {

            $value = null;

        }
<?php             return false;

        }



        return enum_exists($castType);

    }
<?php     public function enum($key, $enumClass)

    {

        if ($this->isNotFilled($key) ||

            ! enum_exists($enumClass) ||

            ! method_exists($enumClass, 'tryFrom')) {

            return null;

        }
<?php             return false;

        }



        if (enum_exists($backedEnumClass)) {

            $reflectionBackedEnum = new ReflectionEnum($backedEnumClass);



            return $reflectionBackedEnum->isBacked()
<?php             return $this->isDesirable($value);

        }



        if (is_null($value) || ! enum_exists($this->type) || ! method_exists($this->type, 'tryFrom')) {

            return false;

        }
<?php     {

        return Targeted::make(

            $this,

            fn (ObjectDescription $object): bool => ! enum_exists($object->name) && $object->reflectionClass->isFinal(),

            'to be final',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),

        );
<?php     {

        return Targeted::make(

            $this,

            fn (ObjectDescription $object): bool => ! enum_exists($object->name) && $object->reflectionClass->isReadOnly() && assert(true), // @phpstan-ignore-line

            'to be readonly',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),

        );
<?php     {

        return Targeted::make(

            $this,

            fn (ObjectDescription $object): bool => class_exists($object->name) && ! enum_exists($object->name),

            'to be class',

            FileLineFinder::where(fn (string $line): bool => true),

        );
<?php     {

        return Targeted::make(

            $this->original,

            fn (ObjectDescription $object): bool => ! enum_exists($object->name) && ! $object->reflectionClass->isFinal(),

            'not to be final',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),

        );
<?php     {

        return Targeted::make(

            $this->original,

            fn (ObjectDescription $object): bool => ! enum_exists($object->name) && ! $object->reflectionClass->isReadOnly() && assert(true), // @phpstan-ignore-line

            'not to be readonly',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),

        );