bug #11234 [ClassLoader] fixed PHP warning on PHP 5.3 (fabpot)

This PR was merged into the 2.3 branch.

Discussion
----------

[ClassLoader] fixed PHP warning on PHP 5.3

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

7b2e3d9 [ClassLoader] fixed PHP warning on PHP 5.3
This commit is contained in:
Fabien Potencier 2014-06-29 11:45:08 +02:00
commit 8a68e6c77e

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]) {