Skip to content

Commit

Permalink
bug #2507 Move class_exists() at the bottom of files (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Move class_exists() at the bottom of files

Fixes #2503
Closes #2506

Commits
-------

95e912b Move class_exists() at the bottom of files
  • Loading branch information
fabpot committed Jun 7, 2017
2 parents c071a2e + 95e912b commit a9fe0a9
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 27 deletions.
5 changes: 2 additions & 3 deletions lib/Twig/BaseNodeVisitor.php
Expand Up @@ -9,9 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Environment');
class_exists('Twig_Node');

/**
* Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x.
*
Expand Down Expand Up @@ -53,3 +50,5 @@ abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
}

class_alias('Twig_BaseNodeVisitor', 'Twig\NodeVisitor\AbstractNodeVisitor', false);
class_exists('Twig_Environment');
class_exists('Twig_Node');
3 changes: 1 addition & 2 deletions lib/Twig/Compiler.php
Expand Up @@ -10,8 +10,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Node');

/**
* Compiles a node to PHP code.
*
Expand Down Expand Up @@ -283,3 +281,4 @@ public function getVarName()
}

class_alias('Twig_Compiler', 'Twig\Compiler', false);
class_exists('Twig_Node');
3 changes: 1 addition & 2 deletions lib/Twig/Error.php
Expand Up @@ -9,8 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Source');

/**
* Twig base exception.
*
Expand Down Expand Up @@ -362,3 +360,4 @@ protected function guessTemplateInfo()
}

class_alias('Twig_Error', 'Twig\Error\Error', false);
class_exists('Twig_Source');
3 changes: 1 addition & 2 deletions lib/Twig/Extension.php
Expand Up @@ -9,8 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Environment');

abstract class Twig_Extension implements Twig_ExtensionInterface
{
/**
Expand Down Expand Up @@ -68,3 +66,4 @@ public function getName()
}

class_alias('Twig_Extension', 'Twig\Extension\AbstractExtension', false);
class_exists('Twig_Environment');
3 changes: 1 addition & 2 deletions lib/Twig/Extension/Profiler.php
Expand Up @@ -9,8 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Profiler_Profile');

class Twig_Extension_Profiler extends Twig_Extension
{
private $actives = array();
Expand Down Expand Up @@ -48,3 +46,4 @@ public function getName()
}

class_alias('Twig_Extension_Profiler', 'Twig\Extension\ProfilerExtension', false);
class_exists('Twig_Profiler_Profile');
3 changes: 1 addition & 2 deletions lib/Twig/ExtensionInterface.php
Expand Up @@ -9,8 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Environment');

/**
* Interface implemented by extension classes.
*
Expand Down Expand Up @@ -89,3 +87,4 @@ public function getName();
}

class_alias('Twig_ExtensionInterface', 'Twig\Extension\ExtensionInterface', false);
class_exists('Twig_Environment');
3 changes: 1 addition & 2 deletions lib/Twig/Node.php
Expand Up @@ -10,8 +10,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Compiler');

/**
* Represents a node in the AST.
*
Expand Down Expand Up @@ -255,3 +253,4 @@ public function getFilename()
}

class_alias('Twig_Node', 'Twig\Node\Node', false);
class_exists('Twig_Compiler');
5 changes: 2 additions & 3 deletions lib/Twig/NodeVisitorInterface.php
Expand Up @@ -9,9 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Environment');
class_exists('Twig_Node');

/**
* Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
*
Expand Down Expand Up @@ -44,3 +41,5 @@ public function getPriority();
}

class_alias('Twig_NodeVisitorInterface', 'Twig\NodeVisitor\NodeVisitorInterface', false);
class_exists('Twig_Environment');
class_exists('Twig_Node');
5 changes: 2 additions & 3 deletions lib/Twig/Parser.php
Expand Up @@ -10,9 +10,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Node');
class_exists('Twig_TokenStream');

/**
* Default parser implementation.
*
Expand Down Expand Up @@ -409,3 +406,5 @@ protected function filterBodyNodes(Twig_NodeInterface $node)
}

class_alias('Twig_Parser', 'Twig\Parser', false);
class_exists('Twig_Node');
class_exists('Twig_TokenStream');
5 changes: 2 additions & 3 deletions lib/Twig/Test/NodeTestCase.php
Expand Up @@ -9,9 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Environment');
class_exists('Twig_Node');

use PHPUnit\Framework\TestCase;

abstract class Twig_Test_NodeTestCase extends TestCase
Expand Down Expand Up @@ -74,3 +71,5 @@ protected function getAttributeGetter()
}

class_alias('Twig_Test_NodeTestCase', 'Twig\Test\NodeTestCase', false);
class_exists('Twig_Environment');
class_exists('Twig_Node');
5 changes: 2 additions & 3 deletions lib/Twig/TokenParserInterface.php
Expand Up @@ -9,9 +9,6 @@
* file that was distributed with this source code.
*/

class_exists('Twig_Parser');
class_exists('Twig_Token');

/**
* Interface implemented by token parsers.
*
Expand Down Expand Up @@ -42,3 +39,5 @@ public function getTag();
}

class_alias('Twig_TokenParserInterface', 'Twig\TokenParser\TokenParserInterface', false);
class_exists('Twig_Parser');
class_exists('Twig_Token');

0 comments on commit a9fe0a9

Please sign in to comment.