src/Type/Definition/ObjectType.php
public function assertValid()
    {
        parent::assertValid();

        Utils::invariant(
            $this->description === null || is_string($this->description),
            sprintf(
                '%s description must be string if set, but it is: %s',
                $this->name,
                Utils::printSafe($this->description)
            )
        );

        $isTypeOf = $this->config['isTypeOf'] ?? null;

        Utils::invariant(
            $isTypeOf === null || is_callable($isTypeOf),
            sprintf('%s must provide "isTypeOf" as a function, but got: %s', $this->name, Utils::printSafe($isTypeOf))
        );

        foreach ($this->getFields() as $field) {
            $field->assertValid($this);
        }
    }
public function assertValid()
    {
        parent::assertValid();

        Utils::invariant(
            $this->description === null || is_string($this->description),
            sprintf(
                '%s description must be string if set, but it is: %s',
                $this->name,
                Utils::printSafe($this->description)
            )
        );

        $isTypeOf = $this->config['isTypeOf'] ?? null;

        Utils::invariant(
            $isTypeOf === null || is_callable($isTypeOf),
            sprintf('%s must provide "isTypeOf" as a function, but got: %s', $this->name, Utils::printSafe($isTypeOf))
        );

        foreach ($this->getFields() as $field) {
            $field->assertValid($this);
        }
    }
public function assertValid ( ) { parent :: assertValid ( ) ; Utils :: invariant ( $ this -> description === null || is_string ( $ this -> description ) , sprintf ( '%s description must be string if set, but it is: %s' , $ this -> name , Utils :: printSafe ( $ this -> description ) ) ) ; $ isTypeOf = $ this -> config [ 'isTypeOf' ] ?? null ; Utils :: invariant ( $ isTypeOf === null || is_callable ( $ isTypeOf ) , sprintf ( '%s must provide "isTypeOf" as a function, but got: %s' , $ this -> name , Utils :: printSafe ( $ isTypeOf ) ) ) ; foreach ( $ this -> getFields ( ) as $ field ) { $ field -> assertValid ( $ this ) ; } }
Validates type config and throws if one of type options is invalid.
Note: this method is shallow, it won't validate object fields and their arguments.

@throws InvariantViolation
Validates type config and throws if one of type options is invalid . Note : this method is shallow it won t validate object fields and their arguments .