Skip to content

Commit

Permalink
Merge branch 'release/2.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Jul 31, 2016
2 parents 0bb2f76 + cf4e4c7 commit 789904e
Show file tree
Hide file tree
Showing 104 changed files with 610 additions and 164 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,4 +9,7 @@ php:
- 7.0
- hhvm

script:
- phpunit

sudo: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion bin/build_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SymfonyClassCollectionLoader
{
private static $loaded;

const HEADER = <<<EOS
const HEADER = <<<'EOS'
<?php
/*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/" }
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache/AbstractCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
6 changes: 3 additions & 3 deletions src/Mustache/Cache/FilesystemCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand All @@ -27,8 +27,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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Cache/NoopCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
21 changes: 12 additions & 9 deletions src/Mustache/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down Expand Up @@ -75,7 +75,7 @@ public function setPragmas(array $pragmas)
/**
* 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)
Expand Down Expand Up @@ -191,7 +191,7 @@ public function renderInternal(Mustache_Context $context, $indent = \'\')
{
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
$buffer = \'\';
$newContext = array();
$blocksContext = array();
%s
return $buffer;
Expand All @@ -207,7 +207,7 @@ class %s extends Mustache_Template
public function renderInternal(Mustache_Context $context, $indent = \'\')
{
$buffer = \'\';
$newContext = array();
$blocksContext = array();
%s
return $buffer;
Expand Down Expand Up @@ -264,7 +264,7 @@ private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)
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.
Expand All @@ -291,7 +291,8 @@ private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
const BLOCK_FUNCTION = '
public function block%s($context)
{
$indent = $buffer = \'\';%s
$indent = $buffer = \'\';
$blocksContext = array();%s
return $buffer;
}
Expand Down Expand Up @@ -326,6 +327,8 @@ private function block($nodes)
private function section%s(Mustache_Context $context, $indent, $value)
{
$buffer = \'\';
$blocksContext = array();
if (%s) {
$source = %s;
$result = call_user_func($value, $source, %s);
Expand Down Expand Up @@ -456,8 +459,8 @@ private function partial($id, $indent, $level)
const PARENT = '
%s
if ($parent = $this->mustache->LoadPartial(%s)) {
$context->pushBlockContext($newContext);
if ($parent = $this->mustache->loadPartial(%s)) {
$context->pushBlockContext($blocksContext);
$buffer .= $parent->renderInternal($context, $indent);
$context->popBlockContext();
}
Expand Down Expand Up @@ -490,7 +493,7 @@ private function parent($id, $indent, array $children, $level)
*
* @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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Mustache/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down Expand Up @@ -150,7 +150,7 @@ public function findDot($id)
*
* @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
*
Expand Down Expand Up @@ -182,7 +182,7 @@ public function findAnchoredDot($id)
*
* @param string $id
*
* @return mixed Variable value, or '' if not found.
* @return mixed Variable value, or '' if not found
*/
public function findInBlock($id)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Mustache/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand All @@ -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';
Expand Down Expand Up @@ -126,7 +126,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())
*/
Expand Down Expand Up @@ -429,7 +429,7 @@ public function removeHelper($name)
/**
* 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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/LogicException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Mustache/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand Down
15 changes: 10 additions & 5 deletions src/Mustache/Exception/SyntaxException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand All @@ -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);
}
}

/**
Expand Down
14 changes: 10 additions & 4 deletions src/Mustache/Exception/UnknownFilterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand All @@ -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()
Expand Down
14 changes: 10 additions & 4 deletions src/Mustache/Exception/UnknownHelperException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* 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.
Expand All @@ -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()
Expand Down
Loading

0 comments on commit 789904e

Please sign in to comment.