Skip to content

Adds Optional Arguments via Constructor to Assist DI

Choose a tag to compare

@donatj donatj released this 26 Aug 17:22
· 32 commits to master since this release
3217c95

Adds a constructor with optional $args and $skipFirstArgument to make working with DI easier. These values when provided will now be used as the defaults calling parse unless arguments are passed to parse.

No changes to existing code should be necessary.

function __construct([ $args = null [, $skipFirstArgument = true]])

VERY MINOR BC CHANGES

  • Not passing a value now defaults to $_SERVER['argv'] rather than $GLOBALS['argv']
  • $_SERVER['argv'] is now evaluated at construct time rather than parse time.