protected function pickArrayForScalar(): self
    {
        if (
            count($this->types) < 2 ||
            (!is_scalar($this->value) && (!is_object($this->value) || get_class($this->value) === stdClass::class))
        ) {
            return $this;
        }

        if (in_array('array', $this->types)) {
            $types = array_filter($this->types, function($type) {
                return substr($type, -2) !== '[]';
            });

            return $this->setTypes($types);
        }

        $subtypes = $this->getSubTypes();
        if (count($subtypes) !== count($this->types)) {
            return $this;
        }

        $type = $this->guess($this->value, $subtypes);

        return $type ? $this->setTypes([$type . '[]']) : $this;
    }
protected function pickArrayForScalar(): self
    {
        if (
            count($this->types) < 2 ||
            (!is_scalar($this->value) && (!is_object($this->value) || get_class($this->value) === stdClass::class))
        ) {
            return $this;
        }

        if (in_array('array', $this->types)) {
            $types = array_filter($this->types, function($type) {
                return substr($type, -2) !== '[]';
            });

            return $this->setTypes($types);
        }

        $subtypes = $this->getSubTypes();
        if (count($subtypes) !== count($this->types)) {
            return $this;
        }

        $type = $this->guess($this->value, $subtypes);

        return $type ? $this->setTypes([$type . '[]']) : $this;
    }
protected function pickArrayForScalar ( ) : self { if ( count ( $ this -> types ) < 2 || ( ! is_scalar ( $ this -> value ) && ( ! is_object ( $ this -> value ) || get_class ( $ this -> value ) === stdClass :: class ) ) ) { return $ this ; } if ( in_array ( 'array' , $ this -> types ) ) { $ types = array_filter ( $ this -> types , function ( $ type ) { return substr ( $ type , - 2 ) !== '[]' ; } ) ; return $ this -> setTypes ( $ types ) ; } $ subtypes = $ this -> getSubTypes ( ) ; if ( count ( $ subtypes ) !== count ( $ this -> types ) ) { return $ this ; } $ type = $ this -> guess ( $ this -> value , $ subtypes ) ; return $ type ? $ this -> setTypes ( [ $ type . '[]' ] ) : $ this ; }
If all types are arrays and the value is not, guess an array type.

@return TypeGuess
If all types are arrays and the value is not guess an array type .