Skip to content

Commit

Permalink
fixed compatibility with PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 21, 2016
1 parent 620c867 commit 885b3f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Latte/Compiler/PhpWriter.php
Expand Up @@ -70,7 +70,7 @@ function ($m) use ($word, & $args) {
case '':
$arg = next($args); break;
default:
$arg = $args[$source + 1]; break;
$arg = $args[(int) $source + 1]; break;
}

switch ($format) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Latte/expected/filters.general.phtml
Expand Up @@ -12,7 +12,7 @@ class Template%a% extends Latte\Runtime\Template
<li>upper: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->upper, $hello)) /* line 3 */ ?></li>
<li>lower & capitalize: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->capitalize, call_user_func($this->filters->lower, $hello))) /* line 4 */ ?></li>
<li>breaklines: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->breaklines, $hello)) /* line 5 */ ?></li>
<li>truncate: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->lower, call_user_func($this->filters->truncate, $hello, "10 "))) /* line 6 */ ?></li>
<li>truncate: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->lower, call_user_func($this->filters->truncate, $hello, "10"))) /* line 6 */ ?></li>
<li>date: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->date, $date, '%d.%m.%Y %H:%M:%S')) /* line 7 */ ?></li>
<li>translated: <?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->truncate, call_user_func($this->filters->translate, $hello), 3)) ?></li>
<li>Translated HTML: <?php ob_start(function () {}) ?>ahoj<?php
Expand All @@ -35,8 +35,8 @@ class Template%a% extends Latte\Runtime\Template
</ul>

<ul>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, $hello*0, 0, 0.0, "0")) /* line 24 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, $hello*1, 1, "1")) /* line 25 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, (int)$hello*0, 0, 0.0, "0")) /* line 24 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, (int)$hello*1, 1, "1")) /* line 25 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, $hello, true, null, false)) /* line 26 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, $hello, TRUE, NULL, FALSE)) /* line 27 */ ?></li>
<li><?php echo LR\Filters::escapeHtmlText(call_user_func($this->filters->types, $hello, '', "", "$hello")) /* line 28 */ ?></li>
Expand Down
6 changes: 3 additions & 3 deletions tests/Latte/templates/filters.general.latte
Expand Up @@ -3,7 +3,7 @@
<li>upper: {$hello |upper}</li>
<li>lower & capitalize: {$hello |lower|capitalize}</li>
<li>breaklines: {$hello |breakLines}</li>
<li>truncate: {$hello |truncate:"10 "|lower}</li>
<li>truncate: {$hello |truncate:"10"|lower}</li>
<li>date: {$date|date:'%d.%m.%Y %H:%M:%S'}</li>
<li>translated: {_$hello|truncate:3}</li>
<li>Translated HTML: {_}ahoj{/_}</li>
Expand All @@ -21,8 +21,8 @@
</ul>

<ul>
<li>{$hello*0 |types:0,0.0,"0"}</li>
<li>{$hello*1 |types:1:"1"}</li>
<li>{(int)$hello*0 |types:0,0.0,"0"}</li>
<li>{(int)$hello*1 |types:1:"1"}</li>
<li>{$hello |types:true,null,false}</li>
<li>{$hello |types:TRUE,NULL,FALSE}</li>
<li>{$hello |types:'',"","$hello"}</li>
Expand Down

0 comments on commit 885b3f5

Please sign in to comment.