Skip to content

Commit

Permalink
Using stable Yay + added another test for anonymous functions
Browse files Browse the repository at this point in the history
  • Loading branch information
assertchris committed Mar 25, 2017
1 parent cb2e170 commit 6db14ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "pre/parameter-loaders",
"license": "MIT",
"require": {
"php": "^7.0",
"pre/plugin": "^0.5"
"pre/plugin": "^0.6.1"
},
"autoload": {
"files": [
Expand All @@ -17,7 +16,5 @@
"psr-4": {
"Pre\\ParameterLoaders\\": "tests"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
4 changes: 2 additions & 2 deletions src/macros.pre
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
macro {
·chain(
function,
·token(T_STRING)·function,
·optional(·token(T_STRING))·function,
·between(
·token("("),
·optional(
Expand All @@ -15,7 +15,7 @@ macro {
·token("="),
·chain(
·optional(·token(T_NEW))·enhanced_new,
·midrule(function ($stream) {
·midrule(function($stream) {
$index = $stream->index();

if (in_array(strtolower($stream->current()), ["true", "false", "null"])) {
Expand Down
12 changes: 12 additions & 0 deletions tests/specs/parameter-loaders.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class Fixture
}
}

$anon = function($a = true, $b = "hello", $c = ucwords("world")) {
print $b . " " . $c;
};

--EXPECT--

class Fixture
Expand Down Expand Up @@ -81,3 +85,11 @@ class Fixture
return "working";
}
}

$anon = function ($a =true, $b ="hello", $c = null) {
if (is_null($c)) {
$c = ucwords("world");
}

print $b . " " . $c;
};

0 comments on commit 6db14ff

Please sign in to comment.