projects
/
web/konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
6d07264
)
The Compiler outdent method will now only reduce the indentation if it's OK
author
Chris Sedlmayr
<chris@sedlmayr.co.uk>
Thu, 7 Jun 2012 22:45:55 +0000 (23:45 +0100)
committer
Chris Sedlmayr
<chris@sedlmayr.co.uk>
Thu, 7 Jun 2012 22:45:55 +0000 (23:45 +0100)
to do so, It moves and modifies the check up above the indentation modification.
lib/Twig/Compiler.php
patch
|
blob
|
history
diff --git
a/lib/Twig/Compiler.php
b/lib/Twig/Compiler.php
index
5cd1b31
..
30cba80
100644
(file)
--- a/
lib/Twig/Compiler.php
+++ b/
lib/Twig/Compiler.php
@@
-239,12
+239,13
@@
class Twig_Compiler implements Twig_CompilerInterface
*/
public function outdent($step = 1)
{
- $this->indentation -= $step;
-
- if ($this->indentation < 0) {
+ // can't outdent by more steps that the current indentation level
+ if ($this->indentation < $step) {
throw new Twig_Error('Unable to call outdent() as the indentation would become negative');
}
+ $this->indentation -= $step;
+
return $this;
}
}