public function &dget($key, $default = null)
    {
        $args = WF::flatten_array(func_get_args());
        if (func_num_args() > 1)
        {
            $default = array_pop($args);
            if (!($default instanceof DefVal))
                $default = new DefVal($default);
            $args[] = $default;
        }

        // Get the value, without referencing, so that we actually return a copy
        $result = parent::dget($args, null);

        if ($result instanceof Dictionary)
        {
            // Sub-arrays are returned as dictionary - which allow
            // modification without type checking. Re-wrap into
            // a TypedDictionary including the correct types
            $path = $args;
            $types = $this->types->dget($path);
            
            if (WF::is_array_like($types))
            {
                $dict = new TypedDictionary($types);
                $dict->values = &$result->values;
                $result = $dict;
            }
        }

        // Return the copy to keep it unmodifiable
        return $result;
    }
public function &dget($key, $default = null)
    {
        $args = WF::flatten_array(func_get_args());
        if (func_num_args() > 1)
        {
            $default = array_pop($args);
            if (!($default instanceof DefVal))
                $default = new DefVal($default);
            $args[] = $default;
        }

        // Get the value, without referencing, so that we actually return a copy
        $result = parent::dget($args, null);

        if ($result instanceof Dictionary)
        {
            // Sub-arrays are returned as dictionary - which allow
            // modification without type checking. Re-wrap into
            // a TypedDictionary including the correct types
            $path = $args;
            $types = $this->types->dget($path);
            
            if (WF::is_array_like($types))
            {
                $dict = new TypedDictionary($types);
                $dict->values = &$result->values;
                $result = $dict;
            }
        }

        // Return the copy to keep it unmodifiable
        return $result;
    }
public function & dget ( $ key , $ default = null ) { $ args = WF :: flatten_array ( func_get_args ( ) ) ; if ( func_num_args ( ) > 1 ) { $ default = array_pop ( $ args ) ; if ( ! ( $ default instanceof DefVal ) ) $ default = new DefVal ( $ default ) ; $ args [ ] = $ default ; } // Get the value, without referencing, so that we actually return a copy $ result = parent :: dget ( $ args , null ) ; if ( $ result instanceof Dictionary ) { // Sub-arrays are returned as dictionary - which allow // modification without type checking. Re-wrap into // a TypedDictionary including the correct types $ path = $ args ; $ types = $ this -> types -> dget ( $ path ) ; if ( WF :: is_array_like ( $ types ) ) { $ dict = new TypedDictionary ( $ types ) ; $ dict -> values = & $ result -> values ; $ result = $ dict ; } } // Return the copy to keep it unmodifiable return $ result ; }
We override dget as dget returns a reference, allowing the
TypedDictionary to be modified from the outside. This avoids the checks,
so this needs to be disallowed.

@param string $key The key to set. Can be repeated to go deeper
@param mixed $default A default value to return in absence
We override dget as dget returns a reference allowing the TypedDictionary to be modified from the outside . This avoids the checks so this needs to be disallowed .