Skip to content

Improved parameter definitions and dump() operator

Compare
Choose a tag to compare
@am0s am0s released this 21 Feb 11:09
· 8 commits to master since this release

Parameters may now be defined with array structures.

This allows for better definitions of the default value and can support more definitions in the future.
It is still possible to use the old syntax with only a string.

The following array entries exists:

  • name - The name of the parameter, must exist
  • default - Default value for parameter if not passed, may be ommitted to make parameter required.
  • type - Enforce a type, use "mixed" or null to allow any value. Type value must match gettype() values. If unset and a default value exists it will be set to the default value type

e.g.

    function __construct()
    {
        parent::__construct('dump',
            ['name' => 'value', 'default' => null]
        );
    }

Added a new template operator dump() which replaces the builtin one.
This will use Symfony var dumper (if available) to dump the contents and place it in the template output.