Custom nav walker: How to acces the $args parameter?

WordPress Walkers aren’t using constructors. They are started up with walk() method which is passed arguments as third argument (confusingly not reflected in method signature).

You can capture it into your object’s property with something like this:

class Args_Walker extends Walker {

    public function walk( $elements, $max_depth ) {

        // we could declare above, but would get incompatible signature
        $args = func_get_arg(2);

        $this->args = $args;

        return parent::walk( $elements, $max_depth, $args );
    }
}