[ClassLoader] fixed PHP warning on PHP 5.3

This commit is contained in:
Fabien Potencier 2014-06-26 08:10:31 +02:00
parent 803b06b2a4
commit 7b2e3d91d8
1 changed files with 5 additions and 2 deletions

View File

@ -11,6 +11,10 @@
namespace Symfony\Component\ClassLoader;
if (!defined('T_TRAIT')) {
define('T_TRAIT', 0);
}
/**
* ClassMapGenerator
*
@ -84,7 +88,6 @@ class ClassMapGenerator
{
$contents = file_get_contents($path);
$tokens = token_get_all($contents);
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
$classes = array();
@ -111,7 +114,7 @@ class ClassMapGenerator
break;
case T_CLASS:
case T_INTERFACE:
case $T_TRAIT:
case T_TRAIT:
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {