Release: v0.10.0

Published

Support for fluid configuration

Added support for fluid configuration in phel-config.php

<?php
# Instead of a raw array...
return [
    'src-dirs' => ['some/directory'],
    'test-dirs' => ['another/directory'],
    'vendor-dir' => 'vendor',
    'out-dir' => 'out',
    'export' => [
        'target-directory' => 'src/Generated',
        'directories' => ['some/other/dir'],
        'namespace-prefix' => 'Generated',
    ],
    'ignore-when-building' => ['src/ignore.me'],
    'keep-generated-temp-files' => true,
    'format-dirs' => ['src', 'tests'],
];

# ...you can now use a fluent object interface
return (new PhelConfig())
    ->setSrcDirs(['some/directory'])
    ->setTestDirs(['another/directory'])
    ->setVendorDir('vendor')
    ->setOutDir('out')
    ->setExport((new PhelExportConfig())
        ->setDirectories(['some/other/dir'])
        ->setNamespacePrefix('Generated')
        ->setTargetDirectory('src/Generated'))
    ->setIgnoreWhenBuilding(['src/ignore.me'])
    ->setKeepGeneratedTempFiles(true)
    ->setFormatDirs(['src', 'tests']);

Both examples above produce the same outcome.

Default format paths

You can now define default directories to apply when using the phel format command without arguments.

vendor/bin/phel format -h
Description:
  Formats the given files.

Usage:
  format [<paths>...]

Arguments:
  paths     The file paths that you want to format. [default: ["src","tests"]]

You can define these dirs in your phel-config.php: PhelConfig::setFormatDirs(['src',...])

Added --testdox to the test command

Added --testdox option to phel test command. Inspired by PHPUnit, in phel you will see the test name plus the assertion description instead of a dot.

Without --testdox:

php phel test --filter test-json-encode-flag
..

With --testdox:

phel-lang/ (master) $ php phel test --filter test-json-encode-flag --testdox                           
 test-json-encode-flag: It tests flags parameter with one flag.
 test-json-encode-flags: It tests flags parameter with two flags.

Other improvements

  • Enable gacela cache filesystem by default
  • Deprecate compile-mode in favor of build-mode
  • Fix php/apush, php/aset and php/aunset for global php arrays

Full list

For a full list of changes have a look at the Changelog.