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 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')),

        );