Minor CS changes.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* @group lambdas
|
||||
* @group functional
|
||||
*/
|
||||
class Mustache_Test_FiveThree_Functional_ClosuresQuirksTest extends PHPUnit_Framework_TestCase
|
||||
class Mustache_Test_FiveThree_Functional_ClosureQuirksTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $mustache;
|
||||
|
||||
@@ -25,6 +25,6 @@ class Mustache_Test_FiveThree_Functional_ClosuresQuirksTest extends PHPUnit_Fram
|
||||
public function testClosuresDontLikeItWhenYouTouchTheirProperties()
|
||||
{
|
||||
$tpl = $this->mustache->loadTemplate('{{ foo.bar }}');
|
||||
$this->assertEquals('', $tpl->render(array('foo' => function() { return 'FOO'; })));
|
||||
$this->assertEquals('', $tpl->render(array('foo' => function () { return 'FOO'; })));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
||||
{
|
||||
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{ date | longdate }}');
|
||||
|
||||
$this->mustache->addHelper('longdate', function(\DateTime $value) {
|
||||
$this->mustache->addHelper('longdate', function (\DateTime $value) {
|
||||
return $value->format('Y-m-d h:m:s');
|
||||
});
|
||||
|
||||
@@ -41,11 +41,11 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
||||
{
|
||||
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{ date | longdate | withbrackets }}');
|
||||
|
||||
$this->mustache->addHelper('longdate', function(\DateTime $value) {
|
||||
$this->mustache->addHelper('longdate', function (\DateTime $value) {
|
||||
return $value->format('Y-m-d h:m:s');
|
||||
});
|
||||
|
||||
$this->mustache->addHelper('withbrackets', function($value) {
|
||||
$this->mustache->addHelper('withbrackets', function ($value) {
|
||||
return sprintf('[[%s]]', $value);
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
||||
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{ foo | bar }}');
|
||||
$this->assertEquals('win!', $tpl->render(array(
|
||||
'foo' => 'FOO',
|
||||
'bar' => function($value) {
|
||||
'bar' => function ($value) {
|
||||
return ($value === 'FOO') ? 'win!' : 'fail :(';
|
||||
},
|
||||
)));
|
||||
@@ -84,11 +84,11 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
|
||||
array('foo | bar', array('foo' => 'FOO')),
|
||||
array('foo | bar', array('foo' => 'FOO', 'bar' => 'BAR')),
|
||||
array('foo | bar', array('foo' => 'FOO', 'bar' => array(1, 2))),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'bar' => function() { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('bar' => function() { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar.baz', array('foo' => 'FOO', 'bar' => function() { return 'BAR'; }, 'baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'baz' => function () { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('bar' => function () { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('baz' => function () { return 'BAZ'; })),
|
||||
array('foo | bar.baz', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; }, 'baz' => function () { return 'BAZ'; })),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
|
||||
|
||||
$foo = new Mustache_Test_FiveThree_Functional_Foo;
|
||||
$foo->name = 'Mario';
|
||||
$foo->wrapper = function($text) {
|
||||
$foo->wrapper = function ($text) {
|
||||
return sprintf('<div class="anonymous">%s</div>', $text);
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
|
||||
|
||||
$data = array(
|
||||
'name' => 'Bob',
|
||||
'wrap' => function($text) {
|
||||
'wrap' => function ($text) {
|
||||
return sprintf('[[%s]]', $text);
|
||||
}
|
||||
);
|
||||
@@ -70,7 +70,7 @@ class Mustache_Test_FiveThree_Functional_Foo
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->wrap = function($text) {
|
||||
$this->wrap = function ($text) {
|
||||
return sprintf('<em>%s</em>', $text);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class Mustache_Test_FiveThree_Functional_LambdaHelperTest extends PHPUnit_Framew
|
||||
|
||||
$foo = new StdClass;
|
||||
$foo->name = 'Mario';
|
||||
$foo->lambda = function($text, $mustache) {
|
||||
$foo->lambda = function ($text, $mustache) {
|
||||
return strtoupper($mustache->render($text));
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends Mustache_Test_
|
||||
}
|
||||
|
||||
$func = $val['php'];
|
||||
$data[$key] = function($text = null) use ($func) {
|
||||
$data[$key] = function ($text = null) use ($func) {
|
||||
return eval($func);
|
||||
};
|
||||
} elseif (is_array($val)) {
|
||||
|
||||
@@ -51,7 +51,7 @@ class Mustache_Test_Functional_ClassWithLambda
|
||||
{
|
||||
public function _t()
|
||||
{
|
||||
return function($val) {
|
||||
return function ($val) {
|
||||
return strtoupper($val);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class Mustache_Test_FiveThree_Functional_SectionFiltersTest extends PHPUnit_Fram
|
||||
{
|
||||
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{# word | echo }}{{ . }}!{{/ word | echo }}');
|
||||
|
||||
$this->mustache->addHelper('echo', function($value) {
|
||||
$this->mustache->addHelper('echo', function ($value) {
|
||||
return array($value, $value, $value);
|
||||
});
|
||||
|
||||
@@ -45,12 +45,12 @@ EOS;
|
||||
{
|
||||
$tpl = $this->mustache->loadTemplate(self::CHAINED_FILTERS_TPL);
|
||||
|
||||
$this->mustache->addHelper('echo', function($value) {
|
||||
$this->mustache->addHelper('echo', function ($value) {
|
||||
return array($value, $value, $value);
|
||||
});
|
||||
|
||||
$this->mustache->addHelper('with_index', function($value) {
|
||||
return array_map(function($k, $v) {
|
||||
$this->mustache->addHelper('with_index', function ($value) {
|
||||
return array_map(function ($k, $v) {
|
||||
return array(
|
||||
'key' => $k,
|
||||
'value' => $v,
|
||||
@@ -66,7 +66,7 @@ EOS;
|
||||
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}');
|
||||
$this->assertEquals('win!', $tpl->render(array(
|
||||
'foo' => 'FOO',
|
||||
'bar' => function($value) {
|
||||
'bar' => function ($value) {
|
||||
return ($value === 'FOO') ? 'win!' : 'fail :(';
|
||||
},
|
||||
)));
|
||||
@@ -90,11 +90,11 @@ EOS;
|
||||
array('foo | bar', array('foo' => 'FOO')),
|
||||
array('foo | bar', array('foo' => 'FOO', 'bar' => 'BAR')),
|
||||
array('foo | bar', array('foo' => 'FOO', 'bar' => array(1, 2))),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'bar' => function() { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('bar' => function() { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar.baz', array('foo' => 'FOO', 'bar' => function() { return 'BAR'; }, 'baz' => function() { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('foo' => 'FOO', 'baz' => function () { return 'BAZ'; })),
|
||||
array('foo | bar | baz', array('bar' => function () { return 'BAR'; })),
|
||||
array('foo | bar | baz', array('baz' => function () { return 'BAZ'; })),
|
||||
array('foo | bar.baz', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; }, 'baz' => function () { return 'BAZ'; })),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
|
||||
|
||||
public function callables()
|
||||
{
|
||||
$lambda = function($tpl, $mustache) {
|
||||
$lambda = function ($tpl, $mustache) {
|
||||
return strtoupper($mustache->render($tpl));
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
|
||||
'YOSHI',
|
||||
),
|
||||
array(
|
||||
function() { return 'Yoshi'; },
|
||||
function () { return 'Yoshi'; },
|
||||
$lambda,
|
||||
'YOSHI',
|
||||
),
|
||||
@@ -91,14 +91,14 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
|
||||
|
||||
public function strictCallables()
|
||||
{
|
||||
$lambda = function($tpl, $mustache) {
|
||||
$lambda = function ($tpl, $mustache) {
|
||||
return strtoupper($mustache->render($tpl));
|
||||
};
|
||||
|
||||
return array(
|
||||
// Interpolation lambdas
|
||||
array(
|
||||
function() { return 'Yoshi'; },
|
||||
function () { return 'Yoshi'; },
|
||||
$lambda,
|
||||
'YOSHI',
|
||||
),
|
||||
@@ -116,7 +116,7 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
|
||||
),
|
||||
array(
|
||||
'Yoshi',
|
||||
function($tpl, $mustache) {
|
||||
function ($tpl, $mustache) {
|
||||
return strtoupper($mustache->render($tpl));
|
||||
},
|
||||
'YOSHI',
|
||||
|
||||
Reference in New Issue
Block a user