private function replaceStaticType(array $types, string $staticType): array
    {
        $mixins = array_merge(
            [Model::class],
            $this->mixins->getMixinsFromClass($this->broker, $this->broker->getClass(Model::class))
        );

        foreach ($types as $key => $type) {
            if ($type instanceof ObjectType && in_array($type->getClassName(), $mixins, true)) {
                $types[$key] = new StaticType($staticType);
            }

            if ($type instanceof StaticType) {
                $types[$key] = new StaticType($staticType);
            }

            if ($type instanceof IterableType) {
                $types[$key] = $type->changeBaseClass($staticType);
            }

            if ($type instanceof IntersectionType) {
                $types[$key] = new IntersectionType($this->replaceStaticType($type->getTypes(), $staticType));
            }
        }

        return $types;
    }
private function replaceStaticType(array $types, string $staticType): array
    {
        $mixins = array_merge(
            [Model::class],
            $this->mixins->getMixinsFromClass($this->broker, $this->broker->getClass(Model::class))
        );

        foreach ($types as $key => $type) {
            if ($type instanceof ObjectType && in_array($type->getClassName(), $mixins, true)) {
                $types[$key] = new StaticType($staticType);
            }

            if ($type instanceof StaticType) {
                $types[$key] = new StaticType($staticType);
            }

            if ($type instanceof IterableType) {
                $types[$key] = $type->changeBaseClass($staticType);
            }

            if ($type instanceof IntersectionType) {
                $types[$key] = new IntersectionType($this->replaceStaticType($type->getTypes(), $staticType));
            }
        }

        return $types;
    }
private function replaceStaticType ( array $ types , string $ staticType ) : array { $ mixins = array_merge ( [ Model :: class ] , $ this -> mixins -> getMixinsFromClass ( $ this -> broker , $ this -> broker -> getClass ( Model :: class ) ) ) ; foreach ( $ types as $ key => $ type ) { if ( $ type instanceof ObjectType && in_array ( $ type -> getClassName ( ) , $ mixins , true ) ) { $ types [ $ key ] = new StaticType ( $ staticType ) ; } if ( $ type instanceof StaticType ) { $ types [ $ key ] = new StaticType ( $ staticType ) ; } if ( $ type instanceof IterableType ) { $ types [ $ key ] = $ type -> changeBaseClass ( $ staticType ) ; } if ( $ type instanceof IntersectionType ) { $ types [ $ key ] = new IntersectionType ( $ this -> replaceStaticType ( $ type -> getTypes ( ) , $ staticType ) ) ; } } return $ types ; }
Replaces Static Types by the provided Static Type.

@param  array $types
@param  string $staticType
@return array
Replaces Static Types by the provided Static Type .