Compare commits

..

2 Commits
v2.0.17 ... 2.0

Author SHA1 Message Date
Fabien Potencier
3527a2b300 updated license year 2013-01-04 17:59:43 +01:00
Fabien Potencier
c393e86a03 [ClassLoader] fixed unbracketed namespaces (closes #5747) 2012-10-27 17:55:46 +02:00
2 changed files with 15 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ namespace Symfony\Component\ClassLoader;
class ClassCollectionLoader
{
private static $loaded;
private static $useTokenizer = true;
/**
* Loads a list of classes and caches them in one big file.
@@ -125,7 +126,11 @@ class ClassCollectionLoader
*/
public static function fixNamespaceDeclarations($source)
{
if (!function_exists('token_get_all')) {
if (!function_exists('token_get_all') || !self::$useTokenizer) {
if (preg_match('/namespace(.*?)\s*;/', $source)) {
$source = preg_replace('/namespace(.*?)(\s*);/', "namespace$1$2\n{", $source)."}\n";
}
return $source;
}
@@ -219,4 +224,12 @@ class ClassCollectionLoader
return $output;
}
/**
* This method is only useful for testing.
*/
public static function enableTokenizer($bool)
{
self::$useTokenizer = (Boolean) $bool;
}
}

View File

@@ -1,4 +1,4 @@
Copyright (c) 2004-2012 Fabien Potencier
Copyright (c) 2004-2013 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal