Compare commits

...

13 Commits
v2.2.0 ... 2.2

Author SHA1 Message Date
Fabien Potencier
0a5217edb6 fixed @expectedException class names 2013-11-25 09:44:14 +01:00
bronze1man
77f69969b1 Fix some annotates 2013-09-19 11:36:05 +02:00
Fabien Potencier
8478872572 updated the composer install command to reflect changes in Composer 2013-09-18 09:27:26 +02:00
Lee Rowlands
827c54ee98 Use strstr instead of strpos 2013-08-09 09:16:43 +02:00
Fabien Potencier
dcee47cd55 Merge branch '2.1' into 2.2
* 2.1:
  bumped Symfony version to 2.1.11-DEV
  updated VERSION for 2.1.10
  update CONTRIBUTORS for 2.1.10
  updated CHANGELOG for 2.1.10
  fixed CS
  [Process] Cleanup tests & prevent assertion that kills randomly Travis-CI
  [Filesystem] Fix regression introduced in 10dea948

Conflicts:
	src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php
	src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php
2013-05-06 22:02:13 +02:00
Fabien Potencier
0e9d7c1215 fixed CS 2013-05-06 12:48:41 +02:00
Fabien Potencier
1c37a180ab [ClassLoader] fixed heredocs handling
The end of an hereodc must have a newline to avoid PHP syntax errors.
2013-03-19 09:32:26 +01:00
Fabien Potencier
1fe171b104 fixed handling of heredocs 2013-03-19 09:20:23 +01:00
Fabien Potencier
40585c3fec Merge branch '2.1' into 2.2
* 2.1:
  [FrameworkBundle] Fix code status in dockblock
  Fixed test to use Reflection
  [Finder] fixed a potential issue on Solaris where INF value is wrong (refs #7269)
  Update RouteCompiler.php
  [FrameworkBundle] avoids cache:clear to break if new/old folders already exist
  [HttpKernel] Fixed possible profiler token collision (closes #7272, closes #7171)
  [ClassLoader] tweaked test
  [ClassLoader] made DebugClassLoader idempotent
  [DomCrawler] Fix relative path handling in links

Conflicts:
	src/Symfony/Component/DomCrawler/Link.php
	src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php
	src/Symfony/Component/Routing/RouteCompiler.php
2013-03-11 18:18:44 +01:00
Tim Nagel
05639e1018 Fixed test to use Reflection 2013-03-08 15:45:32 +11:00
Kris Wallsmith
4288c63972 [ClassLoader] tweaked test 2013-03-03 08:31:27 -08:00
Kris Wallsmith
bdb7ba2680 [ClassLoader] made DebugClassLoader idempotent 2013-03-02 11:24:53 -08:00
Fabien Potencier
dc06308090 fixed CS 2013-03-01 11:42:10 +01:00
8 changed files with 82 additions and 24 deletions

View File

@@ -169,18 +169,19 @@ class ClassCollectionLoader
$inNamespace = false;
prev($tokens);
} else {
$rawChunk = rtrim($rawChunk) . "\n{";
$rawChunk = rtrim($rawChunk)."\n{";
$inNamespace = true;
}
} elseif (T_START_HEREDOC === $token[0]) {
$output .= self::compressCode($rawChunk) . $token[1];
$output .= self::compressCode($rawChunk).$token[1];
do {
$token = next($tokens);
$output .= $token[1];
$output .= is_string($token) ? $token : $token[1];
} while ($token[0] !== T_END_HEREDOC);
$output .= "\n";
$rawChunk = '';
} elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) {
$output .= self::compressCode($rawChunk) . $token[1];
$output .= self::compressCode($rawChunk).$token[1];
$rawChunk = '';
} else {
$rawChunk .= $token[1];
@@ -191,7 +192,7 @@ class ClassCollectionLoader
$rawChunk .= "}\n";
}
return $output . self::compressCode($rawChunk);
return $output.self::compressCode($rawChunk);
}
/**
@@ -360,6 +361,7 @@ class ClassCollectionLoader
}
$resolved[$nodeName] = $node;
unset($unresolved[$nodeName]);
return $resolved;
}
}

View File

@@ -181,7 +181,7 @@ class ClassLoader
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
if ($class === strstr($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;

View File

@@ -39,7 +39,7 @@ class ClassMapGenerator
/**
* Iterate over all files in the given directory searching for classes
*
* @param Iterator|string $dir The directory to search in or an iterator
* @param \Iterator|string $dir The directory to search in or an iterator
*
* @return array A class map array
*/

View File

@@ -53,7 +53,7 @@ class DebugClassLoader
}
foreach ($functions as $function) {
if (is_array($function) && method_exists($function[0], 'findFile')) {
if (is_array($function) && !$function[0] instanceof self && method_exists($function[0], 'findFile')) {
$function = array(new static($function[0]), 'loadClass');
}

View File

@@ -65,5 +65,5 @@ Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/ClassLoader/
$ composer.phar install --dev
$ composer.phar install
$ phpunit

View File

@@ -189,7 +189,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException InvalidArgumentException
* @expectedException \InvalidArgumentException
*/
public function testUnableToLoadClassException()
{
@@ -206,7 +206,9 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
unlink($file);
}
spl_autoload_register($r = function ($class) {
require_once __DIR__.'/Fixtures/'.str_replace(array('\\', '_'), '/', $class).'.php';
if (0 === strpos($class, 'Namespaced') || 0 === strpos($class, 'Pearlike_')) {
require_once __DIR__.'/Fixtures/'.str_replace(array('\\', '_'), '/', $class).'.php';
}
});
ClassCollectionLoader::load(
@@ -225,21 +227,23 @@ class WithComments
{
public static \$loaded = true;
}
\$string ='string shoult not be modified';
\$heredoc =<<<HD
\$string ='string shoult not be modified {\$string}';
\$heredoc = (<<<HD
Heredoc should not be modified
Heredoc should not be modified {\$string}
HD;
HD
);
\$nowdoc =<<<'ND'
Nowdoc should not be modified
Nowdoc should not be modified {\$string}
ND;
ND
;
}
namespace
{

View File

@@ -0,0 +1,52 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\ClassLoader\Tests;
use Symfony\Component\ClassLoader\ClassLoader;
use Symfony\Component\ClassLoader\DebugClassLoader;
class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
{
private $loader;
protected function setUp()
{
$this->loader = new ClassLoader();
spl_autoload_register(array($this->loader, 'loadClass'));
}
protected function tearDown()
{
spl_autoload_unregister(array($this->loader, 'loadClass'));
}
public function testIdempotence()
{
DebugClassLoader::enable();
DebugClassLoader::enable();
$functions = spl_autoload_functions();
foreach ($functions as $function) {
if (is_array($function) && $function[0] instanceof DebugClassLoader) {
$reflClass = new \ReflectionClass($function[0]);
$reflProp = $reflClass->getProperty('classFinder');
$reflProp->setAccessible(true);
$this->assertNotInstanceOf('Symfony\Component\ClassLoader\DebugClassLoader', $reflProp->getValue($function[0]));
return;
}
}
throw new \Exception('DebugClassLoader did not register');
}
}

View File

@@ -17,21 +17,21 @@ class WithComments
public static $loaded = true;
}
$string = 'string shoult not be modified';
$string = 'string shoult not be modified {$string}';
$heredoc = (<<<HD
$heredoc = <<<HD
Heredoc should not be modified {$string}
Heredoc should not be modified
HD;
HD
);
$nowdoc = <<<'ND'
Nowdoc should not be modified
Nowdoc should not be modified {$string}
ND;