ResourceUtil.php
public static function validateObjectResource($object, $requireClass, $i, $allowForm = true): void
    {
        if ($allowForm && $object instanceof FormInterface) {
            $object = $object->getData();
        }

        if (!\is_object($object) || !$object instanceof $requireClass) {
            throw new UnexpectedTypeException($object, $requireClass, $i);
        }
    }
public static function validateObjectResource($object, $requireClass, $i, $allowForm = true): void
    {
        if ($allowForm && $object instanceof FormInterface) {
            $object = $object->getData();
        }

        if (!\is_object($object) || !$object instanceof $requireClass) {
            throw new UnexpectedTypeException($object, $requireClass, $i);
        }
    }
public static function validateObjectResource ( $ object , $ requireClass , $ i , $ allowForm = true ) : void { if ( $ allowForm && $ object instanceof FormInterface ) { $ object = $ object -> getData ( ) ; } if ( ! \ is_object ( $ object ) || ! $ object instanceof $ requireClass ) { throw new UnexpectedTypeException ( $ object , $ requireClass , $ i ) ; } }
Validate the resource object.

@param FormInterface|mixed $object       The resource object or form of resource object
@param string              $requireClass The required class
@param int                 $i            The position of the object in the list
@param bool                $allowForm    Check if the form is allowed

@throws UnexpectedTypeException  When the object parameter is not an object or a form instance
@throws InvalidResourceException When the object in form is not an object
@throws InvalidResourceException When the object instance is not an instance of the required class
Validate the resource object .