From c858bb1f1a8b1dec531a7ffa5716c8460df40f1c Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Tue, 23 Feb 2016 07:49:22 +0000 Subject: [PATCH 01/15] Add exception chaining --- src/Mustache/Exception/SyntaxException.php | 13 +++++++++---- src/Mustache/Exception/UnknownFilterException.php | 12 +++++++++--- src/Mustache/Exception/UnknownHelperException.php | 12 +++++++++--- src/Mustache/Exception/UnknownTemplateException.php | 12 +++++++++--- .../Mustache/Test/Exception/SyntaxExceptionTest.php | 12 ++++++++++++ .../Test/Exception/UnknownFilterExceptionTest.php | 12 ++++++++++++ .../Test/Exception/UnknownHelperExceptionTest.php | 11 +++++++++++ .../Test/Exception/UnknownTemplateExceptionTest.php | 11 +++++++++++ 8 files changed, 82 insertions(+), 13 deletions(-) diff --git a/src/Mustache/Exception/SyntaxException.php b/src/Mustache/Exception/SyntaxException.php index ab4d6aa..5475ed5 100644 --- a/src/Mustache/Exception/SyntaxException.php +++ b/src/Mustache/Exception/SyntaxException.php @@ -17,13 +17,18 @@ class Mustache_Exception_SyntaxException extends LogicException implements Musta protected $token; /** - * @param string $msg - * @param array $token + * @param string $msg + * @param array $token + * @param Exception $previous */ - public function __construct($msg, array $token) + public function __construct($msg, array $token, Exception $previous = null) { $this->token = $token; - parent::__construct($msg); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($msg, 0, $previous); + } else { + parent::__construct($msg); + } } /** diff --git a/src/Mustache/Exception/UnknownFilterException.php b/src/Mustache/Exception/UnknownFilterException.php index 43d2c06..f0a7012 100644 --- a/src/Mustache/Exception/UnknownFilterException.php +++ b/src/Mustache/Exception/UnknownFilterException.php @@ -17,12 +17,18 @@ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException protected $filterName; /** - * @param string $filterName + * @param string $filterName + * @param Exception $previous */ - public function __construct($filterName) + public function __construct($filterName, Exception $previous = null) { $this->filterName = $filterName; - parent::__construct(sprintf('Unknown filter: %s', $filterName)); + $message = sprintf('Unknown filter: %s', $filterName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); + } } public function getFilterName() diff --git a/src/Mustache/Exception/UnknownHelperException.php b/src/Mustache/Exception/UnknownHelperException.php index 7fe4a71..9d8c2c4 100644 --- a/src/Mustache/Exception/UnknownHelperException.php +++ b/src/Mustache/Exception/UnknownHelperException.php @@ -17,12 +17,18 @@ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException protected $helperName; /** - * @param string $helperName + * @param string $helperName + * @param Exception $previous */ - public function __construct($helperName) + public function __construct($helperName, Exception $previous = null) { $this->helperName = $helperName; - parent::__construct(sprintf('Unknown helper: %s', $helperName)); + $message = sprintf('Unknown helper: %s', $helperName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); + } } public function getHelperName() diff --git a/src/Mustache/Exception/UnknownTemplateException.php b/src/Mustache/Exception/UnknownTemplateException.php index f1f69bf..bfd945b 100644 --- a/src/Mustache/Exception/UnknownTemplateException.php +++ b/src/Mustache/Exception/UnknownTemplateException.php @@ -17,12 +17,18 @@ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentExcepti protected $templateName; /** - * @param string $templateName + * @param string $templateName + * @param Exception $previous */ - public function __construct($templateName) + public function __construct($templateName, Exception $previous = null) { $this->templateName = $templateName; - parent::__construct(sprintf('Unknown template: %s', $templateName)); + $message = sprintf('Unknown template: %s', $templateName); + if (version_compare(PHP_VERSION, '5.3.0', '>=')) { + parent::__construct($message, 0, $previous); + } else { + parent::__construct($message); + } } public function getTemplateName() diff --git a/test/Mustache/Test/Exception/SyntaxExceptionTest.php b/test/Mustache/Test/Exception/SyntaxExceptionTest.php index fe85bef..e87b7d5 100644 --- a/test/Mustache/Test/Exception/SyntaxExceptionTest.php +++ b/test/Mustache/Test/Exception/SyntaxExceptionTest.php @@ -24,4 +24,16 @@ class Mustache_Test_Exception_SyntaxExceptionTest extends PHPUnit_Framework_Test $e = new Mustache_Exception_SyntaxException('ignore this', $token); $this->assertEquals($token, $e->getToken()); } + + public function testPrevious() + { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + $this->markTestSkipped('Exception chaining requires at least PHP 5.3'); + } + + $previous = new Exception(); + $e = new Mustache_Exception_SyntaxException('foo', array(), $previous); + + $this->assertSame($previous, $e->getPrevious()); + } } diff --git a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php index e5fe263..b31dcbb 100644 --- a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php @@ -29,4 +29,16 @@ class Mustache_Test_Exception_UnknownFilterExceptionTest extends PHPUnit_Framewo $e = new Mustache_Exception_UnknownFilterException('eggs'); $this->assertEquals('eggs', $e->getFilterName()); } + + public function testPrevious() + { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + $this->markTestSkipped('Exception chaining requires at least PHP 5.3'); + } + + $previous = new Exception(); + $e = new Mustache_Exception_UnknownFilterException('foo', $previous); + + $this->assertSame($previous, $e->getPrevious()); + } } diff --git a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php index c45d15c..342c3a0 100644 --- a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php @@ -29,4 +29,15 @@ class Mustache_Test_Exception_UnknownHelperExceptionTest extends PHPUnit_Framewo $e = new Mustache_Exception_UnknownHelperException('gamma'); $this->assertEquals('gamma', $e->getHelperName()); } + + public function testPrevious() + { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + $this->markTestSkipped('Exception chaining requires at least PHP 5.3'); + } + + $previous = new Exception(); + $e = new Mustache_Exception_UnknownHelperException('foo', $previous); + $this->assertSame($previous, $e->getPrevious()); + } } diff --git a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php index 61cdd2f..b5848d5 100644 --- a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php @@ -29,4 +29,15 @@ class Mustache_Test_Exception_UnknownTemplateExceptionTest extends PHPUnit_Frame $e = new Mustache_Exception_UnknownTemplateException('yoshi'); $this->assertEquals('yoshi', $e->getTemplateName()); } + + public function testPrevious() + { + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + $this->markTestSkipped('Exception chaining requires at least PHP 5.3'); + } + + $previous = new Exception(); + $e = new Mustache_Exception_UnknownTemplateException('foo', $previous); + $this->assertSame($previous, $e->getPrevious()); + } } From 1de789820063f2dd6e73f5bc348df651e775afaf Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 18 May 2016 21:48:17 -0700 Subject: [PATCH 02/15] Fix incorrect method name case. --- src/Mustache/Compiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 76e580c..c400c3b 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -456,7 +456,7 @@ class Mustache_Compiler const PARENT = ' %s - if ($parent = $this->mustache->LoadPartial(%s)) { + if ($parent = $this->mustache->loadPartial(%s)) { $context->pushBlockContext($newContext); $buffer .= $parent->renderInternal($context, $indent); $context->popBlockContext(); From 21d553fc0262525fbde570367fc2517a98e314ac Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 18 May 2016 22:40:00 -0700 Subject: [PATCH 03/15] Add a failing test case for #294 --- test/Mustache/Test/Functional/InheritanceTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/Mustache/Test/Functional/InheritanceTest.php b/test/Mustache/Test/Functional/InheritanceTest.php index 598e798..0b26b77 100644 --- a/test/Mustache/Test/Functional/InheritanceTest.php +++ b/test/Mustache/Test/Functional/InheritanceTest.php @@ -84,6 +84,15 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas '{{ '{{$a}}FAIL!{{/a}}', + 'bar' => 'WIN!!', + ), + array(), + '{{ Date: Wed, 18 May 2016 22:45:46 -0700 Subject: [PATCH 04/15] Support parent tags and block args as direct children of blocks and sections. Fixes #294 Drive-by: rename blocks context variable to something more descriptive. --- src/Mustache/Compiler.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index c400c3b..7e82bfa 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -191,7 +191,7 @@ class Mustache_Compiler { $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context); $buffer = \'\'; - $newContext = array(); + $blocksContext = array(); %s return $buffer; @@ -207,7 +207,7 @@ class Mustache_Compiler public function renderInternal(Mustache_Context $context, $indent = \'\') { $buffer = \'\'; - $newContext = array(); + $blocksContext = array(); %s return $buffer; @@ -264,7 +264,7 @@ class Mustache_Compiler return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, $level)); } - const BLOCK_ARG = '$newContext[%s] = array($this, \'block%s\');'; + const BLOCK_ARG = '$blocksContext[%s] = array($this, \'block%s\');'; /** * Generate Mustache Template inheritance block argument PHP source. @@ -291,7 +291,8 @@ class Mustache_Compiler const BLOCK_FUNCTION = ' public function block%s($context) { - $indent = $buffer = \'\';%s + $indent = $buffer = \'\'; + $blocksContext = array();%s return $buffer; } @@ -326,6 +327,8 @@ class Mustache_Compiler private function section%s(Mustache_Context $context, $indent, $value) { $buffer = \'\'; + $blocksContext = array(); + if (%s) { $source = %s; $result = call_user_func($value, $source, %s); @@ -457,7 +460,7 @@ class Mustache_Compiler %s if ($parent = $this->mustache->loadPartial(%s)) { - $context->pushBlockContext($newContext); + $context->pushBlockContext($blocksContext); $buffer .= $parent->renderInternal($context, $indent); $context->popBlockContext(); } From b2b282dfef572730a62ddac997a88350cc3d8f65 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Thu, 19 May 2016 00:06:45 -0700 Subject: [PATCH 05/15] Code style fixes. --- bin/build_bootstrap.php | 2 +- test/Mustache/Test/EngineTest.php | 2 +- .../Test/FiveThree/Functional/FiltersTest.php | 2 +- .../FiveThree/Functional/PartialLambdaIndentTest.php | 12 ++++++------ test/Mustache/Test/Functional/CallTest.php | 1 + test/fixtures/examples/simple/Simple.php | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/build_bootstrap.php b/bin/build_bootstrap.php index 8a63803..cc23b2b 100755 --- a/bin/build_bootstrap.php +++ b/bin/build_bootstrap.php @@ -78,7 +78,7 @@ class SymfonyClassCollectionLoader { private static $loaded; - const HEADER = <<getLoggedMustache(Mustache_Logger::DEBUG); $mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO')); $log = file_get_contents($name); - $this->assertContains('DEBUG: Instantiating template: ', $log); + $this->assertContains('DEBUG: Instantiating template: ', $log); $this->assertContains('WARNING: Partial not found: "bar"', $log); } diff --git a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php index a6236fa..c9d1549 100644 --- a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php +++ b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php @@ -77,7 +77,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T $this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo)); } - const CHAINED_SECTION_FILTERS_TPL = << {{> input }} EOS; - $partial = << EOS; - $expected = << @@ -47,18 +47,18 @@ EOS; public function testLambdaInterpolationsInsidePartialsAreIndentedProperly() { - $src = << {{> input }} EOS; - $partial = << EOS; - $expected = << diff --git a/test/Mustache/Test/Functional/CallTest.php b/test/Mustache/Test/Functional/CallTest.php index 7ffd53e..4c5cbac 100644 --- a/test/Mustache/Test/Functional/CallTest.php +++ b/test/Mustache/Test/Functional/CallTest.php @@ -32,6 +32,7 @@ class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase class Mustache_Test_Functional_ClassWithCall { public $name; + public function __call($method, $args) { return 'unknown value'; diff --git a/test/fixtures/examples/simple/Simple.php b/test/fixtures/examples/simple/Simple.php index cfc746b..f8e431d 100644 --- a/test/fixtures/examples/simple/Simple.php +++ b/test/fixtures/examples/simple/Simple.php @@ -11,4 +11,4 @@ class Simple } public $in_ca = true; -}; +} From 174f0da5ce4c64ba25d79f62d084a54d1b77a85b Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 17:44:10 -0700 Subject: [PATCH 06/15] Switch to friendsofphp's cs fixer package --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f2ba0f9..d0514f3 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "require-dev": { "phpunit/phpunit": "~3.7|~4.0|~5.0", - "fabpot/php-cs-fixer": "~1.6" + "friendsofphp/php-cs-fixer": "~1.11" }, "autoload": { "psr-0": { "Mustache": "src/" } From 41edfcb9e2492ce41bf9d9b09b9c3d02f6ac274d Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 17:51:14 -0700 Subject: [PATCH 07/15] Drop the php-cs-fixer business on Travis. That's what StyleCI is for. --- .travis.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d3b7e5..e68b99c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,5 @@ language: php -install: - - curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar - -script: - - phpunit - - if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=') && !defined('HHVM_VERSION');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi - php: - 5.2 - 5.3 @@ -16,4 +9,7 @@ php: - 7.0 - hhvm +script: + - phpunit + sudo: false From 01777faf6eb7de8c9bf0aa47a44bbdcb267e4c45 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 17:57:19 -0700 Subject: [PATCH 08/15] Various style cleanups. * a bunch of small changes, courtesy of styleci * update dates in file headers * add file headers to files that are missing them --- src/Mustache/Autoloader.php | 3 +- src/Mustache/Cache.php | 3 +- src/Mustache/Cache/AbstractCache.php | 3 +- src/Mustache/Cache/FilesystemCache.php | 7 ++- src/Mustache/Cache/NoopCache.php | 3 +- src/Mustache/Compiler.php | 7 ++- src/Mustache/Context.php | 7 ++- src/Mustache/Engine.php | 7 ++- src/Mustache/Exception.php | 3 +- .../Exception/InvalidArgumentException.php | 3 +- src/Mustache/Exception/LogicException.php | 3 +- src/Mustache/Exception/RuntimeException.php | 3 +- src/Mustache/Exception/SyntaxException.php | 3 +- .../Exception/UnknownFilterException.php | 3 +- .../Exception/UnknownHelperException.php | 3 +- .../Exception/UnknownTemplateException.php | 3 +- src/Mustache/HelperCollection.php | 7 ++- src/Mustache/LambdaHelper.php | 11 ++-- src/Mustache/Loader.php | 5 +- src/Mustache/Loader/ArrayLoader.php | 5 +- src/Mustache/Loader/CascadingLoader.php | 5 +- src/Mustache/Loader/FilesystemLoader.php | 9 +-- src/Mustache/Loader/InlineLoader.php | 7 ++- src/Mustache/Loader/MutableLoader.php | 3 +- src/Mustache/Loader/StringLoader.php | 3 +- src/Mustache/Logger.php | 3 +- src/Mustache/Logger/AbstractLogger.php | 3 +- src/Mustache/Logger/StreamLogger.php | 15 ++--- src/Mustache/Parser.php | 13 +++-- src/Mustache/Template.php | 3 +- src/Mustache/Tokenizer.php | 5 +- test/Mustache/Test/AutoloaderTest.php | 3 +- .../Mustache/Test/Cache/AbstractCacheTest.php | 3 +- .../Test/Cache/FilesystemCacheTest.php | 3 +- test/Mustache/Test/CompilerTest.php | 3 +- test/Mustache/Test/ContextTest.php | 3 +- test/Mustache/Test/EngineTest.php | 3 +- .../Test/Exception/SyntaxExceptionTest.php | 3 +- .../Exception/UnknownFilterExceptionTest.php | 3 +- .../Exception/UnknownHelperExceptionTest.php | 3 +- .../UnknownTemplateExceptionTest.php | 3 +- .../Functional/ClosureQuirksTest.php | 7 ++- .../Test/FiveThree/Functional/EngineTest.php | 3 +- .../Test/FiveThree/Functional/FiltersTest.php | 55 ++++++++++++++----- .../Functional/HigherOrderSectionsTest.php | 3 +- .../FiveThree/Functional/LambdaHelperTest.php | 3 +- .../FiveThree/Functional/MustacheSpecTest.php | 3 +- .../Functional/PartialLambdaIndentTest.php | 3 +- .../Functional/StrictCallablesTest.php | 11 +++- test/Mustache/Test/Functional/CallTest.php | 3 +- .../Mustache/Test/Functional/ExamplesTest.php | 3 +- .../Functional/HigherOrderSectionsTest.php | 3 +- .../Test/Functional/InheritanceTest.php | 9 +++ .../Test/Functional/MustacheInjectionTest.php | 3 +- .../Test/Functional/MustacheSpecTest.php | 3 +- .../Functional/NestedPartialIndentTest.php | 3 +- .../Test/Functional/ObjectSectionTest.php | 3 +- test/Mustache/Test/FunctionalTestCase.php | 3 +- test/Mustache/Test/HelperCollectionTest.php | 3 +- test/Mustache/Test/Loader/ArrayLoaderTest.php | 3 +- .../Test/Loader/CascadingLoaderTest.php | 3 +- .../Test/Loader/FilesystemLoaderTest.php | 3 +- .../Mustache/Test/Loader/StringLoaderTest.php | 3 +- .../Test/Logger/AbstractLoggerTest.php | 3 +- .../Mustache/Test/Logger/StreamLoggerTest.php | 3 +- test/Mustache/Test/ParserTest.php | 3 +- test/Mustache/Test/SpecTestCase.php | 3 +- test/Mustache/Test/TemplateTest.php | 3 +- test/Mustache/Test/TokenizerTest.php | 3 +- test/bootstrap.php | 3 +- test/fixtures/autoloader/Mustache/Bar.php | 3 +- test/fixtures/autoloader/Mustache/Foo.php | 3 +- test/fixtures/autoloader/NonMustacheClass.php | 3 +- test/fixtures/examples/blocks/Blocks.php | 9 +++ .../examples/child_context/ChildContext.php | 9 +++ test/fixtures/examples/comments/Comments.php | 9 +++ test/fixtures/examples/complex/complex.php | 9 +++ .../examples/delimiters/Delimiters.php | 9 +++ .../examples/dot_notation/DotNotation.php | 9 +++ .../examples/double_section/DoubleSection.php | 9 +++ test/fixtures/examples/escaped/Escaped.php | 9 +++ test/fixtures/examples/filters/Filters.php | 9 +++ .../GrandParentContext.php | 9 +++ test/fixtures/examples/i18n/I18n.php | 9 +++ .../implicit_iterator/ImplicitIterator.php | 9 +++ .../InvertedDoubleSection.php | 9 +++ .../inverted_section/InvertedSection.php | 9 +++ .../nested_partials/NestedPartials.php | 9 +++ test/fixtures/examples/partials/Partials.php | 9 +++ .../recursive_partials/RecursivePartials.php | 9 +++ .../SectionIteratorObjects.php | 9 +++ .../SectionMagicObjects.php | 9 +++ .../section_objects/SectionObjects.php | 9 +++ test/fixtures/examples/sections/Sections.php | 9 +++ .../sections_nested/SectionsNested.php | 9 +++ test/fixtures/examples/simple/Simple.php | 9 +++ .../fixtures/examples/unescaped/Unescaped.php | 9 +++ test/fixtures/examples/utf8/UTF8.php | 9 +++ .../examples/utf8_unescaped/UTF8Unescaped.php | 9 +++ .../examples/whitespace/Whitespace.php | 9 +++ 100 files changed, 477 insertions(+), 123 deletions(-) diff --git a/src/Mustache/Autoloader.php b/src/Mustache/Autoloader.php index b33bc24..ac80674 100644 --- a/src/Mustache/Autoloader.php +++ b/src/Mustache/Autoloader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache class autoloader. */ diff --git a/src/Mustache/Cache.php b/src/Mustache/Cache.php index 5df8a23..1e0c98b 100644 --- a/src/Mustache/Cache.php +++ b/src/Mustache/Cache.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Cache interface. * diff --git a/src/Mustache/Cache/AbstractCache.php b/src/Mustache/Cache/AbstractCache.php index cf1c041..96b8a3f 100644 --- a/src/Mustache/Cache/AbstractCache.php +++ b/src/Mustache/Cache/AbstractCache.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Abstract Mustache Cache class. * diff --git a/src/Mustache/Cache/FilesystemCache.php b/src/Mustache/Cache/FilesystemCache.php index 5b56222..b1cd765 100644 --- a/src/Mustache/Cache/FilesystemCache.php +++ b/src/Mustache/Cache/FilesystemCache.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Cache filesystem implementation. * @@ -27,8 +28,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache /** * Filesystem cache constructor. * - * @param string $baseDir Directory for compiled templates. - * @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask. + * @param string $baseDir Directory for compiled templates + * @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask */ public function __construct($baseDir, $fileMode = null) { diff --git a/src/Mustache/Cache/NoopCache.php b/src/Mustache/Cache/NoopCache.php index 7a4b55b..302d82a 100644 --- a/src/Mustache/Cache/NoopCache.php +++ b/src/Mustache/Cache/NoopCache.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Cache in-memory implementation. * diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 7e82bfa..3003769 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Compiler class. * @@ -75,7 +76,7 @@ class Mustache_Compiler /** * Helper function for walking the Mustache token parse tree. * - * @throws Mustache_Exception_SyntaxException upon encountering unknown token types. + * @throws Mustache_Exception_SyntaxException upon encountering unknown token types * * @param array $tree Parse tree of Mustache tokens * @param int $level (default: 0) @@ -493,7 +494,7 @@ class Mustache_Compiler * * @param array $node * - * @return bool True if $node is a block arg token. + * @return bool True if $node is a block arg token */ private static function onlyBlockArgs(array $node) { diff --git a/src/Mustache/Context.php b/src/Mustache/Context.php index e660b54..0a4999c 100644 --- a/src/Mustache/Context.php +++ b/src/Mustache/Context.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template rendering Context. */ @@ -150,7 +151,7 @@ class Mustache_Context * * @see Mustache_Context::findDot * - * @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id. + * @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id * * @param string $id Dotted variable selector * @@ -182,7 +183,7 @@ class Mustache_Context * * @param string $id * - * @return mixed Variable value, or '' if not found. + * @return mixed Variable value, or '' if not found */ public function findInBlock($id) { diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index fe11912..4f4092a 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A Mustache implementation in PHP. * @@ -126,7 +127,7 @@ class Mustache_Engine * 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS], * ); * - * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable. + * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable * * @param array $options (default: array()) */ @@ -429,7 +430,7 @@ class Mustache_Engine /** * Set the Mustache Logger instance. * - * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface. + * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface * * @param Mustache_Logger|Psr\Log\LoggerInterface $logger */ diff --git a/src/Mustache/Exception.php b/src/Mustache/Exception.php index 7c04792..0998b9d 100644 --- a/src/Mustache/Exception.php +++ b/src/Mustache/Exception.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A Mustache Exception interface. */ diff --git a/src/Mustache/Exception/InvalidArgumentException.php b/src/Mustache/Exception/InvalidArgumentException.php index c6084b8..8feb383 100644 --- a/src/Mustache/Exception/InvalidArgumentException.php +++ b/src/Mustache/Exception/InvalidArgumentException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Invalid argument exception. */ diff --git a/src/Mustache/Exception/LogicException.php b/src/Mustache/Exception/LogicException.php index 4bfda5f..2297022 100644 --- a/src/Mustache/Exception/LogicException.php +++ b/src/Mustache/Exception/LogicException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Logic exception. */ diff --git a/src/Mustache/Exception/RuntimeException.php b/src/Mustache/Exception/RuntimeException.php index 5eb90dd..3d7a8d1 100644 --- a/src/Mustache/Exception/RuntimeException.php +++ b/src/Mustache/Exception/RuntimeException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Runtime exception. */ diff --git a/src/Mustache/Exception/SyntaxException.php b/src/Mustache/Exception/SyntaxException.php index 5475ed5..296a5d9 100644 --- a/src/Mustache/Exception/SyntaxException.php +++ b/src/Mustache/Exception/SyntaxException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache syntax exception. */ diff --git a/src/Mustache/Exception/UnknownFilterException.php b/src/Mustache/Exception/UnknownFilterException.php index f0a7012..6a453ec 100644 --- a/src/Mustache/Exception/UnknownFilterException.php +++ b/src/Mustache/Exception/UnknownFilterException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Unknown filter exception. */ diff --git a/src/Mustache/Exception/UnknownHelperException.php b/src/Mustache/Exception/UnknownHelperException.php index 9d8c2c4..f236c1c 100644 --- a/src/Mustache/Exception/UnknownHelperException.php +++ b/src/Mustache/Exception/UnknownHelperException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Unknown helper exception. */ diff --git a/src/Mustache/Exception/UnknownTemplateException.php b/src/Mustache/Exception/UnknownTemplateException.php index bfd945b..61e4427 100644 --- a/src/Mustache/Exception/UnknownTemplateException.php +++ b/src/Mustache/Exception/UnknownTemplateException.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Unknown template exception. */ diff --git a/src/Mustache/HelperCollection.php b/src/Mustache/HelperCollection.php index 0a92428..25ee8c2 100644 --- a/src/Mustache/HelperCollection.php +++ b/src/Mustache/HelperCollection.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A collection of helpers for a Mustache instance. */ @@ -81,7 +82,7 @@ class Mustache_HelperCollection /** * Get a helper by name. * - * @throws Mustache_Exception_UnknownHelperException If helper does not exist. + * @throws Mustache_Exception_UnknownHelperException If helper does not exist * * @param string $name * @@ -137,7 +138,7 @@ class Mustache_HelperCollection /** * Check whether a given helper is present in the collection. * - * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present. + * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present * * @param string $name */ diff --git a/src/Mustache/LambdaHelper.php b/src/Mustache/LambdaHelper.php index cb8e966..d846abc 100644 --- a/src/Mustache/LambdaHelper.php +++ b/src/Mustache/LambdaHelper.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Lambda Helper. * @@ -25,8 +26,8 @@ class Mustache_LambdaHelper /** * Mustache Lambda Helper constructor. * - * @param Mustache_Engine $mustache Mustache engine instance. - * @param Mustache_Context $context Rendering context. + * @param Mustache_Engine $mustache Mustache engine instance + * @param Mustache_Context $context Rendering context * @param string $delims Optional custom delimiters, in the format `{{= <% %> =}}`. (default: null) */ public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null) @@ -41,7 +42,7 @@ class Mustache_LambdaHelper * * @param string $string * - * @return string Rendered template. + * @return string Rendered template */ public function render($string) { @@ -65,7 +66,7 @@ class Mustache_LambdaHelper /** * Get a Lambda Helper with custom delimiters. * - * @param string $delims Custom delimiters, in the format `{{= <% %> =}}`. + * @param string $delims Custom delimiters, in the format `{{= <% %> =}}` * * @return Mustache_LambdaHelper */ diff --git a/src/Mustache/Loader.php b/src/Mustache/Loader.php index 1b075d0..3398dab 100644 --- a/src/Mustache/Loader.php +++ b/src/Mustache/Loader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template Loader interface. */ @@ -17,7 +18,7 @@ interface Mustache_Loader /** * Load a Template by name. * - * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found * * @param string $name * diff --git a/src/Mustache/Loader/ArrayLoader.php b/src/Mustache/Loader/ArrayLoader.php index 90cecca..3e3a214 100644 --- a/src/Mustache/Loader/ArrayLoader.php +++ b/src/Mustache/Loader/ArrayLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template array Loader implementation. * @@ -41,7 +42,7 @@ class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_Mu /** * Load a Template. * - * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found * * @param string $name * diff --git a/src/Mustache/Loader/CascadingLoader.php b/src/Mustache/Loader/CascadingLoader.php index 09a376c..943c39b 100644 --- a/src/Mustache/Loader/CascadingLoader.php +++ b/src/Mustache/Loader/CascadingLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A Mustache Template cascading loader implementation, which delegates to other * Loader instances. @@ -48,7 +49,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader /** * Load a Template by name. * - * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found * * @param string $name * diff --git a/src/Mustache/Loader/FilesystemLoader.php b/src/Mustache/Loader/FilesystemLoader.php index e2aab78..1cfaea2 100644 --- a/src/Mustache/Loader/FilesystemLoader.php +++ b/src/Mustache/Loader/FilesystemLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template filesystem Loader implementation. * @@ -40,9 +41,9 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader * 'extension' => '.ms', * ); * - * @throws Mustache_Exception_RuntimeException if $baseDir does not exist. + * @throws Mustache_Exception_RuntimeException if $baseDir does not exist * - * @param string $baseDir Base directory containing Mustache template files. + * @param string $baseDir Base directory containing Mustache template files * @param array $options Array of Loader options (default: array()) */ public function __construct($baseDir, array $options = array()) @@ -88,7 +89,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader /** * Helper function for loading a Mustache file by name. * - * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found * * @param string $name * diff --git a/src/Mustache/Loader/InlineLoader.php b/src/Mustache/Loader/InlineLoader.php index 2970937..5b01089 100644 --- a/src/Mustache/Loader/InlineLoader.php +++ b/src/Mustache/Loader/InlineLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A Mustache Template loader for inline templates. * @@ -68,7 +69,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader * @param string $fileName The file to parse for inline templates * @param int $offset A string offset for the start of the templates. * This usually coincides with the `__halt_compiler` - * call, and the `__COMPILER_HALT_OFFSET__`. + * call, and the `__COMPILER_HALT_OFFSET__` */ public function __construct($fileName, $offset) { @@ -87,7 +88,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader /** * Load a Template by name. * - * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found * * @param string $name * diff --git a/src/Mustache/Loader/MutableLoader.php b/src/Mustache/Loader/MutableLoader.php index 4855c16..5d1b047 100644 --- a/src/Mustache/Loader/MutableLoader.php +++ b/src/Mustache/Loader/MutableLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template mutable Loader interface. */ diff --git a/src/Mustache/Loader/StringLoader.php b/src/Mustache/Loader/StringLoader.php index 99fb38e..fa6d7b5 100644 --- a/src/Mustache/Loader/StringLoader.php +++ b/src/Mustache/Loader/StringLoader.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Template string Loader implementation. * diff --git a/src/Mustache/Logger.php b/src/Mustache/Logger.php index 93c27f6..dcf3eb2 100644 --- a/src/Mustache/Logger.php +++ b/src/Mustache/Logger.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Describes a Mustache logger instance. * diff --git a/src/Mustache/Logger/AbstractLogger.php b/src/Mustache/Logger/AbstractLogger.php index 1c27db9..bef68b3 100644 --- a/src/Mustache/Logger/AbstractLogger.php +++ b/src/Mustache/Logger/AbstractLogger.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * This is a simple Logger implementation that other Loggers can inherit from. * diff --git a/src/Mustache/Logger/StreamLogger.php b/src/Mustache/Logger/StreamLogger.php index 88f3000..992e706 100644 --- a/src/Mustache/Logger/StreamLogger.php +++ b/src/Mustache/Logger/StreamLogger.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A Mustache Stream Logger. * @@ -36,7 +37,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger protected $url = null; /** - * @throws InvalidArgumentException if the logging level is unknown. + * @throws InvalidArgumentException if the logging level is unknown * * @param resource|string $stream Resource instance or URL * @param int $level The minimum logging level at which this handler will be triggered @@ -65,7 +66,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger /** * Set the minimum logging level. * - * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown. + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown * * @param int $level The minimum logging level which will be written */ @@ -91,7 +92,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger /** * Logs with an arbitrary level. * - * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown. + * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown * * @param mixed $level * @param string $message @@ -111,8 +112,8 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger /** * Write a record to the log. * - * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present. - * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened. + * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present + * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened * * @param int $level The logging level * @param string $message The log message @@ -139,7 +140,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger /** * Gets the name of the logging level. * - * @throws InvalidArgumentException if the logging level is unknown. + * @throws InvalidArgumentException if the logging level is unknown * * @param int $level * diff --git a/src/Mustache/Parser.php b/src/Mustache/Parser.php index 7d3559b..5d3ed9e 100644 --- a/src/Mustache/Parser.php +++ b/src/Mustache/Parser.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Parser class. * @@ -63,7 +64,7 @@ class Mustache_Parser /** * Helper method for recursively building a parse tree. * - * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered. + * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered * * @param array &$tokens Set of Mustache tokens * @param array $parent Parent token (default: null) @@ -195,10 +196,10 @@ class Mustache_Parser * * Returns a whitespace token for indenting partials, if applicable. * - * @param array $nodes Parsed nodes. - * @param array $tokens Tokens to be parsed. + * @param array $nodes Parsed nodes + * @param array $tokens Tokens to be parsed * - * @return array|null Resulting indent token, if any. + * @return array|null Resulting indent token, if any */ private function clearStandaloneLines(array &$nodes, array &$tokens) { @@ -268,7 +269,7 @@ class Mustache_Parser /** * Check whether a token is allowed inside a parent tag. * - * @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag. + * @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag * * @param array|null $parent * @param array $token diff --git a/src/Mustache/Template.php b/src/Mustache/Template.php index f2d198f..5087a70 100644 --- a/src/Mustache/Template.php +++ b/src/Mustache/Template.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Abstract Mustache Template class. * diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index a71df2c..5643632 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * Mustache Tokenizer class. * @@ -80,7 +81,7 @@ class Mustache_Tokenizer /** * Scan and tokenize template source. * - * @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered. + * @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered * * @param string $text Mustache template source to tokenize * @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null) diff --git a/test/Mustache/Test/AutoloaderTest.php b/test/Mustache/Test/AutoloaderTest.php index ebe42df..35bde97 100644 --- a/test/Mustache/Test/AutoloaderTest.php +++ b/test/Mustache/Test/AutoloaderTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group unit */ diff --git a/test/Mustache/Test/Cache/AbstractCacheTest.php b/test/Mustache/Test/Cache/AbstractCacheTest.php index 77fc18a..e0c7ada 100644 --- a/test/Mustache/Test/Cache/AbstractCacheTest.php +++ b/test/Mustache/Test/Cache/AbstractCacheTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + class Mustache_Test_Cache_AbstractCacheTest extends PHPUnit_Framework_TestCase { public function testGetSetLogger() diff --git a/test/Mustache/Test/Cache/FilesystemCacheTest.php b/test/Mustache/Test/Cache/FilesystemCacheTest.php index f3fead5..b0990dc 100644 --- a/test/Mustache/Test/Cache/FilesystemCacheTest.php +++ b/test/Mustache/Test/Cache/FilesystemCacheTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group functional */ diff --git a/test/Mustache/Test/CompilerTest.php b/test/Mustache/Test/CompilerTest.php index e11bd98..a636096 100644 --- a/test/Mustache/Test/CompilerTest.php +++ b/test/Mustache/Test/CompilerTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group unit */ diff --git a/test/Mustache/Test/ContextTest.php b/test/Mustache/Test/ContextTest.php index 5d700fd..52f316c 100644 --- a/test/Mustache/Test/ContextTest.php +++ b/test/Mustache/Test/ContextTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group unit */ diff --git a/test/Mustache/Test/EngineTest.php b/test/Mustache/Test/EngineTest.php index 3da748b..35f3a8b 100644 --- a/test/Mustache/Test/EngineTest.php +++ b/test/Mustache/Test/EngineTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group unit */ diff --git a/test/Mustache/Test/Exception/SyntaxExceptionTest.php b/test/Mustache/Test/Exception/SyntaxExceptionTest.php index e87b7d5..b4040a9 100644 --- a/test/Mustache/Test/Exception/SyntaxExceptionTest.php +++ b/test/Mustache/Test/Exception/SyntaxExceptionTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + class Mustache_Test_Exception_SyntaxExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php index b31dcbb..d8bd44a 100644 --- a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + class Mustache_Test_Exception_UnknownFilterExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php index 342c3a0..9d3de69 100644 --- a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + class Mustache_Test_Exception_UnknownHelperExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php index b5848d5..572fd2e 100644 --- a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + class Mustache_Test_Exception_UnknownTemplateExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php index a6f8353..43bf429 100644 --- a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php +++ b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional @@ -25,6 +26,8 @@ class Mustache_Test_FiveThree_Functional_ClosureQuirksTest extends PHPUnit_Frame 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'; + }))); } } diff --git a/test/Mustache/Test/FiveThree/Functional/EngineTest.php b/test/Mustache/Test/FiveThree/Functional/EngineTest.php index 09e256b..236d130 100644 --- a/test/Mustache/Test/FiveThree/Functional/EngineTest.php +++ b/test/Mustache/Test/FiveThree/Functional/EngineTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group pragmas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php index c9d1549..648f482 100644 --- a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php +++ b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group filters * @group functional @@ -35,11 +36,11 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T { $helpers = array( 'longdate' => function (\DateTime $value) { - return $value->format('Y-m-d h:m:s'); - }, + return $value->format('Y-m-d h:m:s'); + }, 'echo' => function ($value) { - return array($value, $value, $value); - }, + return array($value, $value, $value); + }, ); return array( @@ -143,21 +144,45 @@ EOS; array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO')), array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO', 'bar' => 'BAR')), array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO', 'bar' => array(1, 2))), - array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; })), - array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () { return 'BAZ'; })), - array('{{% FILTERS }}{{ foo | bar | baz }}', array('bar' => function () { return 'BAR'; })), - array('{{% FILTERS }}{{ foo | bar | baz }}', array('baz' => function () { return 'BAZ'; })), - array('{{% FILTERS }}{{ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; }, 'baz' => function () { return 'BAZ'; })), + array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () { + return 'BAR'; + })), + array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () { + return 'BAZ'; + })), + array('{{% FILTERS }}{{ foo | bar | baz }}', array('bar' => function () { + return 'BAR'; + })), + array('{{% FILTERS }}{{ foo | bar | baz }}', array('baz' => function () { + return 'BAZ'; + })), + array('{{% FILTERS }}{{ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () { + return 'BAR'; + }, 'baz' => function () { + return 'BAZ'; + })), array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array()), array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO')), array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO', 'bar' => 'BAR')), array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO', 'bar' => array(1, 2))), - array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; })), - array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () { return 'BAZ'; })), - array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('bar' => function () { return 'BAR'; })), - array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('baz' => function () { return 'BAZ'; })), - array('{{% FILTERS }}{{# foo | bar.baz }}{{ . }}{{/ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () { return 'BAR'; }, 'baz' => function () { return 'BAZ'; })), + array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () { + return 'BAR'; + })), + array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () { + return 'BAZ'; + })), + array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('bar' => function () { + return 'BAR'; + })), + array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('baz' => function () { + return 'BAZ'; + })), + array('{{% FILTERS }}{{# foo | bar.baz }}{{ . }}{{/ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () { + return 'BAR'; + }, 'baz' => function () { + return 'BAZ'; + })), ); } } diff --git a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php index 8abd209..81878d6 100644 --- a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php index 48f2465..ed5f304 100644 --- a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php +++ b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php index 6db379f..da4397c 100644 --- a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * A PHPUnit test case wrapping the Mustache Spec. * diff --git a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php index e9aff7e..b7e5a14 100644 --- a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php +++ b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php index 8fe64d8..5a11231 100644 --- a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php +++ b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional @@ -52,7 +53,9 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra ), array( false, - function () { return 'Yoshi'; }, + function () { + return 'Yoshi'; + }, $lambda, 'YOSHI', ), @@ -80,7 +83,9 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra // Strict interpolation lambdas array( true, - function () { return 'Yoshi'; }, + function () { + return 'Yoshi'; + }, $lambda, 'YOSHI', ), diff --git a/test/Mustache/Test/Functional/CallTest.php b/test/Mustache/Test/Functional/CallTest.php index 4c5cbac..24ff16e 100644 --- a/test/Mustache/Test/Functional/CallTest.php +++ b/test/Mustache/Test/Functional/CallTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group magic_methods * @group functional diff --git a/test/Mustache/Test/Functional/ExamplesTest.php b/test/Mustache/Test/Functional/ExamplesTest.php index e33384a..9339e43 100644 --- a/test/Mustache/Test/Functional/ExamplesTest.php +++ b/test/Mustache/Test/Functional/ExamplesTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group examples * @group functional diff --git a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php index 956d8cd..5b7527f 100644 --- a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php @@ -3,12 +3,13 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2016 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/Functional/InheritanceTest.php b/test/Mustache/Test/Functional/InheritanceTest.php index 0b26b77..b39555f 100644 --- a/test/Mustache/Test/Functional/InheritanceTest.php +++ b/test/Mustache/Test/Functional/InheritanceTest.php @@ -1,5 +1,14 @@ "Shark"'; diff --git a/test/fixtures/examples/filters/Filters.php b/test/fixtures/examples/filters/Filters.php index 1899ab4..fb7c3f5 100644 --- a/test/fixtures/examples/filters/Filters.php +++ b/test/fixtures/examples/filters/Filters.php @@ -1,5 +1,14 @@ Shark'; diff --git a/test/fixtures/examples/utf8/UTF8.php b/test/fixtures/examples/utf8/UTF8.php index e5a7877..8c14941 100644 --- a/test/fixtures/examples/utf8/UTF8.php +++ b/test/fixtures/examples/utf8/UTF8.php @@ -1,5 +1,14 @@ Date: Sat, 30 Jul 2016 18:00:31 -0700 Subject: [PATCH 09/15] Add StyleCI badge to README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6a309ae..a596ace 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A [Mustache](http://mustache.github.com/) implementation in PHP. [![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache) [![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php) +[![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670) [![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache) From fee4544785c635a58a53765325805a54e3433d86 Mon Sep 17 00:00:00 2001 From: Olav Schettler Date: Thu, 4 Feb 2016 22:47:58 +0100 Subject: [PATCH 10/15] Allow to load non-local templates --- src/Mustache/Loader/FilesystemLoader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mustache/Loader/FilesystemLoader.php b/src/Mustache/Loader/FilesystemLoader.php index 1cfaea2..a7320ea 100644 --- a/src/Mustache/Loader/FilesystemLoader.php +++ b/src/Mustache/Loader/FilesystemLoader.php @@ -52,10 +52,10 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader if (strpos($this->baseDir, '://') === false) { $this->baseDir = realpath($this->baseDir); - } - if (!is_dir($this->baseDir)) { - throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); + if (!is_dir($this->baseDir)) { + throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); + } } if (array_key_exists('extension', $options)) { @@ -99,7 +99,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader { $fileName = $this->getFileName($name); - if (!file_exists($fileName)) { + if (strpos($this->baseDir, '://') === false && !file_exists($fileName)) { throw new Mustache_Exception_UnknownTemplateException($name); } From eeee916433ccffb6c9c3ab6f082945848a9c6e4f Mon Sep 17 00:00:00 2001 From: Olav Schettler Date: Thu, 4 Feb 2016 23:48:35 +0100 Subject: [PATCH 11/15] Protocol-based test with a protocol other than "file://" --- .../Test/Loader/FilesystemLoaderTest.php | 2 +- test/bootstrap.php | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/test/Mustache/Test/Loader/FilesystemLoaderTest.php b/test/Mustache/Test/Loader/FilesystemLoaderTest.php index 2589829..ed0cc07 100644 --- a/test/Mustache/Test/Loader/FilesystemLoaderTest.php +++ b/test/Mustache/Test/Loader/FilesystemLoaderTest.php @@ -34,7 +34,7 @@ class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCa { $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); - $loader = new Mustache_Loader_FilesystemLoader('file://' . $baseDir, array('extension' => '.ms')); + $loader = new Mustache_Loader_FilesystemLoader('test://' . $baseDir, array('extension' => '.ms')); $this->assertEquals('alpha contents', $loader->load('alpha')); $this->assertEquals('beta contents', $loader->load('beta.ms')); } diff --git a/test/bootstrap.php b/test/bootstrap.php index b45d8a2..7d8adc7 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -15,3 +15,73 @@ Mustache_Autoloader::register(); Mustache_Autoloader::register(dirname(__FILE__) . '/../test'); require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php'; + +/** + * Minimal stream wrapper to test protocol-based access to templates + */ +class TestStream +{ + private $filehandle; + + /** + * Always returns false + * + * @param string $path + * @param int $flags + * @return array + */ + public function url_stat($path, $flags) + { + return false; + } + + /** + * Open the file + * + * @param string $path + * @param string $mode + * @return bool + */ + public function stream_open($path, $mode) + { + $path = preg_replace('-^test://-', '', $path); + $this->filehandle = fopen($path, $mode); + return $this->filehandle !== false; + } + + /** + * @return array + */ + public function stream_stat() + { + return []; + } + + /** + * @param int $count + * @return string + */ + public function stream_read($count) + { + return fgets($this->filehandle, $count); + } + + /** + * @return bool + */ + public function stream_eof() + { + return feof($this->filehandle); + } + + /** + * @return bool + */ + public function stream_close() + { + return fclose($this->filehandle); + } +} + +stream_wrapper_register('test', TestStream::class) + || die('Failed to register protocol'); From 18a2adce3d22e4383d30010ff3080adebd297e7a Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 22:39:43 -0700 Subject: [PATCH 12/15] Remove all the extra spaces StyleCI wanted me to add :) --- src/Mustache/Autoloader.php | 1 - src/Mustache/Cache.php | 1 - src/Mustache/Cache/AbstractCache.php | 1 - src/Mustache/Cache/FilesystemCache.php | 1 - src/Mustache/Cache/NoopCache.php | 1 - src/Mustache/Compiler.php | 1 - src/Mustache/Context.php | 1 - src/Mustache/Engine.php | 1 - src/Mustache/Exception.php | 1 - src/Mustache/Exception/InvalidArgumentException.php | 1 - src/Mustache/Exception/LogicException.php | 1 - src/Mustache/Exception/RuntimeException.php | 1 - src/Mustache/Exception/SyntaxException.php | 1 - src/Mustache/Exception/UnknownFilterException.php | 1 - src/Mustache/Exception/UnknownHelperException.php | 1 - src/Mustache/Exception/UnknownTemplateException.php | 1 - src/Mustache/HelperCollection.php | 1 - src/Mustache/LambdaHelper.php | 1 - src/Mustache/Loader.php | 1 - src/Mustache/Loader/ArrayLoader.php | 1 - src/Mustache/Loader/CascadingLoader.php | 1 - src/Mustache/Loader/FilesystemLoader.php | 1 - src/Mustache/Loader/InlineLoader.php | 1 - src/Mustache/Loader/MutableLoader.php | 1 - src/Mustache/Loader/StringLoader.php | 1 - src/Mustache/Logger.php | 1 - src/Mustache/Logger/AbstractLogger.php | 1 - src/Mustache/Logger/StreamLogger.php | 1 - src/Mustache/Parser.php | 1 - src/Mustache/Template.php | 1 - src/Mustache/Tokenizer.php | 1 - test/Mustache/Test/AutoloaderTest.php | 1 - test/Mustache/Test/Cache/AbstractCacheTest.php | 1 - test/Mustache/Test/Cache/FilesystemCacheTest.php | 1 - test/Mustache/Test/CompilerTest.php | 1 - test/Mustache/Test/ContextTest.php | 1 - test/Mustache/Test/EngineTest.php | 1 - test/Mustache/Test/Exception/SyntaxExceptionTest.php | 1 - test/Mustache/Test/Exception/UnknownFilterExceptionTest.php | 1 - test/Mustache/Test/Exception/UnknownHelperExceptionTest.php | 1 - test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php | 1 - test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php | 1 - test/Mustache/Test/FiveThree/Functional/EngineTest.php | 1 - test/Mustache/Test/FiveThree/Functional/FiltersTest.php | 1 - .../Test/FiveThree/Functional/HigherOrderSectionsTest.php | 1 - test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php | 1 - test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php | 1 - .../Test/FiveThree/Functional/PartialLambdaIndentTest.php | 1 - test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php | 1 - test/Mustache/Test/Functional/CallTest.php | 1 - test/Mustache/Test/Functional/ExamplesTest.php | 1 - test/Mustache/Test/Functional/HigherOrderSectionsTest.php | 1 - test/Mustache/Test/Functional/MustacheInjectionTest.php | 1 - test/Mustache/Test/Functional/MustacheSpecTest.php | 1 - test/Mustache/Test/Functional/NestedPartialIndentTest.php | 1 - test/Mustache/Test/Functional/ObjectSectionTest.php | 1 - test/Mustache/Test/FunctionalTestCase.php | 1 - test/Mustache/Test/HelperCollectionTest.php | 1 - test/Mustache/Test/Loader/ArrayLoaderTest.php | 1 - test/Mustache/Test/Loader/CascadingLoaderTest.php | 1 - test/Mustache/Test/Loader/FilesystemLoaderTest.php | 1 - test/Mustache/Test/Loader/StringLoaderTest.php | 1 - test/Mustache/Test/Logger/AbstractLoggerTest.php | 1 - test/Mustache/Test/Logger/StreamLoggerTest.php | 1 - test/Mustache/Test/ParserTest.php | 1 - test/Mustache/Test/SpecTestCase.php | 1 - test/Mustache/Test/TemplateTest.php | 1 - test/Mustache/Test/TokenizerTest.php | 1 - test/fixtures/autoloader/Mustache/Bar.php | 1 - test/fixtures/autoloader/Mustache/Foo.php | 1 - test/fixtures/autoloader/NonMustacheClass.php | 1 - 71 files changed, 71 deletions(-) diff --git a/src/Mustache/Autoloader.php b/src/Mustache/Autoloader.php index ac80674..b16ac14 100644 --- a/src/Mustache/Autoloader.php +++ b/src/Mustache/Autoloader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache class autoloader. */ diff --git a/src/Mustache/Cache.php b/src/Mustache/Cache.php index 1e0c98b..7b465ab 100644 --- a/src/Mustache/Cache.php +++ b/src/Mustache/Cache.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Cache interface. * diff --git a/src/Mustache/Cache/AbstractCache.php b/src/Mustache/Cache/AbstractCache.php index 96b8a3f..495090b 100644 --- a/src/Mustache/Cache/AbstractCache.php +++ b/src/Mustache/Cache/AbstractCache.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Abstract Mustache Cache class. * diff --git a/src/Mustache/Cache/FilesystemCache.php b/src/Mustache/Cache/FilesystemCache.php index b1cd765..0dbe8f9 100644 --- a/src/Mustache/Cache/FilesystemCache.php +++ b/src/Mustache/Cache/FilesystemCache.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Cache filesystem implementation. * diff --git a/src/Mustache/Cache/NoopCache.php b/src/Mustache/Cache/NoopCache.php index 302d82a..ca0007d 100644 --- a/src/Mustache/Cache/NoopCache.php +++ b/src/Mustache/Cache/NoopCache.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Cache in-memory implementation. * diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 3003769..2a831d6 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Compiler class. * diff --git a/src/Mustache/Context.php b/src/Mustache/Context.php index 0a4999c..f59faea 100644 --- a/src/Mustache/Context.php +++ b/src/Mustache/Context.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template rendering Context. */ diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index 4f4092a..8ed7f81 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A Mustache implementation in PHP. * diff --git a/src/Mustache/Exception.php b/src/Mustache/Exception.php index 0998b9d..66bd6bd 100644 --- a/src/Mustache/Exception.php +++ b/src/Mustache/Exception.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A Mustache Exception interface. */ diff --git a/src/Mustache/Exception/InvalidArgumentException.php b/src/Mustache/Exception/InvalidArgumentException.php index 8feb383..46b200c 100644 --- a/src/Mustache/Exception/InvalidArgumentException.php +++ b/src/Mustache/Exception/InvalidArgumentException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Invalid argument exception. */ diff --git a/src/Mustache/Exception/LogicException.php b/src/Mustache/Exception/LogicException.php index 2297022..8e75e7e 100644 --- a/src/Mustache/Exception/LogicException.php +++ b/src/Mustache/Exception/LogicException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Logic exception. */ diff --git a/src/Mustache/Exception/RuntimeException.php b/src/Mustache/Exception/RuntimeException.php index 3d7a8d1..9a7b90b 100644 --- a/src/Mustache/Exception/RuntimeException.php +++ b/src/Mustache/Exception/RuntimeException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Runtime exception. */ diff --git a/src/Mustache/Exception/SyntaxException.php b/src/Mustache/Exception/SyntaxException.php index 296a5d9..4fcb39d 100644 --- a/src/Mustache/Exception/SyntaxException.php +++ b/src/Mustache/Exception/SyntaxException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache syntax exception. */ diff --git a/src/Mustache/Exception/UnknownFilterException.php b/src/Mustache/Exception/UnknownFilterException.php index 6a453ec..44505e4 100644 --- a/src/Mustache/Exception/UnknownFilterException.php +++ b/src/Mustache/Exception/UnknownFilterException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Unknown filter exception. */ diff --git a/src/Mustache/Exception/UnknownHelperException.php b/src/Mustache/Exception/UnknownHelperException.php index f236c1c..e1bc4d2 100644 --- a/src/Mustache/Exception/UnknownHelperException.php +++ b/src/Mustache/Exception/UnknownHelperException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Unknown helper exception. */ diff --git a/src/Mustache/Exception/UnknownTemplateException.php b/src/Mustache/Exception/UnknownTemplateException.php index 61e4427..0c37796 100644 --- a/src/Mustache/Exception/UnknownTemplateException.php +++ b/src/Mustache/Exception/UnknownTemplateException.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Unknown template exception. */ diff --git a/src/Mustache/HelperCollection.php b/src/Mustache/HelperCollection.php index 25ee8c2..86c56b7 100644 --- a/src/Mustache/HelperCollection.php +++ b/src/Mustache/HelperCollection.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A collection of helpers for a Mustache instance. */ diff --git a/src/Mustache/LambdaHelper.php b/src/Mustache/LambdaHelper.php index d846abc..1d203d5 100644 --- a/src/Mustache/LambdaHelper.php +++ b/src/Mustache/LambdaHelper.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Lambda Helper. * diff --git a/src/Mustache/Loader.php b/src/Mustache/Loader.php index 3398dab..c5e1a19 100644 --- a/src/Mustache/Loader.php +++ b/src/Mustache/Loader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template Loader interface. */ diff --git a/src/Mustache/Loader/ArrayLoader.php b/src/Mustache/Loader/ArrayLoader.php index 3e3a214..c0d6a4d 100644 --- a/src/Mustache/Loader/ArrayLoader.php +++ b/src/Mustache/Loader/ArrayLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template array Loader implementation. * diff --git a/src/Mustache/Loader/CascadingLoader.php b/src/Mustache/Loader/CascadingLoader.php index 943c39b..b4726bc 100644 --- a/src/Mustache/Loader/CascadingLoader.php +++ b/src/Mustache/Loader/CascadingLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A Mustache Template cascading loader implementation, which delegates to other * Loader instances. diff --git a/src/Mustache/Loader/FilesystemLoader.php b/src/Mustache/Loader/FilesystemLoader.php index a7320ea..8f84774 100644 --- a/src/Mustache/Loader/FilesystemLoader.php +++ b/src/Mustache/Loader/FilesystemLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template filesystem Loader implementation. * diff --git a/src/Mustache/Loader/InlineLoader.php b/src/Mustache/Loader/InlineLoader.php index 5b01089..f6d4b17 100644 --- a/src/Mustache/Loader/InlineLoader.php +++ b/src/Mustache/Loader/InlineLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A Mustache Template loader for inline templates. * diff --git a/src/Mustache/Loader/MutableLoader.php b/src/Mustache/Loader/MutableLoader.php index 5d1b047..f228d90 100644 --- a/src/Mustache/Loader/MutableLoader.php +++ b/src/Mustache/Loader/MutableLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template mutable Loader interface. */ diff --git a/src/Mustache/Loader/StringLoader.php b/src/Mustache/Loader/StringLoader.php index fa6d7b5..79b616b 100644 --- a/src/Mustache/Loader/StringLoader.php +++ b/src/Mustache/Loader/StringLoader.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Template string Loader implementation. * diff --git a/src/Mustache/Logger.php b/src/Mustache/Logger.php index dcf3eb2..324a7ce 100644 --- a/src/Mustache/Logger.php +++ b/src/Mustache/Logger.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Describes a Mustache logger instance. * diff --git a/src/Mustache/Logger/AbstractLogger.php b/src/Mustache/Logger/AbstractLogger.php index bef68b3..64bdf66 100644 --- a/src/Mustache/Logger/AbstractLogger.php +++ b/src/Mustache/Logger/AbstractLogger.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * This is a simple Logger implementation that other Loggers can inherit from. * diff --git a/src/Mustache/Logger/StreamLogger.php b/src/Mustache/Logger/StreamLogger.php index 992e706..efb3231 100644 --- a/src/Mustache/Logger/StreamLogger.php +++ b/src/Mustache/Logger/StreamLogger.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A Mustache Stream Logger. * diff --git a/src/Mustache/Parser.php b/src/Mustache/Parser.php index 5d3ed9e..adefebd 100644 --- a/src/Mustache/Parser.php +++ b/src/Mustache/Parser.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Parser class. * diff --git a/src/Mustache/Template.php b/src/Mustache/Template.php index 5087a70..2b7771c 100644 --- a/src/Mustache/Template.php +++ b/src/Mustache/Template.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Abstract Mustache Template class. * diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index 5643632..27e4d05 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * Mustache Tokenizer class. * diff --git a/test/Mustache/Test/AutoloaderTest.php b/test/Mustache/Test/AutoloaderTest.php index 35bde97..40af5ee 100644 --- a/test/Mustache/Test/AutoloaderTest.php +++ b/test/Mustache/Test/AutoloaderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Cache/AbstractCacheTest.php b/test/Mustache/Test/Cache/AbstractCacheTest.php index e0c7ada..d977388 100644 --- a/test/Mustache/Test/Cache/AbstractCacheTest.php +++ b/test/Mustache/Test/Cache/AbstractCacheTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_Cache_AbstractCacheTest extends PHPUnit_Framework_TestCase { public function testGetSetLogger() diff --git a/test/Mustache/Test/Cache/FilesystemCacheTest.php b/test/Mustache/Test/Cache/FilesystemCacheTest.php index b0990dc..2413125 100644 --- a/test/Mustache/Test/Cache/FilesystemCacheTest.php +++ b/test/Mustache/Test/Cache/FilesystemCacheTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group functional */ diff --git a/test/Mustache/Test/CompilerTest.php b/test/Mustache/Test/CompilerTest.php index a636096..725a82c 100644 --- a/test/Mustache/Test/CompilerTest.php +++ b/test/Mustache/Test/CompilerTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/ContextTest.php b/test/Mustache/Test/ContextTest.php index 52f316c..029c2ba 100644 --- a/test/Mustache/Test/ContextTest.php +++ b/test/Mustache/Test/ContextTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/EngineTest.php b/test/Mustache/Test/EngineTest.php index 35f3a8b..e8743d7 100644 --- a/test/Mustache/Test/EngineTest.php +++ b/test/Mustache/Test/EngineTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Exception/SyntaxExceptionTest.php b/test/Mustache/Test/Exception/SyntaxExceptionTest.php index b4040a9..3f6b2e4 100644 --- a/test/Mustache/Test/Exception/SyntaxExceptionTest.php +++ b/test/Mustache/Test/Exception/SyntaxExceptionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_Exception_SyntaxExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php index d8bd44a..049c842 100644 --- a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_Exception_UnknownFilterExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php index 9d3de69..b1682cd 100644 --- a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_Exception_UnknownHelperExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php index 572fd2e..2452749 100644 --- a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_Exception_UnknownTemplateExceptionTest extends PHPUnit_Framework_TestCase { public function testInstance() diff --git a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php index 43bf429..c997a1d 100644 --- a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php +++ b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/EngineTest.php b/test/Mustache/Test/FiveThree/Functional/EngineTest.php index 236d130..3ed70c7 100644 --- a/test/Mustache/Test/FiveThree/Functional/EngineTest.php +++ b/test/Mustache/Test/FiveThree/Functional/EngineTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group pragmas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php index 648f482..7adc663 100644 --- a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php +++ b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group filters * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php index 81878d6..f926fdf 100644 --- a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php index ed5f304..c67957e 100644 --- a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php +++ b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php index da4397c..d72686d 100644 --- a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A PHPUnit test case wrapping the Mustache Spec. * diff --git a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php index b7e5a14..605003c 100644 --- a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php +++ b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php index 5a11231..fc91072 100644 --- a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php +++ b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/Functional/CallTest.php b/test/Mustache/Test/Functional/CallTest.php index 24ff16e..fddeacf 100644 --- a/test/Mustache/Test/Functional/CallTest.php +++ b/test/Mustache/Test/Functional/CallTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group magic_methods * @group functional diff --git a/test/Mustache/Test/Functional/ExamplesTest.php b/test/Mustache/Test/Functional/ExamplesTest.php index 9339e43..d7ef51a 100644 --- a/test/Mustache/Test/Functional/ExamplesTest.php +++ b/test/Mustache/Test/Functional/ExamplesTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group examples * @group functional diff --git a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php index 5b7527f..e2f68b0 100644 --- a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group lambdas * @group functional diff --git a/test/Mustache/Test/Functional/MustacheInjectionTest.php b/test/Mustache/Test/Functional/MustacheInjectionTest.php index 7b78591..d0bdb48 100644 --- a/test/Mustache/Test/Functional/MustacheInjectionTest.php +++ b/test/Mustache/Test/Functional/MustacheInjectionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group mustache_injection * @group functional diff --git a/test/Mustache/Test/Functional/MustacheSpecTest.php b/test/Mustache/Test/Functional/MustacheSpecTest.php index 52f66b8..7ba0843 100644 --- a/test/Mustache/Test/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/Functional/MustacheSpecTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * A PHPUnit test case wrapping the Mustache Spec. * diff --git a/test/Mustache/Test/Functional/NestedPartialIndentTest.php b/test/Mustache/Test/Functional/NestedPartialIndentTest.php index 98e3e09..673339c 100644 --- a/test/Mustache/Test/Functional/NestedPartialIndentTest.php +++ b/test/Mustache/Test/Functional/NestedPartialIndentTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group functional * @group partials diff --git a/test/Mustache/Test/Functional/ObjectSectionTest.php b/test/Mustache/Test/Functional/ObjectSectionTest.php index 97d4baa..963b0f7 100644 --- a/test/Mustache/Test/Functional/ObjectSectionTest.php +++ b/test/Mustache/Test/Functional/ObjectSectionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group sections * @group functional diff --git a/test/Mustache/Test/FunctionalTestCase.php b/test/Mustache/Test/FunctionalTestCase.php index ca33a6e..59185d1 100644 --- a/test/Mustache/Test/FunctionalTestCase.php +++ b/test/Mustache/Test/FunctionalTestCase.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - abstract class Mustache_Test_FunctionalTestCase extends PHPUnit_Framework_TestCase { protected static $tempDir; diff --git a/test/Mustache/Test/HelperCollectionTest.php b/test/Mustache/Test/HelperCollectionTest.php index 6b26e32..df64e97 100644 --- a/test/Mustache/Test/HelperCollectionTest.php +++ b/test/Mustache/Test/HelperCollectionTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Test_HelperCollectionTest extends PHPUnit_Framework_TestCase { public function testConstructor() diff --git a/test/Mustache/Test/Loader/ArrayLoaderTest.php b/test/Mustache/Test/Loader/ArrayLoaderTest.php index 361e0cd..9960c9b 100644 --- a/test/Mustache/Test/Loader/ArrayLoaderTest.php +++ b/test/Mustache/Test/Loader/ArrayLoaderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Loader/CascadingLoaderTest.php b/test/Mustache/Test/Loader/CascadingLoaderTest.php index 96107f7..6d97d8d 100644 --- a/test/Mustache/Test/Loader/CascadingLoaderTest.php +++ b/test/Mustache/Test/Loader/CascadingLoaderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Loader/FilesystemLoaderTest.php b/test/Mustache/Test/Loader/FilesystemLoaderTest.php index ed0cc07..75880d4 100644 --- a/test/Mustache/Test/Loader/FilesystemLoaderTest.php +++ b/test/Mustache/Test/Loader/FilesystemLoaderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Loader/StringLoaderTest.php b/test/Mustache/Test/Loader/StringLoaderTest.php index 3c7ba6d..f2e47d9 100644 --- a/test/Mustache/Test/Loader/StringLoaderTest.php +++ b/test/Mustache/Test/Loader/StringLoaderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Logger/AbstractLoggerTest.php b/test/Mustache/Test/Logger/AbstractLoggerTest.php index cb3d67d..e8865e9 100644 --- a/test/Mustache/Test/Logger/AbstractLoggerTest.php +++ b/test/Mustache/Test/Logger/AbstractLoggerTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/Logger/StreamLoggerTest.php b/test/Mustache/Test/Logger/StreamLoggerTest.php index 8f9c35d..6cb198a 100644 --- a/test/Mustache/Test/Logger/StreamLoggerTest.php +++ b/test/Mustache/Test/Logger/StreamLoggerTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/ParserTest.php b/test/Mustache/Test/ParserTest.php index 87b5709..85e5701 100644 --- a/test/Mustache/Test/ParserTest.php +++ b/test/Mustache/Test/ParserTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/SpecTestCase.php b/test/Mustache/Test/SpecTestCase.php index b50fc62..9fb4a15 100644 --- a/test/Mustache/Test/SpecTestCase.php +++ b/test/Mustache/Test/SpecTestCase.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase { protected static $mustache; diff --git a/test/Mustache/Test/TemplateTest.php b/test/Mustache/Test/TemplateTest.php index a4ce7a9..bb260d2 100644 --- a/test/Mustache/Test/TemplateTest.php +++ b/test/Mustache/Test/TemplateTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/Mustache/Test/TokenizerTest.php b/test/Mustache/Test/TokenizerTest.php index 58a8c5c..09be3fe 100644 --- a/test/Mustache/Test/TokenizerTest.php +++ b/test/Mustache/Test/TokenizerTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - /** * @group unit */ diff --git a/test/fixtures/autoloader/Mustache/Bar.php b/test/fixtures/autoloader/Mustache/Bar.php index 56b6844..8092722 100644 --- a/test/fixtures/autoloader/Mustache/Bar.php +++ b/test/fixtures/autoloader/Mustache/Bar.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Bar { // nada diff --git a/test/fixtures/autoloader/Mustache/Foo.php b/test/fixtures/autoloader/Mustache/Foo.php index ab787a0..7e6ef3a 100644 --- a/test/fixtures/autoloader/Mustache/Foo.php +++ b/test/fixtures/autoloader/Mustache/Foo.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class Mustache_Foo { // nada diff --git a/test/fixtures/autoloader/NonMustacheClass.php b/test/fixtures/autoloader/NonMustacheClass.php index d9ce5af..d8d5929 100644 --- a/test/fixtures/autoloader/NonMustacheClass.php +++ b/test/fixtures/autoloader/NonMustacheClass.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - class NonMustacheClass { // noop From 58f2401d4d39e891e36cca00d26a152443e442c3 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 22:58:58 -0700 Subject: [PATCH 13/15] Minor code style fixes. --- test/bootstrap.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/bootstrap.php b/test/bootstrap.php index 7d8adc7..0c3c631 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - require dirname(__FILE__) . '/../src/Mustache/Autoloader.php'; Mustache_Autoloader::register(); Mustache_Autoloader::register(dirname(__FILE__) . '/../test'); @@ -17,17 +16,18 @@ Mustache_Autoloader::register(dirname(__FILE__) . '/../test'); require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php'; /** - * Minimal stream wrapper to test protocol-based access to templates + * Minimal stream wrapper to test protocol-based access to templates. */ class TestStream { private $filehandle; /** - * Always returns false + * Always returns false. * * @param string $path - * @param int $flags + * @param int $flags + * * @return array */ public function url_stat($path, $flags) @@ -36,16 +36,18 @@ class TestStream } /** - * Open the file + * Open the file. * * @param string $path * @param string $mode + * * @return bool */ public function stream_open($path, $mode) { $path = preg_replace('-^test://-', '', $path); $this->filehandle = fopen($path, $mode); + return $this->filehandle !== false; } @@ -59,6 +61,7 @@ class TestStream /** * @param int $count + * * @return string */ public function stream_read($count) From d4bdf110f9dc7f19aa2c4a53d26115ea5c76504d Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 22:59:23 -0700 Subject: [PATCH 14/15] Always check is_dir() and file_exists() with filesystem streams. --- src/Mustache/Loader/FilesystemLoader.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Mustache/Loader/FilesystemLoader.php b/src/Mustache/Loader/FilesystemLoader.php index 8f84774..a313751 100644 --- a/src/Mustache/Loader/FilesystemLoader.php +++ b/src/Mustache/Loader/FilesystemLoader.php @@ -51,10 +51,10 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader if (strpos($this->baseDir, '://') === false) { $this->baseDir = realpath($this->baseDir); + } - if (!is_dir($this->baseDir)) { - throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); - } + if ($this->shouldCheckPath() && !is_dir($this->baseDir)) { + throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); } if (array_key_exists('extension', $options)) { @@ -98,7 +98,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader { $fileName = $this->getFileName($name); - if (strpos($this->baseDir, '://') === false && !file_exists($fileName)) { + if ($this->shouldCheckPath() && !file_exists($fileName)) { throw new Mustache_Exception_UnknownTemplateException($name); } @@ -121,4 +121,15 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader return $fileName; } + + /** + * Only check if baseDir is a directory and requested templates are files if + * baseDir is using the filesystem stream wrapper. + * + * @return bool Whether to check `is_dir` and `file_exists` + */ + protected function shouldCheckPath() + { + return strpos($this->baseDir, '://') === false || strpos($this->baseDir, 'file://') === 0; + } } From cf4e4c78573f0f1e674fa4114ac329f3eb579d01 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 30 Jul 2016 23:07:36 -0700 Subject: [PATCH 15/15] Bump to v2.11.0 --- src/Mustache/Engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index 8ed7f81..3aeb923 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -23,7 +23,7 @@ */ class Mustache_Engine { - const VERSION = '2.10.0'; + const VERSION = '2.11.0'; const SPEC_VERSION = '1.1.2'; const PRAGMA_FILTERS = 'FILTERS';