Skip to content

Incorrect usage example in advanced documentation

Created by: bravo-kernel

First of all... great library.

Too bad I just had to spent two hours trying to get the advanced example with member access on instantiation working.

$getopt = new Getopt(array(
    new Option('o', 'option', Getopt::REQUIRED_ARGUMENT)
        ->setDescription('Description of option')
        ->setDefaultValue('default')
));

I believe the second line should be:

$getopt = new Getopt(array(
    (new Option('o', 'option', Getopt::REQUIRED_ARGUMENT))
        ->setDescription('Description of option')
        ->setDefaultValue('default')
));

HTH