Skip to content

Enum valdiation wrong on master #129

@LukasGoTom

Description

@LukasGoTom

I am still getting this code generated:

   protected function validateAdvertiserIndustry($value, array $modelData)
    {
        if ($value instanceof UnitEnum && !($value instanceof AdvertiserIndustry)) {
            $this->errorRegistry->addError(new \PHPModelGenerator\Exception\Generic\InvalidTypeException($value ?? null, ... [
                0 => 'advertiser_industry',
                1 => 'AdvertiserIndustry',
            ]));
        }

        if (!is_string($value)) {
            $this->errorRegistry->addError(new \PHPModelGenerator\Exception\Generic\InvalidTypeException($value ?? null, ... [
                0 => 'advertiser_industry',
                1 => 'string',
            ]));
        }

so if I hand in valid Enum AdvertiserIndustry, the first check passes. The second check fails because the enum is not a string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions