Remove aligned '=>' and '='

This commit is contained in:
Disquedur 2014-10-22 20:27:13 +02:00 committed by Fabien Potencier
parent 91fde699aa
commit 51312d31cc
239 changed files with 1454 additions and 1455 deletions

View File

@ -1107,7 +1107,7 @@
```php ```php
$view->vars = array_replace($view->vars, array( $view->vars = array_replace($view->vars, array(
'help' => 'A text longer than six characters', 'help' => 'A text longer than six characters',
'error_class' => 'max_length_error', 'error_class' => 'max_length_error',
)); ));
``` ```

View File

@ -59,9 +59,9 @@ class DoctrineDataCollector extends DataCollector
} }
$this->data = array( $this->data = array(
'queries' => $queries, 'queries' => $queries,
'connections' => $this->connections, 'connections' => $this->connections,
'managers' => $this->managers, 'managers' => $this->managers,
); );
} }

View File

@ -52,7 +52,7 @@ abstract class AbstractDoctrineExtension extends Extension
foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) { foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
if (!isset($objectManager['mappings'][$bundle])) { if (!isset($objectManager['mappings'][$bundle])) {
$objectManager['mappings'][$bundle] = array( $objectManager['mappings'][$bundle] = array(
'mapping' => true, 'mapping' => true,
'is_bundle' => true, 'is_bundle' => true,
); );
} }
@ -65,8 +65,8 @@ abstract class AbstractDoctrineExtension extends Extension
} }
$mappingConfig = array_replace(array( $mappingConfig = array_replace(array(
'dir' => false, 'dir' => false,
'type' => false, 'type' => false,
'prefix' => false, 'prefix' => false,
), (array) $mappingConfig); ), (array) $mappingConfig);

View File

@ -160,13 +160,13 @@ abstract class DoctrineType extends AbstractType
}; };
$resolver->setDefaults(array( $resolver->setDefaults(array(
'em' => null, 'em' => null,
'property' => null, 'property' => null,
'query_builder' => null, 'query_builder' => null,
'loader' => $loader, 'loader' => $loader,
'choices' => null, 'choices' => null,
'choice_list' => $choiceList, 'choice_list' => $choiceList,
'group_by' => null, 'group_by' => null,
)); ));
$resolver->setRequired(array('class')); $resolver->setRequired(array('class'));

View File

@ -63,7 +63,7 @@ class DoctrineTokenProvider implements TokenProviderInterface
$sql = 'SELECT class, username, value, lastUsed' $sql = 'SELECT class, username, value, lastUsed'
.' FROM rememberme_token WHERE series=:series'; .' FROM rememberme_token WHERE series=:series';
$paramValues = array('series' => $series); $paramValues = array('series' => $series);
$paramTypes = array('series' => \PDO::PARAM_STR); $paramTypes = array('series' => \PDO::PARAM_STR);
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes); $stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
$row = $stmt->fetch(\PDO::FETCH_ASSOC); $row = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($row) { if ($row) {
@ -85,7 +85,7 @@ class DoctrineTokenProvider implements TokenProviderInterface
{ {
$sql = 'DELETE FROM rememberme_token WHERE series=:series'; $sql = 'DELETE FROM rememberme_token WHERE series=:series';
$paramValues = array('series' => $series); $paramValues = array('series' => $series);
$paramTypes = array('series' => \PDO::PARAM_STR); $paramTypes = array('series' => \PDO::PARAM_STR);
$this->conn->executeUpdate($sql, $paramValues, $paramTypes); $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
} }
@ -96,12 +96,12 @@ class DoctrineTokenProvider implements TokenProviderInterface
{ {
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed' $sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed'
.' WHERE series=:series'; .' WHERE series=:series';
$paramValues = array('value' => $tokenValue, $paramValues = array('value' => $tokenValue,
'lastUsed' => $lastUsed, 'lastUsed' => $lastUsed,
'series' => $series,); 'series' => $series,);
$paramTypes = array('value' => \PDO::PARAM_STR, $paramTypes = array('value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME, 'lastUsed' => DoctrineType::DATETIME,
'series' => \PDO::PARAM_STR,); 'series' => \PDO::PARAM_STR,);
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes); $updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
if ($updated < 1) { if ($updated < 1) {
throw new TokenNotFoundException('No token found.'); throw new TokenNotFoundException('No token found.');
@ -116,15 +116,15 @@ class DoctrineTokenProvider implements TokenProviderInterface
$sql = 'INSERT INTO rememberme_token' $sql = 'INSERT INTO rememberme_token'
.' (class, username, series, value, lastUsed)' .' (class, username, series, value, lastUsed)'
.' VALUES (:class, :username, :series, :value, :lastUsed)'; .' VALUES (:class, :username, :series, :value, :lastUsed)';
$paramValues = array('class' => $token->getClass(), $paramValues = array('class' => $token->getClass(),
'username' => $token->getUsername(), 'username' => $token->getUsername(),
'series' => $token->getSeries(), 'series' => $token->getSeries(),
'value' => $token->getTokenValue(), 'value' => $token->getTokenValue(),
'lastUsed' => $token->getLastUsed(),); 'lastUsed' => $token->getLastUsed(),);
$paramTypes = array('class' => \PDO::PARAM_STR, $paramTypes = array('class' => \PDO::PARAM_STR,
'username' => \PDO::PARAM_STR, 'username' => \PDO::PARAM_STR,
'series' => \PDO::PARAM_STR, 'series' => \PDO::PARAM_STR,
'value' => \PDO::PARAM_STR, 'value' => \PDO::PARAM_STR,
'lastUsed' => DoctrineType::DATETIME,); 'lastUsed' => DoctrineType::DATETIME,);
$this->conn->executeUpdate($sql, $paramValues, $paramTypes); $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
} }

View File

@ -30,8 +30,8 @@ class ContainerAwareLoaderTest extends \PHPUnit_Framework_TestCase
public function testShouldSetContainerOnContainerAwareFixture() public function testShouldSetContainerOnContainerAwareFixture()
{ {
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$loader = new ContainerAwareLoader($container); $loader = new ContainerAwareLoader($container);
$fixture = new ContainerAwareFixture(); $fixture = new ContainerAwareFixture();
$loader->addFixture($fixture); $loader->addFixture($fixture);

View File

@ -68,7 +68,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
; ;
$dbalLogger->startQuery('SQL', array( $dbalLogger->startQuery('SQL', array(
'utf8' => 'foo', 'utf8' => 'foo',
'nonutf8' => "\x7F\xFF", 'nonutf8' => "\x7F\xFF",
)); ));
} }
@ -97,7 +97,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
$dbalLogger->startQuery('SQL', array( $dbalLogger->startQuery('SQL', array(
'short' => $shortString, 'short' => $shortString,
'long' => $longString, 'long' => $longString,
)); ));
} }
@ -135,7 +135,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
$dbalLogger->startQuery('SQL', array( $dbalLogger->startQuery('SQL', array(
'short' => $shortString, 'short' => $shortString,
'long' => $longString, 'long' => $longString,
)); ));
} }
} }

View File

@ -30,11 +30,11 @@ class DebugHandler extends TestHandler implements DebugLoggerInterface
$records = array(); $records = array();
foreach ($this->records as $record) { foreach ($this->records as $record) {
$records[] = array( $records[] = array(
'timestamp' => $record['datetime']->getTimestamp(), 'timestamp' => $record['datetime']->getTimestamp(),
'message' => $record['message'], 'message' => $record['message'],
'priority' => $record['level'], 'priority' => $record['level'],
'priorityName' => $record['level_name'], 'priorityName' => $record['level_name'],
'context' => $record['context'], 'context' => $record['context'],
); );
} }

View File

@ -28,11 +28,11 @@ class WebProcessorTest extends \PHPUnit_Framework_TestCase
public function testUsesRequestServerData() public function testUsesRequestServerData()
{ {
$server = array( $server = array(
'REQUEST_URI' => 'A', 'REQUEST_URI' => 'A',
'REMOTE_ADDR' => 'B', 'REMOTE_ADDR' => 'B',
'REQUEST_METHOD' => 'C', 'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'D', 'SERVER_NAME' => 'D',
'HTTP_REFERER' => 'E', 'HTTP_REFERER' => 'E',
); );
$request = new Request(); $request = new Request();

View File

@ -55,8 +55,8 @@ class PropelDataCollector extends DataCollector
public function collect(Request $request, Response $response, \Exception $exception = null) public function collect(Request $request, Response $response, \Exception $exception = null)
{ {
$this->data = array( $this->data = array(
'queries' => $this->buildQueries(), 'queries' => $this->buildQueries(),
'querycount' => $this->countQueries(), 'querycount' => $this->countQueries(),
); );
} }
@ -118,16 +118,16 @@ class PropelDataCollector extends DataCollector
$innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': '); $innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');
foreach ($this->logger->getQueries() as $q) { foreach ($this->logger->getQueries() as $q) {
$parts = explode($outerGlue, $q, 4); $parts = explode($outerGlue, $q, 4);
$times = explode($innerGlue, $parts[0]); $times = explode($innerGlue, $parts[0]);
$con = explode($innerGlue, $parts[2]); $con = explode($innerGlue, $parts[2]);
$memories = explode($innerGlue, $parts[1]); $memories = explode($innerGlue, $parts[1]);
$sql = trim($parts[3]); $sql = trim($parts[3]);
$con = trim($con[1]); $con = trim($con[1]);
$time = trim($times[1]); $time = trim($times[1]);
$memory = trim($memories[1]); $memory = trim($memories[1]);
$queries[] = array('connection' => $con, 'sql' => $sql, 'time' => $time, 'memory' => $memory); $queries[] = array('connection' => $con, 'sql' => $sql, 'time' => $time, 'memory' => $memory);
} }

View File

@ -14,7 +14,6 @@ namespace Symfony\Bridge\Propel1\Form\ChoiceList;
use \ModelCriteria; use \ModelCriteria;
use \BaseObject; use \BaseObject;
use \Persistent; use \Persistent;
use Symfony\Component\Form\Exception\StringCastException; use Symfony\Component\Form\Exception\StringCastException;
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList; use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
@ -86,9 +85,9 @@ class ModelChoiceList extends ObjectChoiceList
*/ */
public function __construct($class, $labelPath = null, $choices = null, $queryObject = null, $groupPath = null, $preferred = array(), PropertyAccessorInterface $propertyAccessor = null) public function __construct($class, $labelPath = null, $choices = null, $queryObject = null, $groupPath = null, $preferred = array(), PropertyAccessorInterface $propertyAccessor = null)
{ {
$this->class = $class; $this->class = $class;
$queryClass = $this->class.'Query'; $queryClass = $this->class.'Query';
if (!class_exists($queryClass)) { if (!class_exists($queryClass)) {
if (empty($this->class)) { if (empty($this->class)) {
throw new MissingOptionsException('The "class" parameter is empty, you should provide the model class'); throw new MissingOptionsException('The "class" parameter is empty, you should provide the model class');
@ -96,11 +95,11 @@ class ModelChoiceList extends ObjectChoiceList
throw new InvalidOptionsException(sprintf('The query class "%s" is not found, you should provide the FQCN of the model class', $queryClass)); throw new InvalidOptionsException(sprintf('The query class "%s" is not found, you should provide the FQCN of the model class', $queryClass));
} }
$query = new $queryClass(); $query = new $queryClass();
$this->query = $queryObject ?: $query; $this->query = $queryObject ?: $query;
$this->identifier = $this->query->getTableMap()->getPrimaryKeys(); $this->identifier = $this->query->getTableMap()->getPrimaryKeys();
$this->loaded = is_array($choices) || $choices instanceof \Traversable; $this->loaded = is_array($choices) || $choices instanceof \Traversable;
if ($preferred instanceof ModelCriteria) { if ($preferred instanceof ModelCriteria) {
$this->preferredQuery = $preferred->mergeWith($this->query); $this->preferredQuery = $preferred->mergeWith($this->query);

View File

@ -38,22 +38,22 @@ class PropelTypeGuesser implements FormTypeGuesserInterface
if ($relation->getType() === \RelationMap::MANY_TO_ONE) { if ($relation->getType() === \RelationMap::MANY_TO_ONE) {
if (strtolower($property) === strtolower($relation->getName())) { if (strtolower($property) === strtolower($relation->getName())) {
return new TypeGuess('model', array( return new TypeGuess('model', array(
'class' => $relation->getForeignTable()->getClassName(), 'class' => $relation->getForeignTable()->getClassName(),
'multiple' => false, 'multiple' => false,
), Guess::HIGH_CONFIDENCE); ), Guess::HIGH_CONFIDENCE);
} }
} elseif ($relation->getType() === \RelationMap::ONE_TO_MANY) { } elseif ($relation->getType() === \RelationMap::ONE_TO_MANY) {
if (strtolower($property) === strtolower($relation->getPluralName())) { if (strtolower($property) === strtolower($relation->getPluralName())) {
return new TypeGuess('model', array( return new TypeGuess('model', array(
'class' => $relation->getForeignTable()->getClassName(), 'class' => $relation->getForeignTable()->getClassName(),
'multiple' => true, 'multiple' => true,
), Guess::HIGH_CONFIDENCE); ), Guess::HIGH_CONFIDENCE);
} }
} elseif ($relation->getType() === \RelationMap::MANY_TO_MANY) { } elseif ($relation->getType() === \RelationMap::MANY_TO_MANY) {
if (strtolower($property) == strtolower($relation->getPluralName())) { if (strtolower($property) == strtolower($relation->getPluralName())) {
return new TypeGuess('model', array( return new TypeGuess('model', array(
'class' => $relation->getLocalTable()->getClassName(), 'class' => $relation->getLocalTable()->getClassName(),
'multiple' => true, 'multiple' => true,
), Guess::HIGH_CONFIDENCE); ), Guess::HIGH_CONFIDENCE);
} }
} }

View File

@ -84,16 +84,16 @@ class ModelType extends AbstractType
}; };
$resolver->setDefaults(array( $resolver->setDefaults(array(
'template' => 'choice', 'template' => 'choice',
'multiple' => false, 'multiple' => false,
'expanded' => false, 'expanded' => false,
'class' => null, 'class' => null,
'property' => null, 'property' => null,
'query' => null, 'query' => null,
'choices' => null, 'choices' => null,
'choice_list' => $choiceList, 'choice_list' => $choiceList,
'group_by' => null, 'group_by' => null,
'by_reference' => false, 'by_reference' => false,
)); ));
} }

View File

@ -47,8 +47,8 @@ class PropelLogger
*/ */
public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null) public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null)
{ {
$this->logger = $logger; $this->logger = $logger;
$this->queries = array(); $this->queries = array();
$this->stopwatch = $stopwatch; $this->stopwatch = $stopwatch;
$this->isPrepared = false; $this->isPrepared = false;
} }

View File

@ -63,7 +63,7 @@ class PropelUserProvider implements UserProviderInterface
public function loadUserByUsername($username) public function loadUserByUsername($username)
{ {
$queryClass = $this->queryClass; $queryClass = $this->queryClass;
$query = $queryClass::create(); $query = $queryClass::create();
if (null !== $this->property) { if (null !== $this->property) {
$filter = 'filterBy'.ucfirst($this->property); $filter = 'filterBy'.ucfirst($this->property);

View File

@ -45,10 +45,10 @@ class PropelDataCollectorTest extends Propel1TestCase
$this->assertEquals(array( $this->assertEquals(array(
array( array(
'sql' => "SET NAMES 'utf8'", 'sql' => "SET NAMES 'utf8'",
'time' => '0.000 sec', 'time' => '0.000 sec',
'connection' => 'default', 'connection' => 'default',
'memory' => '1.4 MB', 'memory' => '1.4 MB',
), ),
), $c->getQueries()); ), $c->getQueries());
$this->assertEquals(1, $c->getQueryCount()); $this->assertEquals(1, $c->getQueryCount());
@ -67,22 +67,22 @@ class PropelDataCollectorTest extends Propel1TestCase
$this->assertEquals(array( $this->assertEquals(array(
array( array(
'sql' => "SET NAMES 'utf8'", 'sql' => "SET NAMES 'utf8'",
'time' => '0.000 sec', 'time' => '0.000 sec',
'connection' => 'default', 'connection' => 'default',
'memory' => '1.4 MB', 'memory' => '1.4 MB',
), ),
array( array(
'sql' => "SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12", 'sql' => "SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
'time' => '0.012 sec', 'time' => '0.012 sec',
'connection' => 'default', 'connection' => 'default',
'memory' => '2.4 MB', 'memory' => '2.4 MB',
), ),
array( array(
'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')", 'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
'time' => '0.012 sec', 'time' => '0.012 sec',
'connection' => 'default', 'connection' => 'default',
'memory' => '2.4 MB', 'memory' => '2.4 MB',
), ),
), $c->getQueries()); ), $c->getQueries());
$this->assertEquals(3, $c->getQueryCount()); $this->assertEquals(3, $c->getQueryCount());

View File

@ -14,12 +14,12 @@ namespace Symfony\Bridge\Propel1\Tests\Fixtures;
class ItemQuery class ItemQuery
{ {
private $map = array( private $map = array(
'id' => \PropelColumnTypes::INTEGER, 'id' => \PropelColumnTypes::INTEGER,
'value' => \PropelColumnTypes::VARCHAR, 'value' => \PropelColumnTypes::VARCHAR,
'price' => \PropelColumnTypes::FLOAT, 'price' => \PropelColumnTypes::FLOAT,
'is_active' => \PropelColumnTypes::BOOLEAN, 'is_active' => \PropelColumnTypes::BOOLEAN,
'enabled' => \PropelColumnTypes::BOOLEAN_EMU, 'enabled' => \PropelColumnTypes::BOOLEAN_EMU,
'updated_at' => \PropelColumnTypes::TIMESTAMP, 'updated_at' => \PropelColumnTypes::TIMESTAMP,
); );
public static $result = array(); public static $result = array();

View File

@ -93,10 +93,10 @@ class CollectionToArrayTransformerTest extends Propel1TestCase
public function testReverseTransformWithData() public function testReverseTransformWithData()
{ {
$inputData = array('foo', 'bar'); $inputData = array('foo', 'bar');
$result = $this->transformer->reverseTransform($inputData); $result = $this->transformer->reverseTransform($inputData);
$data = $result->getData(); $data = $result->getData();
$this->assertInstanceOf('\PropelObjectCollection', $result); $this->assertInstanceOf('\PropelObjectCollection', $result);

View File

@ -40,9 +40,9 @@ class RuntimeInstantiatorTest extends \PHPUnit_Framework_TestCase
public function testInstantiateProxy() public function testInstantiateProxy()
{ {
$instance = new \stdClass(); $instance = new \stdClass();
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$definition = new Definition('stdClass'); $definition = new Definition('stdClass');
$instantiator = function () use ($instance) { $instantiator = function () use ($instance) {
return $instance; return $instance;
}; };

View File

@ -50,10 +50,10 @@ class MessageDataCollector extends DataCollector
// only collect when Swiftmailer has already been initialized // only collect when Swiftmailer has already been initialized
if (class_exists('Swift_Mailer', false)) { if (class_exists('Swift_Mailer', false)) {
$logger = $this->container->get('swiftmailer.plugin.messagelogger'); $logger = $this->container->get('swiftmailer.plugin.messagelogger');
$this->data['messages'] = $logger->getMessages(); $this->data['messages'] = $logger->getMessages();
$this->data['messageCount'] = $logger->countMessages(); $this->data['messageCount'] = $logger->countMessages();
} else { } else {
$this->data['messages'] = array(); $this->data['messages'] = array();
$this->data['messageCount'] = 0; $this->data['messageCount'] = 0;
} }

View File

@ -96,7 +96,7 @@ class CodeExtension extends \Twig_Extension
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short); $formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
} elseif ('array' === $item[0]) { } elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) { } elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset)); $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset));
} elseif ('null' === $item[0]) { } elseif ('null' === $item[0]) {
$formattedValue = '<em>null</em>'; $formattedValue = '<em>null</em>';

View File

@ -87,7 +87,7 @@ EOT
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) { foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) { if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
$targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName())); $targetDir = $bundlesDir.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
$output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir)); $output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));

View File

@ -54,8 +54,8 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); $realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
$oldCacheDir = $realCacheDir.'_old'; $oldCacheDir = $realCacheDir.'_old';
$filesystem = $this->getContainer()->get('filesystem'); $filesystem = $this->getContainer()->get('filesystem');
if (!is_writable($realCacheDir)) { if (!is_writable($realCacheDir)) {
throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir)); throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
@ -132,7 +132,7 @@ EOF
} }
// fix references to cached files with the real cache directory name // fix references to cached files with the real cache directory name
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir)); $search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
$replace = str_replace('\\', '/', $realCacheDir); $replace = str_replace('\\', '/', $realCacheDir);
foreach (Finder::create()->files()->in($warmupDir) as $file) { foreach (Finder::create()->files()->in($warmupDir) as $file) {
$content = str_replace($search, $replace, file_get_contents($file)); $content = str_replace($search, $replace, file_get_contents($file));
@ -140,7 +140,7 @@ EOF
} }
// fix references to kernel/container related classes // fix references to kernel/container related classes
$search = $tempKernel->getName().ucfirst($tempKernel->getEnvironment()); $search = $tempKernel->getName().ucfirst($tempKernel->getEnvironment());
$replace = $realKernel->getName().ucfirst($realKernel->getEnvironment()); $replace = $realKernel->getName().ucfirst($realKernel->getEnvironment());
foreach (Finder::create()->files()->name($search.'*')->in($warmupDir) as $file) { foreach (Finder::create()->files()->name($search.'*')->in($warmupDir) as $file) {
$content = str_replace($search, $replace, file_get_contents($file)); $content = str_replace($search, $replace, file_get_contents($file));

View File

@ -99,8 +99,8 @@ EOF
$maxHost = max($maxHost, strlen($host)); $maxHost = max($maxHost, strlen($host));
} }
$format = '%-'.$maxName.'s %-'.$maxMethod.'s %-'.$maxScheme.'s %-'.$maxHost.'s %s'; $format = '%-'.$maxName.'s %-'.$maxMethod.'s %-'.$maxScheme.'s %-'.$maxHost.'s %s';
$formatHeader = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %-'.($maxScheme + 19).'s %-'.($maxHost + 19).'s %s'; $formatHeader = '%-'.($maxName + 19).'s %-'.($maxMethod + 19).'s %-'.($maxScheme + 19).'s %-'.($maxHost + 19).'s %s';
$output->writeln(sprintf($formatHeader, '<comment>Name</comment>', '<comment>Method</comment>', '<comment>Scheme</comment>', '<comment>Host</comment>', '<comment>Path</comment>')); $output->writeln(sprintf($formatHeader, '<comment>Name</comment>', '<comment>Method</comment>', '<comment>Scheme</comment>', '<comment>Host</comment>', '<comment>Path</comment>'));
foreach ($routes as $name => $route) { foreach ($routes as $name => $route) {

View File

@ -229,7 +229,7 @@ class Configuration implements ConfigurationInterface
$organizeUrls = function ($urls) { $organizeUrls = function ($urls) {
$urls += array( $urls += array(
'http' => array(), 'http' => array(),
'ssl' => array(), 'ssl' => array(),
); );
foreach ($urls as $i => $url) { foreach ($urls as $i => $url) {

View File

@ -218,13 +218,13 @@ class FrameworkExtension extends Extension
// Choose storage class based on the DSN // Choose storage class based on the DSN
$supported = array( $supported = array(
'sqlite' => 'Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage', 'sqlite' => 'Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage',
'mysql' => 'Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage', 'mysql' => 'Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage',
'file' => 'Symfony\Component\HttpKernel\Profiler\FileProfilerStorage', 'file' => 'Symfony\Component\HttpKernel\Profiler\FileProfilerStorage',
'mongodb' => 'Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage', 'mongodb' => 'Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage',
'memcache' => 'Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage', 'memcache' => 'Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage',
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage', 'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage', 'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
); );
list($class, ) = explode(':', $config['dsn'], 2); list($class, ) = explode(':', $config['dsn'], 2);
if (!isset($supported[$class])) { if (!isset($supported[$class])) {
@ -358,9 +358,9 @@ class FrameworkExtension extends Extension
$links = array( $links = array(
'textmate' => 'txmt://open?url=file://%%f&line=%%l', 'textmate' => 'txmt://open?url=file://%%f&line=%%l',
'macvim' => 'mvim://open?url=file://%%f&line=%%l', 'macvim' => 'mvim://open?url=file://%%f&line=%%l',
'emacs' => 'emacs://open?url=file://%%f&line=%%l', 'emacs' => 'emacs://open?url=file://%%f&line=%%l',
'sublime' => 'subl://open?url=file://%%f&line=%%l', 'sublime' => 'subl://open?url=file://%%f&line=%%l',
); );
$container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide); $container->setParameter('templating.helper.code.file_link_format', isset($links[$ide]) ? $links[$ide] : $ide);

View File

@ -31,12 +31,12 @@ class RedirectableUrlMatcher extends BaseMatcher
{ {
return array( return array(
'_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction', '_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',
'path' => $path, 'path' => $path,
'permanent' => true, 'permanent' => true,
'scheme' => $scheme, 'scheme' => $scheme,
'httpPort' => $this->context->getHttpPort(), 'httpPort' => $this->context->getHttpPort(),
'httpsPort' => $this->context->getHttpsPort(), 'httpsPort' => $this->context->getHttpsPort(),
'_route' => $route, '_route' => $route,
); );
} }
} }

View File

@ -93,7 +93,7 @@ class CodeHelper extends Helper
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short); $formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
} elseif ('array' === $item[0]) { } elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) { } elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset())); $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
} elseif ('null' === $item[0]) { } elseif ('null' === $item[0]) {
$formattedValue = '<em>null</em>'; $formattedValue = '<em>null</em>';

View File

@ -23,11 +23,11 @@ class TemplateReference extends BaseTemplateReference
public function __construct($bundle = null, $controller = null, $name = null, $format = null, $engine = null) public function __construct($bundle = null, $controller = null, $name = null, $format = null, $engine = null)
{ {
$this->parameters = array( $this->parameters = array(
'bundle' => $bundle, 'bundle' => $bundle,
'controller' => $controller, 'controller' => $controller,
'name' => $name, 'name' => $name,
'format' => $format, 'format' => $format,
'engine' => $engine, 'engine' => $engine,
); );
} }

View File

@ -23,7 +23,7 @@ class ControllerNameParserTest extends TestCase
{ {
$this->loader = new ClassLoader(); $this->loader = new ClassLoader();
$this->loader->addPrefixes(array( $this->loader->addPrefixes(array(
'TestBundle' => __DIR__.'/../Fixtures', 'TestBundle' => __DIR__.'/../Fixtures',
'TestApplication' => __DIR__.'/../Fixtures', 'TestApplication' => __DIR__.'/../Fixtures',
)); ));
$this->loader->register(); $this->loader->register();

View File

@ -35,7 +35,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
$processor = new Processor(); $processor = new Processor();
$configuration = new Configuration(); $configuration = new Configuration();
$config = $processor->processConfiguration($configuration, array(array( $config = $processor->processConfiguration($configuration, array(array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'trusted_proxies' => $trustedProxies, 'trusted_proxies' => $trustedProxies,
))); )));
@ -90,44 +90,44 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
{ {
return array( return array(
'http_method_override' => true, 'http_method_override' => true,
'trusted_proxies' => array(), 'trusted_proxies' => array(),
'ide' => null, 'ide' => null,
'default_locale' => 'en', 'default_locale' => 'en',
'form' => array('enabled' => false), 'form' => array('enabled' => false),
'csrf_protection' => array( 'csrf_protection' => array(
'enabled' => true, 'enabled' => true,
'field_name' => '_token', 'field_name' => '_token',
), ),
'esi' => array('enabled' => false), 'esi' => array('enabled' => false),
'fragments' => array( 'fragments' => array(
'enabled' => false, 'enabled' => false,
'path' => '/_fragment', 'path' => '/_fragment',
), ),
'profiler' => array( 'profiler' => array(
'enabled' => false, 'enabled' => false,
'only_exceptions' => false, 'only_exceptions' => false,
'only_master_requests' => false, 'only_master_requests' => false,
'dsn' => 'file:%kernel.cache_dir%/profiler', 'dsn' => 'file:%kernel.cache_dir%/profiler',
'username' => '', 'username' => '',
'password' => '', 'password' => '',
'lifetime' => 86400, 'lifetime' => 86400,
'collect' => true, 'collect' => true,
), ),
'translator' => array( 'translator' => array(
'enabled' => false, 'enabled' => false,
'fallback' => 'en', 'fallback' => 'en',
), ),
'validation' => array( 'validation' => array(
'enabled' => false, 'enabled' => false,
'enable_annotations' => false, 'enable_annotations' => false,
'translation_domain' => 'validators', 'translation_domain' => 'validators',
), ),
'annotations' => array( 'annotations' => array(
'cache' => 'file', 'cache' => 'file',
'file_cache_dir' => '%kernel.cache_dir%/annotations', 'file_cache_dir' => '%kernel.cache_dir%/annotations',
'debug' => '%kernel.debug%', 'debug' => '%kernel.debug%',
), ),
'serializer' => array( 'serializer' => array(
'enabled' => false, 'enabled' => false,
), ),
); );

View File

@ -7,7 +7,7 @@ $container->loadFromExtension('framework', array(
'http_method_override' => false, 'http_method_override' => false,
'trusted_proxies' => array('127.0.0.1', '10.0.0.1'), 'trusted_proxies' => array('127.0.0.1', '10.0.0.1'),
'csrf_protection' => array( 'csrf_protection' => array(
'enabled' => true, 'enabled' => true,
'field_name' => '_csrf', 'field_name' => '_csrf',
), ),
'esi' => array( 'esi' => array(
@ -18,32 +18,32 @@ $container->loadFromExtension('framework', array(
'enabled' => false, 'enabled' => false,
), ),
'router' => array( 'router' => array(
'resource' => '%kernel.root_dir%/config/routing.xml', 'resource' => '%kernel.root_dir%/config/routing.xml',
'type' => 'xml', 'type' => 'xml',
), ),
'session' => array( 'session' => array(
'storage_id' => 'session.storage.native', 'storage_id' => 'session.storage.native',
'handler_id' => 'session.handler.native_file', 'handler_id' => 'session.handler.native_file',
'name' => '_SYMFONY', 'name' => '_SYMFONY',
'cookie_lifetime' => 86400, 'cookie_lifetime' => 86400,
'cookie_path' => '/', 'cookie_path' => '/',
'cookie_domain' => 'example.com', 'cookie_domain' => 'example.com',
'cookie_secure' => true, 'cookie_secure' => true,
'cookie_httponly' => true, 'cookie_httponly' => true,
'gc_maxlifetime' => 90000, 'gc_maxlifetime' => 90000,
'gc_divisor' => 108, 'gc_divisor' => 108,
'gc_probability' => 1, 'gc_probability' => 1,
'save_path' => '/path/to/sessions', 'save_path' => '/path/to/sessions',
), ),
'templating' => array( 'templating' => array(
'assets_version' => 'SomeVersionScheme', 'assets_version' => 'SomeVersionScheme',
'assets_base_urls' => 'http://cdn.example.com', 'assets_base_urls' => 'http://cdn.example.com',
'cache' => '/path/to/cache', 'cache' => '/path/to/cache',
'engines' => array('php', 'twig'), 'engines' => array('php', 'twig'),
'loader' => array('loader.foo', 'loader.bar'), 'loader' => array('loader.foo', 'loader.bar'),
'packages' => array( 'packages' => array(
'images' => array( 'images' => array(
'version' => '1.0.0', 'version' => '1.0.0',
'base_urls' => array('http://images1.example.com', 'http://images2.example.com'), 'base_urls' => array('http://images1.example.com', 'http://images2.example.com'),
), ),
'foo' => array( 'foo' => array(
@ -53,18 +53,18 @@ $container->loadFromExtension('framework', array(
'base_urls' => array('http://bar1.example.com', 'http://bar2.example.com'), 'base_urls' => array('http://bar1.example.com', 'http://bar2.example.com'),
), ),
), ),
'form' => array( 'form' => array(
'resources' => array('theme1', 'theme2'), 'resources' => array('theme1', 'theme2'),
), ),
'hinclude_default_template' => 'global_hinclude_template', 'hinclude_default_template' => 'global_hinclude_template',
), ),
'translator' => array( 'translator' => array(
'enabled' => true, 'enabled' => true,
'fallback' => 'fr', 'fallback' => 'fr',
), ),
'validation' => array( 'validation' => array(
'enabled' => true, 'enabled' => true,
'cache' => 'apc', 'cache' => 'apc',
), ),
'annotations' => array( 'annotations' => array(
'cache' => 'file', 'cache' => 'file',

View File

@ -4,8 +4,8 @@ $container->loadFromExtension('framework', array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'templating' => array( 'templating' => array(
'assets_base_urls' => 'https://cdn.example.com', 'assets_base_urls' => 'https://cdn.example.com',
'engines' => array('php', 'twig'), 'engines' => array('php', 'twig'),
'packages' => array( 'packages' => array(
'images' => array( 'images' => array(
'base_urls' => 'https://images.example.com', 'base_urls' => 'https://images.example.com',
), ),

View File

@ -3,7 +3,7 @@
$container->loadFromExtension('framework', array( $container->loadFromExtension('framework', array(
'secret' => 's3cr3t', 'secret' => 's3cr3t',
'validation' => array( 'validation' => array(
'enabled' => true, 'enabled' => true,
'enable_annotations' => true, 'enable_annotations' => true,
), ),
)); ));

View File

@ -288,12 +288,12 @@ abstract class FrameworkExtensionTest extends TestCase
protected function createContainer(array $data = array()) protected function createContainer(array $data = array())
{ {
return new ContainerBuilder(new ParameterBag(array_merge(array( return new ContainerBuilder(new ParameterBag(array_merge(array(
'kernel.bundles' => array('FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'), 'kernel.bundles' => array('FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'),
'kernel.cache_dir' => __DIR__, 'kernel.cache_dir' => __DIR__,
'kernel.debug' => false, 'kernel.debug' => false,
'kernel.environment' => 'test', 'kernel.environment' => 'test',
'kernel.name' => 'kernel', 'kernel.name' => 'kernel',
'kernel.root_dir' => __DIR__, 'kernel.root_dir' => __DIR__,
), $data))); ), $data)));
} }

View File

@ -40,7 +40,7 @@ class TestSessionListenerTest extends \PHPUnit_Framework_TestCase
protected function setUp() protected function setUp()
{ {
$this->listener = new TestSessionListener($this->getMock('Symfony\Component\DependencyInjection\ContainerInterface')); $this->listener = new TestSessionListener($this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'));
$this->session = $this->getSession(); $this->session = $this->getSession();
} }
protected function tearDown() protected function tearDown()

View File

@ -27,7 +27,7 @@ class SubRequestController extends ContainerAware
// simulates a failure during the rendering of a fragment... // simulates a failure during the rendering of a fragment...
// should render fr/json // should render fr/json
$content = $handler->render($errorUrl, 'inline', array('alt' => $altUrl)); $content = $handler->render($errorUrl, 'inline', array('alt' => $altUrl));
// ...to check that the FragmentListener still references the right Request // ...to check that the FragmentListener still references the right Request
// when rendering another fragment after the error occurred // when rendering another fragment after the error occurred

View File

@ -27,12 +27,12 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', '_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction',
'path' => '/foo/', 'path' => '/foo/',
'permanent' => true, 'permanent' => true,
'scheme' => null, 'scheme' => null,
'httpPort' => $context->getHttpPort(), 'httpPort' => $context->getHttpPort(),
'httpsPort' => $context->getHttpsPort(), 'httpsPort' => $context->getHttpsPort(),
'_route' => null, '_route' => null,
), ),
$matcher->match('/foo') $matcher->match('/foo')
); );
@ -47,12 +47,12 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array( $this->assertEquals(array(
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', '_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction',
'path' => '/foo', 'path' => '/foo',
'permanent' => true, 'permanent' => true,
'scheme' => 'https', 'scheme' => 'https',
'httpPort' => $context->getHttpPort(), 'httpPort' => $context->getHttpPort(),
'httpsPort' => $context->getHttpsPort(), 'httpsPort' => $context->getHttpsPort(),
'_route' => 'foo', '_route' => 'foo',
), ),
$matcher->match('/foo') $matcher->match('/foo')
); );

View File

@ -47,11 +47,11 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$routes->add('foo', new Route( $routes->add('foo', new Route(
'/foo', '/foo',
array( array(
'foo' => 'before_%parameter.foo%', 'foo' => 'before_%parameter.foo%',
'bar' => '%parameter.bar%_after', 'bar' => '%parameter.bar%_after',
'baz' => '%%escaped%%', 'baz' => '%%escaped%%',
'boo' => array('%parameter%', '%%escaped_parameter%%', array('%bee_parameter%', 'bee')), 'boo' => array('%parameter%', '%%escaped_parameter%%', array('%bee_parameter%', 'bee')),
'bee' => array('bee', 'bee'), 'bee' => array('bee', 'bee'),
), ),
array( array(
) )
@ -88,9 +88,9 @@ class RouterTest extends \PHPUnit_Framework_TestCase
array( array(
), ),
array( array(
'foo' => 'before_%parameter.foo%', 'foo' => 'before_%parameter.foo%',
'bar' => '%parameter.bar%_after', 'bar' => '%parameter.bar%_after',
'baz' => '%%escaped%%', 'baz' => '%%escaped%%',
) )
)); ));

View File

@ -207,8 +207,8 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
->expects($this->at(1)) ->expects($this->at(1))
->method('load') ->method('load')
->will($this->returnValue($this->getCatalogue('en', array( ->will($this->returnValue($this->getCatalogue('en', array(
'foo' => 'foo (EN)', 'foo' => 'foo (EN)',
'bar' => 'bar (EN)', 'bar' => 'bar (EN)',
'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)', 'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)',
)))) ))))
; ;

View File

@ -51,13 +51,13 @@ class PhpStringTokenParser
{ {
protected static $replacements = array( protected static $replacements = array(
'\\' => '\\', '\\' => '\\',
'$' => '$', '$' => '$',
'n' => "\n", 'n' => "\n",
'r' => "\r", 'r' => "\r",
't' => "\t", 't' => "\t",
'f' => "\f", 'f' => "\f",
'v' => "\v", 'v' => "\v",
'e' => "\x1B", 'e' => "\x1B",
); );
/** /**

View File

@ -49,7 +49,7 @@ class Translator extends BaseTranslator
$this->options = array( $this->options = array(
'cache_dir' => null, 'cache_dir' => null,
'debug' => false, 'debug' => false,
); );
// check option names // check option names

View File

@ -37,27 +37,27 @@ class SecurityDataCollector extends DataCollector
{ {
if (null === $this->context) { if (null === $this->context) {
$this->data = array( $this->data = array(
'enabled' => false, 'enabled' => false,
'authenticated' => false, 'authenticated' => false,
'token_class' => null, 'token_class' => null,
'user' => '', 'user' => '',
'roles' => array(), 'roles' => array(),
); );
} elseif (null === $token = $this->context->getToken()) { } elseif (null === $token = $this->context->getToken()) {
$this->data = array( $this->data = array(
'enabled' => true, 'enabled' => true,
'authenticated' => false, 'authenticated' => false,
'token_class' => null, 'token_class' => null,
'user' => '', 'user' => '',
'roles' => array(), 'roles' => array(),
); );
} else { } else {
$this->data = array( $this->data = array(
'enabled' => true, 'enabled' => true,
'authenticated' => $token->isAuthenticated(), 'authenticated' => $token->isAuthenticated(),
'token_class' => get_class($token), 'token_class' => get_class($token),
'user' => $token->getUsername(), 'user' => $token->getUsername(),
'roles' => array_map(function ($role) { return $role->getRole();}, $token->getRoles()), 'roles' => array_map(function ($role) { return $role->getRole();}, $token->getRoles()),
); );
} }
} }

View File

@ -27,24 +27,24 @@ use Symfony\Component\DependencyInjection\Reference;
abstract class AbstractFactory implements SecurityFactoryInterface abstract class AbstractFactory implements SecurityFactoryInterface
{ {
protected $options = array( protected $options = array(
'check_path' => '/login_check', 'check_path' => '/login_check',
'use_forward' => false, 'use_forward' => false,
'require_previous_session' => true, 'require_previous_session' => true,
); );
protected $defaultSuccessHandlerOptions = array( protected $defaultSuccessHandlerOptions = array(
'always_use_default_target_path' => false, 'always_use_default_target_path' => false,
'default_target_path' => '/', 'default_target_path' => '/',
'login_path' => '/login', 'login_path' => '/login',
'target_path_parameter' => '_target_path', 'target_path_parameter' => '_target_path',
'use_referer' => false, 'use_referer' => false,
); );
protected $defaultFailureHandlerOptions = array( protected $defaultFailureHandlerOptions = array(
'failure_path' => null, 'failure_path' => null,
'failure_forward' => false, 'failure_forward' => false,
'login_path' => '/login', 'login_path' => '/login',
'failure_path_parameter' => '_failure_path', 'failure_path_parameter' => '_failure_path',
); );
public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId) public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)

View File

@ -135,8 +135,8 @@ class SecurityExtension extends Extension
->getDefinition('security.acl.dbal.schema_listener') ->getDefinition('security.acl.dbal.schema_listener')
->addTag('doctrine.event_listener', array( ->addTag('doctrine.event_listener', array(
'connection' => $config['connection'], 'connection' => $config['connection'],
'event' => 'postGenerateSchema', 'event' => 'postGenerateSchema',
'lazy' => true, 'lazy' => true,
)) ))
; ;
@ -281,8 +281,8 @@ class SecurityExtension extends Extension
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.logout_listener')); $listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.logout_listener'));
$listener->replaceArgument(3, array( $listener->replaceArgument(3, array(
'csrf_parameter' => $firewall['logout']['csrf_parameter'], 'csrf_parameter' => $firewall['logout']['csrf_parameter'],
'intention' => $firewall['logout']['intention'], 'intention' => $firewall['logout']['intention'],
'logout_path' => $firewall['logout']['path'], 'logout_path' => $firewall['logout']['path'],
)); ));
$listeners[] = new Reference($listenerId); $listeners[] = new Reference($listenerId);
@ -452,7 +452,7 @@ class SecurityExtension extends Extension
// pbkdf2 encoder // pbkdf2 encoder
if ('pbkdf2' === $config['algorithm']) { if ('pbkdf2' === $config['algorithm']) {
return array( return array(
'class' => new Parameter('security.encoder.pbkdf2.class'), 'class' => new Parameter('security.encoder.pbkdf2.class'),
'arguments' => array( 'arguments' => array(
$config['hash_algorithm'], $config['hash_algorithm'],
$config['encode_as_base64'], $config['encode_as_base64'],
@ -465,14 +465,14 @@ class SecurityExtension extends Extension
// bcrypt encoder // bcrypt encoder
if ('bcrypt' === $config['algorithm']) { if ('bcrypt' === $config['algorithm']) {
return array( return array(
'class' => new Parameter('security.encoder.bcrypt.class'), 'class' => new Parameter('security.encoder.bcrypt.class'),
'arguments' => array($config['cost']), 'arguments' => array($config['cost']),
); );
} }
// message digest encoder // message digest encoder
return array( return array(
'class' => new Parameter('security.encoder.digest.class'), 'class' => new Parameter('security.encoder.digest.class'),
'arguments' => array( 'arguments' => array(
$config['algorithm'], $config['algorithm'],
$config['encode_as_base64'], $config['encode_as_base64'],

View File

@ -26,9 +26,9 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
{ {
$container = $this->getContainer('container1'); $container = $this->getContainer('container1');
$this->assertEquals(array( $this->assertEquals(array(
'ROLE_ADMIN' => array('ROLE_USER'), 'ROLE_ADMIN' => array('ROLE_USER'),
'ROLE_SUPER_ADMIN' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'), 'ROLE_SUPER_ADMIN' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'),
'ROLE_REMOTE' => array('ROLE_USER', 'ROLE_ADMIN'), 'ROLE_REMOTE' => array('ROLE_USER', 'ROLE_ADMIN'),
), $container->getParameter('security.role_hierarchy.roles')); ), $container->getParameter('security.role_hierarchy.roles'));
} }

View File

@ -36,7 +36,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
'index_5' => new Reference('qux'), 'index_5' => new Reference('qux'),
'index_6' => new Reference('bar'), 'index_6' => new Reference('bar'),
'index_7' => array( 'index_7' => array(
'use_forward' => true, 'use_forward' => true,
), ),
), $definition->getArguments()); ), $definition->getArguments());

View File

@ -22,7 +22,7 @@ class LoginController extends ContainerAware
$form = $this->container->get('form.factory')->create('user_login'); $form = $this->container->get('form.factory')->create('user_login');
return $this->container->get('templating')->renderResponse('CsrfFormLoginBundle:Login:login.html.twig', array( return $this->container->get('templating')->renderResponse('CsrfFormLoginBundle:Login:login.html.twig', array(
'form' => $form->createView(), 'form' => $form->createView(),
)); ));
} }

View File

@ -29,7 +29,7 @@ class LocalizedController extends ContainerAware
return $this->container->get('templating')->renderResponse('FormLoginBundle:Localized:login.html.twig', array( return $this->container->get('templating')->renderResponse('FormLoginBundle:Localized:login.html.twig', array(
// last username entered by the user // last username entered by the user
'last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME), 'last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error, 'error' => $error,
)); ));
} }

View File

@ -30,7 +30,7 @@ class LoginController extends ContainerAware
return $this->container->get('templating')->renderResponse('FormLoginBundle:Login:login.html.twig', array( return $this->container->get('templating')->renderResponse('FormLoginBundle:Login:login.html.twig', array(
// last username entered by the user // last username entered by the user
'last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME), 'last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error, 'error' => $error,
)); ));
} }

View File

@ -54,10 +54,10 @@ class SwitchUserTest extends WebTestCase
public function getTestParameters() public function getTestParameters()
{ {
return array( return array(
'unauthorized_user_cannot_switch' => array('user_cannot_switch_1', 'user_cannot_switch_1', 'user_cannot_switch_1', 403), 'unauthorized_user_cannot_switch' => array('user_cannot_switch_1', 'user_cannot_switch_1', 'user_cannot_switch_1', 403),
'authorized_user_can_switch' => array('user_can_switch', 'user_cannot_switch_1', 'user_cannot_switch_1', 200), 'authorized_user_can_switch' => array('user_can_switch', 'user_cannot_switch_1', 'user_cannot_switch_1', 200),
'authorized_user_cannot_switch_to_non_existent' => array('user_can_switch', 'user_does_not_exist', 'user_can_switch', 500), 'authorized_user_cannot_switch_to_non_existent' => array('user_can_switch', 'user_does_not_exist', 'user_can_switch', 500),
'authorized_user_can_switch_to_himself' => array('user_can_switch', 'user_can_switch', 'user_can_switch', 200), 'authorized_user_can_switch_to_himself' => array('user_can_switch', 'user_can_switch', 'user_can_switch', 200),
); );
} }

View File

@ -54,10 +54,10 @@ class ExceptionController
return new Response($this->twig->render( return new Response($this->twig->render(
(string) $this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug), (string) $this->findTemplate($request, $request->getRequestFormat(), $code, $this->debug),
array( array(
'status_code' => $code, 'status_code' => $code,
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
'exception' => $exception, 'exception' => $exception,
'logger' => $logger, 'logger' => $logger,
'currentContent' => $currentContent, 'currentContent' => $currentContent,
) )
)); ));

View File

@ -41,7 +41,7 @@ class TwigExtension extends Extension
foreach ($config['globals'] as $name => $value) { foreach ($config['globals'] as $name => $value) {
if (is_array($value) && isset($value['key'])) { if (is_array($value) && isset($value['key'])) {
$config['globals'][$name] = array( $config['globals'][$name] = array(
'key' => $name, 'key' => $name,
'value' => $config['globals'][$name], 'value' => $config['globals'][$name],
); );
} }

View File

@ -1,6 +1,6 @@
<?php <?php
$container->loadFromExtension('twig', array( $container->loadFromExtension('twig', array(
'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser', 'autoescape_service' => 'my_project.some_bundle.template_escaping_guesser',
'autoescape_service_method' => 'guess', 'autoescape_service_method' => 'guess',
)); ));

View File

@ -1,7 +1,7 @@
<?php <?php
$container->loadFromExtension('twig', array( $container->loadFromExtension('twig', array(
'paths' => array( 'paths' => array(
'namespaced_path3' => 'namespace3', 'namespaced_path3' => 'namespace3',
), ),
)); ));

View File

@ -9,17 +9,17 @@ $container->loadFromExtension('twig', array(
'globals' => array( 'globals' => array(
'foo' => '@bar', 'foo' => '@bar',
'baz' => '@@qux', 'baz' => '@@qux',
'pi' => 3.14, 'pi' => 3.14,
'bad' => array('key' => 'foo'), 'bad' => array('key' => 'foo'),
), ),
'auto_reload' => true, 'auto_reload' => true,
'autoescape' => true, 'autoescape' => true,
'base_template_class' => 'stdClass', 'base_template_class' => 'stdClass',
'cache' => '/tmp', 'cache' => '/tmp',
'charset' => 'ISO-8859-1', 'charset' => 'ISO-8859-1',
'debug' => true, 'debug' => true,
'strict_variables' => true, 'strict_variables' => true,
'paths' => array( 'paths' => array(
'path1', 'path1',
'path2', 'path2',
'namespaced_path1' => 'namespace1', 'namespaced_path1' => 'namespace1',

View File

@ -114,14 +114,14 @@ class TwigExtensionTest extends TestCase
public function testGlobalsWithDifferentTypesAndValues() public function testGlobalsWithDifferentTypesAndValues()
{ {
$globals = array( $globals = array(
'array' => array(), 'array' => array(),
'false' => false, 'false' => false,
'float' => 2.0, 'float' => 2.0,
'integer' => 3, 'integer' => 3,
'null' => null, 'null' => null,
'object' => new \stdClass(), 'object' => new \stdClass(),
'string' => 'foo', 'string' => 'foo',
'true' => true, 'true' => true,
); );
$container = $this->createContainer(); $container = $this->createContainer();
@ -183,10 +183,10 @@ class TwigExtensionTest extends TestCase
{ {
$container = new ContainerBuilder(new ParameterBag(array( $container = new ContainerBuilder(new ParameterBag(array(
'kernel.cache_dir' => __DIR__, 'kernel.cache_dir' => __DIR__,
'kernel.root_dir' => __DIR__.'/Fixtures', 'kernel.root_dir' => __DIR__.'/Fixtures',
'kernel.charset' => 'UTF-8', 'kernel.charset' => 'UTF-8',
'kernel.debug' => false, 'kernel.debug' => false,
'kernel.bundles' => array('TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle'), 'kernel.bundles' => array('TwigBundle' => 'Symfony\\Bundle\\TwigBundle\\TwigBundle'),
))); )));
return $container; return $container;

View File

@ -65,10 +65,10 @@ class ExceptionController
return new Response($this->twig->render( return new Response($this->twig->render(
$template, $template,
array( array(
'status_code' => $code, 'status_code' => $code,
'status_text' => Response::$statusTexts[$code], 'status_text' => Response::$statusTexts[$code],
'exception' => $exception, 'exception' => $exception,
'logger' => null, 'logger' => null,
'currentContent' => '', 'currentContent' => '',
) )
), 200, array('Content-Type' => 'text/html')); ), 200, array('Content-Type' => 'text/html'));

View File

@ -100,14 +100,14 @@ class ProfilerController
} }
return new Response($this->twig->render($this->getTemplateManager()->getName($profile, $panel), array( return new Response($this->twig->render($this->getTemplateManager()->getName($profile, $panel), array(
'token' => $token, 'token' => $token,
'profile' => $profile, 'profile' => $profile,
'collector' => $profile->getCollector($panel), 'collector' => $profile->getCollector($panel),
'panel' => $panel, 'panel' => $panel,
'page' => $page, 'page' => $page,
'request' => $request, 'request' => $request,
'templates' => $this->getTemplateManager()->getTemplates($profile), 'templates' => $this->getTemplateManager()->getTemplates($profile),
'is_ajax' => $request->isXmlHttpRequest(), 'is_ajax' => $request->isXmlHttpRequest(),
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }
@ -198,11 +198,11 @@ class ProfilerController
} }
return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array( return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
'position' => $position, 'position' => $position,
'profile' => $profile, 'profile' => $profile,
'templates' => $this->getTemplateManager()->getTemplates($profile), 'templates' => $this->getTemplateManager()->getTemplates($profile),
'profiler_url' => $url, 'profiler_url' => $url,
'token' => $token, 'token' => $token,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }
@ -224,31 +224,31 @@ class ProfilerController
$this->profiler->disable(); $this->profiler->disable();
if (null === $session = $request->getSession()) { if (null === $session = $request->getSession()) {
$ip = $ip =
$method = $method =
$url = $url =
$start = $start =
$end = $end =
$limit = $limit =
$token = null; $token = null;
} else { } else {
$ip = $session->get('_profiler_search_ip'); $ip = $session->get('_profiler_search_ip');
$method = $session->get('_profiler_search_method'); $method = $session->get('_profiler_search_method');
$url = $session->get('_profiler_search_url'); $url = $session->get('_profiler_search_url');
$start = $session->get('_profiler_search_start'); $start = $session->get('_profiler_search_start');
$end = $session->get('_profiler_search_end'); $end = $session->get('_profiler_search_end');
$limit = $session->get('_profiler_search_limit'); $limit = $session->get('_profiler_search_limit');
$token = $session->get('_profiler_search_token'); $token = $session->get('_profiler_search_token');
} }
return new Response($this->twig->render('@WebProfiler/Profiler/search.html.twig', array( return new Response($this->twig->render('@WebProfiler/Profiler/search.html.twig', array(
'token' => $token, 'token' => $token,
'ip' => $ip, 'ip' => $ip,
'method' => $method, 'method' => $method,
'url' => $url, 'url' => $url,
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'limit' => $limit, 'limit' => $limit,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }
@ -272,24 +272,24 @@ class ProfilerController
$profile = $this->profiler->loadProfile($token); $profile = $this->profiler->loadProfile($token);
$ip = $request->query->get('ip'); $ip = $request->query->get('ip');
$method = $request->query->get('method'); $method = $request->query->get('method');
$url = $request->query->get('url'); $url = $request->query->get('url');
$start = $request->query->get('start', null); $start = $request->query->get('start', null);
$end = $request->query->get('end', null); $end = $request->query->get('end', null);
$limit = $request->query->get('limit'); $limit = $request->query->get('limit');
return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', array( return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', array(
'token' => $token, 'token' => $token,
'profile' => $profile, 'profile' => $profile,
'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end), 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end),
'ip' => $ip, 'ip' => $ip,
'method' => $method, 'method' => $method,
'url' => $url, 'url' => $url,
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'limit' => $limit, 'limit' => $limit,
'panel' => null, 'panel' => null,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }
@ -310,13 +310,13 @@ class ProfilerController
$this->profiler->disable(); $this->profiler->disable();
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip')); $ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
$method = $request->query->get('method'); $method = $request->query->get('method');
$url = $request->query->get('url'); $url = $request->query->get('url');
$start = $request->query->get('start', null); $start = $request->query->get('start', null);
$end = $request->query->get('end', null); $end = $request->query->get('end', null);
$limit = $request->query->get('limit'); $limit = $request->query->get('limit');
$token = $request->query->get('token'); $token = $request->query->get('token');
if (null !== $session = $request->getSession()) { if (null !== $session = $request->getSession()) {
$session->set('_profiler_search_ip', $ip); $session->set('_profiler_search_ip', $ip);
@ -335,13 +335,13 @@ class ProfilerController
$tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end); $tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end);
return new RedirectResponse($this->generator->generate('_profiler_search_results', array( return new RedirectResponse($this->generator->generate('_profiler_search_results', array(
'token' => $tokens ? $tokens[0]['token'] : 'empty', 'token' => $tokens ? $tokens[0]['token'] : 'empty',
'ip' => $ip, 'ip' => $ip,
'method' => $method, 'method' => $method,
'url' => $url, 'url' => $url,
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'limit' => $limit, 'limit' => $limit,
)), 302, array('Content-Type' => 'text/html')); )), 302, array('Content-Type' => 'text/html'));
} }

View File

@ -74,8 +74,8 @@ class RouterController
return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', array( return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', array(
'request' => $request, 'request' => $request,
'router' => $profile->getCollector('router'), 'router' => $profile->getCollector('router'),
'traces' => $matcher->getTraces($request->getPathInfo()), 'traces' => $matcher->getTraces($request->getPathInfo()),
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }
} }

View File

@ -31,7 +31,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class WebDebugToolbarListener implements EventSubscriberInterface class WebDebugToolbarListener implements EventSubscriberInterface
{ {
const DISABLED = 1; const DISABLED = 1;
const ENABLED = 2; const ENABLED = 2;
protected $twig; protected $twig;
protected $interceptRedirects; protected $interceptRedirects;

View File

@ -133,10 +133,10 @@
function CanvasManager(requests, maxRequestTime) { function CanvasManager(requests, maxRequestTime) {
"use strict"; "use strict";
var _drawingColors = {{ colors|json_encode|raw }}, var _drawingColors = {{ colors|json_encode|raw }},
_storagePrefix = 'timeline/', _storagePrefix = 'timeline/',
_threshold = 1, _threshold = 1,
_requests = requests, _requests = requests,
_maxRequestTime = maxRequestTime; _maxRequestTime = maxRequestTime;
/** /**
@ -183,16 +183,16 @@
xc, xc,
drawableEvents, drawableEvents,
mainEvents, mainEvents,
elementId = 'timeline_' + request.id, elementId = 'timeline_' + request.id,
canvasHeight = 0, canvasHeight = 0,
gapPerEvent = 38, gapPerEvent = 38,
colors = _drawingColors, colors = _drawingColors,
space = 10.5, space = 10.5,
ratio = (width - space * 2) / max, ratio = (width - space * 2) / max,
h = space, h = space,
x = request.left * ratio + space, // position x = request.left * ratio + space, // position
canvas = cache.get(elementId) || cache.set(elementId, document.getElementById(elementId)), canvas = cache.get(elementId) || cache.set(elementId, document.getElementById(elementId)),
ctx = canvas.getContext("2d"), ctx = canvas.getContext("2d"),
scaleRatio, scaleRatio,
devicePixelRatio; devicePixelRatio;
@ -204,10 +204,10 @@
canvasHeight += gapPerEvent * drawableEvents.length; canvasHeight += gapPerEvent * drawableEvents.length;
// For retina displays so text and boxes will be crisp // For retina displays so text and boxes will be crisp
devicePixelRatio = window.devicePixelRatio == "undefined" ? 1 : window.devicePixelRatio; devicePixelRatio = window.devicePixelRatio == "undefined" ? 1 : window.devicePixelRatio;
scaleRatio = devicePixelRatio / 1; scaleRatio = devicePixelRatio / 1;
canvas.width = width * scaleRatio; canvas.width = width * scaleRatio;
canvas.height = canvasHeight * scaleRatio; canvas.height = canvasHeight * scaleRatio;
canvas.style.width = width + 'px'; canvas.style.width = width + 'px';
@ -256,14 +256,14 @@
// For each sub event, ... // For each sub event, ...
event.periods.forEach(function(period) { event.periods.forEach(function(period) {
// Set the drawing style. // Set the drawing style.
ctx.fillStyle = colors['default']; ctx.fillStyle = colors['default'];
ctx.strokeStyle = colors['default']; ctx.strokeStyle = colors['default'];
if (colors[event.name]) { if (colors[event.name]) {
ctx.fillStyle = colors[event.name]; ctx.fillStyle = colors[event.name];
ctx.strokeStyle = colors[event.name]; ctx.strokeStyle = colors[event.name];
} else if (colors[event.category]) { } else if (colors[event.category]) {
ctx.fillStyle = colors[event.category]; ctx.fillStyle = colors[event.category];
ctx.strokeStyle = colors[event.category]; ctx.strokeStyle = colors[event.category];
} }
@ -353,7 +353,7 @@
{ {
"use strict"; "use strict";
width = width || getContainerWidth(); width = width || getContainerWidth();
threshold = threshold || this.getThreshold(); threshold = threshold || this.getThreshold();
var self = this; var self = this;
@ -425,15 +425,15 @@
} }
// Bind event handlers // Bind event handlers
var elementTimelineControl = query('#timeline-control'), var elementTimelineControl = query('#timeline-control'),
elementThresholdControl = query('input[name="threshold"]'); elementThresholdControl = query('input[name="threshold"]');
window.onresize = canvasAutoUpdateOnResizeAndSubmit; window.onresize = canvasAutoUpdateOnResizeAndSubmit;
elementTimelineControl.onsubmit = canvasAutoUpdateOnResizeAndSubmit; elementTimelineControl.onsubmit = canvasAutoUpdateOnResizeAndSubmit;
elementThresholdControl.onclick = canvasAutoUpdateOnThresholdChange; elementThresholdControl.onclick = canvasAutoUpdateOnThresholdChange;
elementThresholdControl.onchange = canvasAutoUpdateOnThresholdChange; elementThresholdControl.onchange = canvasAutoUpdateOnThresholdChange;
elementThresholdControl.onkeyup = canvasAutoUpdateOnThresholdChange; elementThresholdControl.onkeyup = canvasAutoUpdateOnThresholdChange;
window.setTimeout(function() { window.setTimeout(function() {
canvasAutoUpdateOnThresholdChange(null); canvasAutoUpdateOnThresholdChange(null);

View File

@ -120,7 +120,7 @@ abstract class Client
public function setServerParameters(array $server) public function setServerParameters(array $server)
{ {
$this->server = array_merge(array( $this->server = array_merge(array(
'HTTP_HOST' => 'localhost', 'HTTP_HOST' => 'localhost',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit', 'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
), $server); ), $server);
} }

View File

@ -62,17 +62,17 @@ class Cookie
public function __construct($name, $value, $expires = null, $path = null, $domain = '', $secure = false, $httponly = true, $encodedValue = false) public function __construct($name, $value, $expires = null, $path = null, $domain = '', $secure = false, $httponly = true, $encodedValue = false)
{ {
if ($encodedValue) { if ($encodedValue) {
$this->value = urldecode($value); $this->value = urldecode($value);
$this->rawValue = $value; $this->rawValue = $value;
} else { } else {
$this->value = $value; $this->value = $value;
$this->rawValue = urlencode($value); $this->rawValue = urlencode($value);
} }
$this->name = $name; $this->name = $name;
$this->expires = null === $expires ? null : (int) $expires; $this->expires = null === $expires ? null : (int) $expires;
$this->path = empty($path) ? '/' : $path; $this->path = empty($path) ? '/' : $path;
$this->domain = $domain; $this->domain = $domain;
$this->secure = (bool) $secure; $this->secure = (bool) $secure;
$this->httponly = (bool) $httponly; $this->httponly = (bool) $httponly;
} }
@ -141,12 +141,12 @@ class Cookie
list($name, $value) = explode('=', array_shift($parts), 2); list($name, $value) = explode('=', array_shift($parts), 2);
$values = array( $values = array(
'name' => trim($name), 'name' => trim($name),
'value' => trim($value), 'value' => trim($value),
'expires' => null, 'expires' => null,
'path' => '/', 'path' => '/',
'domain' => '', 'domain' => '',
'secure' => false, 'secure' => false,
'httponly' => false, 'httponly' => false,
'passedRawValue' => true, 'passedRawValue' => true,
); );

View File

@ -39,7 +39,7 @@ class Response
public function __construct($content = '', $status = 200, array $headers = array()) public function __construct($content = '', $status = 200, array $headers = array())
{ {
$this->content = $content; $this->content = $content;
$this->status = $status; $this->status = $status;
$this->headers = $headers; $this->headers = $headers;
} }

View File

@ -456,7 +456,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client = new TestClient(); $client = new TestClient();
$client->followRedirects(false); $client->followRedirects(false);
$client->setNextResponse(new Response('', 302, array( $client->setNextResponse(new Response('', 302, array(
'Location' => 'http://www.example.com/redirected', 'Location' => 'http://www.example.com/redirected',
'Set-Cookie' => 'foo=bar', 'Set-Cookie' => 'foo=bar',
))); )));
$client->request('GET', 'http://www.example.com/'); $client->request('GET', 'http://www.example.com/');
@ -468,16 +468,16 @@ class ClientTest extends \PHPUnit_Framework_TestCase
public function testFollowRedirectWithHeaders() public function testFollowRedirectWithHeaders()
{ {
$headers = array( $headers = array(
'HTTP_HOST' => 'www.example.com', 'HTTP_HOST' => 'www.example.com',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit', 'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
'CONTENT_TYPE' => 'application/vnd.custom+xml', 'CONTENT_TYPE' => 'application/vnd.custom+xml',
'HTTPS' => false, 'HTTPS' => false,
); );
$client = new TestClient(); $client = new TestClient();
$client->followRedirects(false); $client->followRedirects(false);
$client->setNextResponse(new Response('', 302, array( $client->setNextResponse(new Response('', 302, array(
'Location' => 'http://www.example.com/redirected', 'Location' => 'http://www.example.com/redirected',
))); )));
$client->request('GET', 'http://www.example.com/', array(), array(), array( $client->request('GET', 'http://www.example.com/', array(), array(), array(
'CONTENT_TYPE' => 'application/vnd.custom+xml', 'CONTENT_TYPE' => 'application/vnd.custom+xml',
@ -495,15 +495,15 @@ class ClientTest extends \PHPUnit_Framework_TestCase
public function testFollowRedirectWithPort() public function testFollowRedirectWithPort()
{ {
$headers = array( $headers = array(
'HTTP_HOST' => 'www.example.com:8080', 'HTTP_HOST' => 'www.example.com:8080',
'HTTP_USER_AGENT' => 'Symfony2 BrowserKit', 'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
'HTTPS' => false, 'HTTPS' => false,
'HTTP_REFERER' => 'http://www.example.com:8080/', 'HTTP_REFERER' => 'http://www.example.com:8080/',
); );
$client = new TestClient(); $client = new TestClient();
$client->setNextResponse(new Response('', 302, array( $client->setNextResponse(new Response('', 302, array(
'Location' => 'http://www.example.com:8080/redirected', 'Location' => 'http://www.example.com:8080/redirected',
))); )));
$client->request('GET', 'http://www.example.com:8080/'); $client->request('GET', 'http://www.example.com:8080/');
@ -633,10 +633,10 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('Symfony2 BrowserKit', $client->getServerParameter('HTTP_USER_AGENT')); $this->assertEquals('Symfony2 BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
$client->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array( $client->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array(
'HTTP_HOST' => 'testhost', 'HTTP_HOST' => 'testhost',
'HTTP_USER_AGENT' => 'testua', 'HTTP_USER_AGENT' => 'testua',
'HTTPS' => false, 'HTTPS' => false,
'NEW_SERVER_KEY' => 'new-server-key-value', 'NEW_SERVER_KEY' => 'new-server-key-value',
)); ));
$this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST')); $this->assertEquals('localhost', $client->getServerParameter('HTTP_HOST'));

View File

@ -37,7 +37,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
{ {
$response = new Response('foo', 200, array( $response = new Response('foo', 200, array(
'Content-Type' => 'text/html', 'Content-Type' => 'text/html',
'Set-Cookie' => array('foo=bar', 'bar=foo'), 'Set-Cookie' => array('foo=bar', 'bar=foo'),
)); ));
$this->assertEquals('text/html', $response->getHeader('Content-Type'), '->getHeader() returns a header of the response'); $this->assertEquals('text/html', $response->getHeader('Content-Type'), '->getHeader() returns a header of the response');
@ -61,7 +61,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
{ {
$headers = array( $headers = array(
'content-type' => 'text/html; charset=utf-8', 'content-type' => 'text/html; charset=utf-8',
'set-cookie' => array('foo=bar', 'bar=foo'), 'set-cookie' => array('foo=bar', 'bar=foo'),
); );
$expected = 'content-type: text/html; charset=utf-8'."\n"; $expected = 'content-type: text/html; charset=utf-8'."\n";

View File

@ -37,8 +37,8 @@ namespace Symfony\Component\ClassLoader;
* // register classes with namespaces * // register classes with namespaces
* $loader->registerNamespaces(array( * $loader->registerNamespaces(array(
* 'Symfony\Component' => __DIR__.'/component', * 'Symfony\Component' => __DIR__.'/component',
* 'Symfony' => __DIR__.'/framework', * 'Symfony' => __DIR__.'/framework',
* 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'),
* )); * ));
* *
* // register a library using the PEAR naming convention * // register a library using the PEAR naming convention

View File

@ -86,7 +86,7 @@ class ClassMapGenerator
private static function findClasses($path) private static function findClasses($path)
{ {
$contents = file_get_contents($path); $contents = file_get_contents($path);
$tokens = token_get_all($contents); $tokens = token_get_all($contents);
$classes = array(); $classes = array();

View File

@ -48,10 +48,10 @@ than one namespace at once:
```php ```php
$loader->registerNamespaces(array( $loader->registerNamespaces(array(
'Symfony' => array(__DIR__.'/src', __DIR__.'/symfony/src'), 'Symfony' => array(__DIR__.'/src', __DIR__.'/symfony/src'),
'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib', 'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib',
'Doctrine' => __DIR__.'/vendor/doctrine/lib', 'Doctrine' => __DIR__.'/vendor/doctrine/lib',
'Monolog' => __DIR__.'/vendor/monolog/src', 'Monolog' => __DIR__.'/vendor/monolog/src',
)); ));
``` ```

View File

@ -72,9 +72,9 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
{ {
$data = array( $data = array(
array(__DIR__.'/Fixtures/Namespaced', array( array(__DIR__.'/Fixtures/Namespaced', array(
'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php', 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php',
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php', 'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php',
'Namespaced\\WithComments' => realpath(__DIR__).'/Fixtures/Namespaced/WithComments.php', 'Namespaced\\WithComments' => realpath(__DIR__).'/Fixtures/Namespaced/WithComments.php',
), ),
), ),
@ -85,22 +85,22 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php', 'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php',
)), )),
array(__DIR__.'/Fixtures/Pearlike', array( array(__DIR__.'/Fixtures/Pearlike', array(
'Pearlike_Foo' => realpath(__DIR__).'/Fixtures/Pearlike/Foo.php', 'Pearlike_Foo' => realpath(__DIR__).'/Fixtures/Pearlike/Foo.php',
'Pearlike_Bar' => realpath(__DIR__).'/Fixtures/Pearlike/Bar.php', 'Pearlike_Bar' => realpath(__DIR__).'/Fixtures/Pearlike/Bar.php',
'Pearlike_Baz' => realpath(__DIR__).'/Fixtures/Pearlike/Baz.php', 'Pearlike_Baz' => realpath(__DIR__).'/Fixtures/Pearlike/Baz.php',
'Pearlike_WithComments' => realpath(__DIR__).'/Fixtures/Pearlike/WithComments.php', 'Pearlike_WithComments' => realpath(__DIR__).'/Fixtures/Pearlike/WithComments.php',
)), )),
array(__DIR__.'/Fixtures/classmap', array( array(__DIR__.'/Fixtures/classmap', array(
'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php', 'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php', 'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
'A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', 'A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
'Alpha\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', 'Alpha\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
'Alpha\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', 'Alpha\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
'Beta\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', 'Beta\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
'Beta\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php', 'Beta\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
'ClassMap\\SomeInterface' => realpath(__DIR__).'/Fixtures/classmap/SomeInterface.php', 'ClassMap\\SomeInterface' => realpath(__DIR__).'/Fixtures/classmap/SomeInterface.php',
'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php', 'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php',
'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php', 'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php',
)), )),
); );

View File

@ -32,8 +32,8 @@ namespace Symfony\Component\ClassLoader;
* // register classes with namespaces * // register classes with namespaces
* $loader->registerNamespaces(array( * $loader->registerNamespaces(array(
* 'Symfony\Component' => __DIR__.'/component', * 'Symfony\Component' => __DIR__.'/component',
* 'Symfony' => __DIR__.'/framework', * 'Symfony' => __DIR__.'/framework',
* 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'), * 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'),
* )); * ));
* *
* // register a library using the PEAR naming convention * // register a library using the PEAR naming convention

View File

@ -28,13 +28,13 @@ class NodeBuilder implements NodeParentInterface
public function __construct() public function __construct()
{ {
$this->nodeMapping = array( $this->nodeMapping = array(
'variable' => __NAMESPACE__.'\\VariableNodeDefinition', 'variable' => __NAMESPACE__.'\\VariableNodeDefinition',
'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition', 'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition',
'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition', 'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition',
'integer' => __NAMESPACE__.'\\IntegerNodeDefinition', 'integer' => __NAMESPACE__.'\\IntegerNodeDefinition',
'float' => __NAMESPACE__.'\\FloatNodeDefinition', 'float' => __NAMESPACE__.'\\FloatNodeDefinition',
'array' => __NAMESPACE__.'\\ArrayNodeDefinition', 'array' => __NAMESPACE__.'\\ArrayNodeDefinition',
'enum' => __NAMESPACE__.'\\EnumNodeDefinition', 'enum' => __NAMESPACE__.'\\EnumNodeDefinition',
); );
} }

View File

@ -107,13 +107,13 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
0 => array( 0 => array(
'name' => 'something', 'name' => 'something',
), ),
5 => array( 5 => array(
0 => 'this won\'t work too', 0 => 'this won\'t work too',
'new_key' => 'some other value', 'new_key' => 'some other value',
), ),
'string_key' => 'just value', 'string_key' => 'just value',
), ),
array( array(
0 => array ( 0 => array (

View File

@ -754,9 +754,9 @@ class Application
$trace = $e->getTrace(); $trace = $e->getTrace();
array_unshift($trace, array( array_unshift($trace, array(
'function' => '', 'function' => '',
'file' => $e->getFile() != null ? $e->getFile() : 'n/a', 'file' => $e->getFile() != null ? $e->getFile() : 'n/a',
'line' => $e->getLine() != null ? $e->getLine() : 'n/a', 'line' => $e->getLine() != null ? $e->getLine() : 'n/a',
'args' => array(), 'args' => array(),
)); ));
for ($i = 0, $count = count($trace); $i < $count; $i++) { for ($i = 0, $count = count($trace); $i < $count; $i++) {

View File

@ -30,11 +30,11 @@ class JsonDescriptor extends Descriptor
protected function describeInputArgument(InputArgument $argument, array $options = array()) protected function describeInputArgument(InputArgument $argument, array $options = array())
{ {
return $this->output(array( return $this->output(array(
'name' => $argument->getName(), 'name' => $argument->getName(),
'is_required' => $argument->isRequired(), 'is_required' => $argument->isRequired(),
'is_array' => $argument->isArray(), 'is_array' => $argument->isArray(),
'description' => $argument->getDescription(), 'description' => $argument->getDescription(),
'default' => $argument->getDefault(), 'default' => $argument->getDefault(),
), $options); ), $options);
} }
@ -44,13 +44,13 @@ class JsonDescriptor extends Descriptor
protected function describeInputOption(InputOption $option, array $options = array()) protected function describeInputOption(InputOption $option, array $options = array())
{ {
return $this->output(array( return $this->output(array(
'name' => '--'.$option->getName(), 'name' => '--'.$option->getName(),
'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '', 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
'accept_value' => $option->acceptValue(), 'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(), 'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(), 'is_multiple' => $option->isArray(),
'description' => $option->getDescription(), 'description' => $option->getDescription(),
'default' => $option->getDefault(), 'default' => $option->getDefault(),
), $options); ), $options);
} }
@ -81,12 +81,12 @@ class JsonDescriptor extends Descriptor
$command->mergeApplicationDefinition(false); $command->mergeApplicationDefinition(false);
return $this->output(array( return $this->output(array(
'name' => $command->getName(), 'name' => $command->getName(),
'usage' => $command->getSynopsis(), 'usage' => $command->getSynopsis(),
'description' => $command->getDescription(), 'description' => $command->getDescription(),
'help' => $command->getProcessedHelp(), 'help' => $command->getProcessedHelp(),
'aliases' => $command->getAliases(), 'aliases' => $command->getAliases(),
'definition' => $this->describeInputDefinition($command->getNativeDefinition(), array('as_array' => true)), 'definition' => $this->describeInputDefinition($command->getNativeDefinition(), array('as_array' => true)),
), $options); ), $options);
} }

View File

@ -21,31 +21,31 @@ namespace Symfony\Component\Console\Formatter;
class OutputFormatterStyle implements OutputFormatterStyleInterface class OutputFormatterStyle implements OutputFormatterStyleInterface
{ {
private static $availableForegroundColors = array( private static $availableForegroundColors = array(
'black' => 30, 'black' => 30,
'red' => 31, 'red' => 31,
'green' => 32, 'green' => 32,
'yellow' => 33, 'yellow' => 33,
'blue' => 34, 'blue' => 34,
'magenta' => 35, 'magenta' => 35,
'cyan' => 36, 'cyan' => 36,
'white' => 37, 'white' => 37,
); );
private static $availableBackgroundColors = array( private static $availableBackgroundColors = array(
'black' => 40, 'black' => 40,
'red' => 41, 'red' => 41,
'green' => 42, 'green' => 42,
'yellow' => 43, 'yellow' => 43,
'blue' => 44, 'blue' => 44,
'magenta' => 45, 'magenta' => 45,
'cyan' => 46, 'cyan' => 46,
'white' => 47, 'white' => 47,
); );
private static $availableOptions = array( private static $availableOptions = array(
'bold' => 1, 'bold' => 1,
'underscore' => 4, 'underscore' => 4,
'blink' => 5, 'blink' => 5,
'reverse' => 7, 'reverse' => 7,
'conceal' => 8, 'conceal' => 8,
); );
private $foreground; private $foreground;

View File

@ -21,20 +21,20 @@ use Symfony\Component\Console\Output\OutputInterface;
*/ */
class ProgressHelper extends Helper class ProgressHelper extends Helper
{ {
const FORMAT_QUIET = ' %percent%%'; const FORMAT_QUIET = ' %percent%%';
const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%'; const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%'; const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
const FORMAT_QUIET_NOMAX = ' %current%'; const FORMAT_QUIET_NOMAX = ' %current%';
const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]'; const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%'; const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
// options // options
private $barWidth = 28; private $barWidth = 28;
private $barChar = '='; private $barChar = '=';
private $emptyBarChar = '-'; private $emptyBarChar = '-';
private $progressChar = '>'; private $progressChar = '>';
private $format = null; private $format = null;
private $redrawFreq = 1; private $redrawFreq = 1;
private $lastMessagesLength; private $lastMessagesLength;
private $barCharOriginal; private $barCharOriginal;
@ -92,7 +92,7 @@ class ProgressHelper extends Helper
*/ */
private $widths = array( private $widths = array(
'current' => 4, 'current' => 4,
'max' => 4, 'max' => 4,
'percent' => 3, 'percent' => 3,
'elapsed' => 6, 'elapsed' => 6,
); );
@ -183,9 +183,9 @@ class ProgressHelper extends Helper
public function start(OutputInterface $output, $max = null) public function start(OutputInterface $output, $max = null)
{ {
$this->startTime = time(); $this->startTime = time();
$this->current = 0; $this->current = 0;
$this->max = (int) $max; $this->max = (int) $max;
$this->output = $output; $this->output = $output;
$this->lastMessagesLength = 0; $this->lastMessagesLength = 0;
$this->barCharOriginal = ''; $this->barCharOriginal = '';
@ -332,11 +332,11 @@ class ProgressHelper extends Helper
} }
if ($this->max > 0) { if ($this->max > 0) {
$this->widths['max'] = $this->strlen($this->max); $this->widths['max'] = $this->strlen($this->max);
$this->widths['current'] = $this->widths['max']; $this->widths['current'] = $this->widths['max'];
} else { } else {
$this->barCharOriginal = $this->barChar; $this->barCharOriginal = $this->barChar;
$this->barChar = $this->emptyBarChar; $this->barChar = $this->emptyBarChar;
} }
} }
@ -349,7 +349,7 @@ class ProgressHelper extends Helper
*/ */
private function generate($finish = false) private function generate($finish = false)
{ {
$vars = array(); $vars = array();
$percent = 0; $percent = 0;
if ($this->max > 0) { if ($this->max > 0) {
$percent = (float) $this->current / $this->max; $percent = (float) $this->current / $this->max;

View File

@ -49,8 +49,8 @@ class InputArgument
throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode)); throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
} }
$this->name = $name; $this->name = $name;
$this->mode = $mode; $this->mode = $mode;
$this->description = $description; $this->description = $description;
$this->setDefault($default); $this->setDefault($default);

View File

@ -86,9 +86,9 @@ class InputDefinition
*/ */
public function setArguments($arguments = array()) public function setArguments($arguments = array())
{ {
$this->arguments = array(); $this->arguments = array();
$this->requiredCount = 0; $this->requiredCount = 0;
$this->hasOptional = false; $this->hasOptional = false;
$this->hasAnArrayArgument = false; $this->hasAnArrayArgument = false;
$this->addArguments($arguments); $this->addArguments($arguments);
} }

View File

@ -20,7 +20,7 @@ namespace Symfony\Component\Console\Input;
*/ */
class InputOption class InputOption
{ {
const VALUE_NONE = 1; const VALUE_NONE = 1;
const VALUE_REQUIRED = 2; const VALUE_REQUIRED = 2;
const VALUE_OPTIONAL = 4; const VALUE_OPTIONAL = 4;
const VALUE_IS_ARRAY = 8; const VALUE_IS_ARRAY = 8;
@ -77,9 +77,9 @@ class InputOption
throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode)); throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
} }
$this->name = $name; $this->name = $name;
$this->shortcut = $shortcut; $this->shortcut = $shortcut;
$this->mode = $mode; $this->mode = $mode;
$this->description = $description; $this->description = $description;
if ($this->isArray() && !$this->acceptValue()) { if ($this->isArray() && !$this->acceptValue()) {

View File

@ -22,15 +22,15 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
*/ */
interface OutputInterface interface OutputInterface
{ {
const VERBOSITY_QUIET = 0; const VERBOSITY_QUIET = 0;
const VERBOSITY_NORMAL = 1; const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2; const VERBOSITY_VERBOSE = 2;
const VERBOSITY_VERY_VERBOSE = 3; const VERBOSITY_VERY_VERBOSE = 3;
const VERBOSITY_DEBUG = 4; const VERBOSITY_DEBUG = 4;
const OUTPUT_NORMAL = 0; const OUTPUT_NORMAL = 0;
const OUTPUT_RAW = 1; const OUTPUT_RAW = 1;
const OUTPUT_PLAIN = 2; const OUTPUT_PLAIN = 2;
/** /**
* Writes a message to the output. * Writes a message to the output.

View File

@ -21,13 +21,13 @@ namespace Symfony\Component\CssSelector\Parser;
*/ */
class Token class Token
{ {
const TYPE_FILE_END = 'eof'; const TYPE_FILE_END = 'eof';
const TYPE_DELIMITER = 'delimiter'; const TYPE_DELIMITER = 'delimiter';
const TYPE_WHITESPACE = 'whitespace'; const TYPE_WHITESPACE = 'whitespace';
const TYPE_IDENTIFIER = 'identifier'; const TYPE_IDENTIFIER = 'identifier';
const TYPE_HASH = 'hash'; const TYPE_HASH = 'hash';
const TYPE_NUMBER = 'number'; const TYPE_NUMBER = 'number';
const TYPE_STRING = 'string'; const TYPE_STRING = 'string';
/** /**
* @var int * @var int

View File

@ -31,13 +31,13 @@ class AttributeMatchingExtension extends AbstractExtension
{ {
return array( return array(
'exists' => array($this, 'translateExists'), 'exists' => array($this, 'translateExists'),
'=' => array($this, 'translateEquals'), '=' => array($this, 'translateEquals'),
'~=' => array($this, 'translateIncludes'), '~=' => array($this, 'translateIncludes'),
'|=' => array($this, 'translateDashMatch'), '|=' => array($this, 'translateDashMatch'),
'^=' => array($this, 'translatePrefixMatch'), '^=' => array($this, 'translatePrefixMatch'),
'$=' => array($this, 'translateSuffixMatch'), '$=' => array($this, 'translateSuffixMatch'),
'*=' => array($this, 'translateSubstringMatch'), '*=' => array($this, 'translateSubstringMatch'),
'!=' => array($this, 'translateDifferent'), '!=' => array($this, 'translateDifferent'),
); );
} }

View File

@ -34,12 +34,12 @@ class FunctionExtension extends AbstractExtension
public function getFunctionTranslators() public function getFunctionTranslators()
{ {
return array( return array(
'nth-child' => array($this, 'translateNthChild'), 'nth-child' => array($this, 'translateNthChild'),
'nth-last-child' => array($this, 'translateNthLastChild'), 'nth-last-child' => array($this, 'translateNthLastChild'),
'nth-of-type' => array($this, 'translateNthOfType'), 'nth-of-type' => array($this, 'translateNthOfType'),
'nth-last-of-type' => array($this, 'translateNthLastOfType'), 'nth-last-of-type' => array($this, 'translateNthLastOfType'),
'contains' => array($this, 'translateContains'), 'contains' => array($this, 'translateContains'),
'lang' => array($this, 'translateLang'), 'lang' => array($this, 'translateLang'),
); );
} }

View File

@ -45,14 +45,14 @@ class HtmlExtension extends AbstractExtension
public function getPseudoClassTranslators() public function getPseudoClassTranslators()
{ {
return array( return array(
'checked' => array($this, 'translateChecked'), 'checked' => array($this, 'translateChecked'),
'link' => array($this, 'translateLink'), 'link' => array($this, 'translateLink'),
'disabled' => array($this, 'translateDisabled'), 'disabled' => array($this, 'translateDisabled'),
'enabled' => array($this, 'translateEnabled'), 'enabled' => array($this, 'translateEnabled'),
'selected' => array($this, 'translateSelected'), 'selected' => array($this, 'translateSelected'),
'invalid' => array($this, 'translateInvalid'), 'invalid' => array($this, 'translateInvalid'),
'hover' => array($this, 'translateHover'), 'hover' => array($this, 'translateHover'),
'visited' => array($this, 'translateVisited'), 'visited' => array($this, 'translateVisited'),
); );
} }

View File

@ -25,8 +25,8 @@ use Symfony\Component\CssSelector\XPath\XPathExpr;
*/ */
class NodeExtension extends AbstractExtension class NodeExtension extends AbstractExtension
{ {
const ELEMENT_NAME_IN_LOWER_CASE = 1; const ELEMENT_NAME_IN_LOWER_CASE = 1;
const ATTRIBUTE_NAME_IN_LOWER_CASE = 2; const ATTRIBUTE_NAME_IN_LOWER_CASE = 2;
const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4; const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4;
/** /**
@ -79,15 +79,15 @@ class NodeExtension extends AbstractExtension
public function getNodeTranslators() public function getNodeTranslators()
{ {
return array( return array(
'Selector' => array($this, 'translateSelector'), 'Selector' => array($this, 'translateSelector'),
'CombinedSelector' => array($this, 'translateCombinedSelector'), 'CombinedSelector' => array($this, 'translateCombinedSelector'),
'Negation' => array($this, 'translateNegation'), 'Negation' => array($this, 'translateNegation'),
'Function' => array($this, 'translateFunction'), 'Function' => array($this, 'translateFunction'),
'Pseudo' => array($this, 'translatePseudo'), 'Pseudo' => array($this, 'translatePseudo'),
'Attribute' => array($this, 'translateAttribute'), 'Attribute' => array($this, 'translateAttribute'),
'Class' => array($this, 'translateClass'), 'Class' => array($this, 'translateClass'),
'Hash' => array($this, 'translateHash'), 'Hash' => array($this, 'translateHash'),
'Element' => array($this, 'translateElement'), 'Element' => array($this, 'translateElement'),
); );
} }

View File

@ -30,14 +30,14 @@ class PseudoClassExtension extends AbstractExtension
public function getPseudoClassTranslators() public function getPseudoClassTranslators()
{ {
return array( return array(
'root' => array($this, 'translateRoot'), 'root' => array($this, 'translateRoot'),
'first-child' => array($this, 'translateFirstChild'), 'first-child' => array($this, 'translateFirstChild'),
'last-child' => array($this, 'translateLastChild'), 'last-child' => array($this, 'translateLastChild'),
'first-of-type' => array($this, 'translateFirstOfType'), 'first-of-type' => array($this, 'translateFirstOfType'),
'last-of-type' => array($this, 'translateLastOfType'), 'last-of-type' => array($this, 'translateLastOfType'),
'only-child' => array($this, 'translateOnlyChild'), 'only-child' => array($this, 'translateOnlyChild'),
'only-of-type' => array($this, 'translateOnlyOfType'), 'only-of-type' => array($this, 'translateOnlyOfType'),
'empty' => array($this, 'translateEmpty'), 'empty' => array($this, 'translateEmpty'),
); );
} }

View File

@ -27,19 +27,19 @@ class ErrorHandler
const TYPE_DEPRECATION = -100; const TYPE_DEPRECATION = -100;
private $levels = array( private $levels = array(
E_WARNING => 'Warning', E_WARNING => 'Warning',
E_NOTICE => 'Notice', E_NOTICE => 'Notice',
E_USER_ERROR => 'User Error', E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning', E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice', E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice', E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error', E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
E_DEPRECATED => 'Deprecated', E_DEPRECATED => 'Deprecated',
E_USER_DEPRECATED => 'User Deprecated', E_USER_DEPRECATED => 'User Deprecated',
E_ERROR => 'Error', E_ERROR => 'Error',
E_CORE_ERROR => 'Core Error', E_CORE_ERROR => 'Core Error',
E_COMPILE_ERROR => 'Compile Error', E_COMPILE_ERROR => 'Compile Error',
E_PARSE => 'Parse', E_PARSE => 'Parse',
); );
private $level; private $level;

View File

@ -66,8 +66,8 @@ class FlattenException
foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
$exceptions[] = array( $exceptions[] = array(
'message' => $exception->getMessage(), 'message' => $exception->getMessage(),
'class' => $exception->getClass(), 'class' => $exception->getClass(),
'trace' => $exception->getTrace(), 'trace' => $exception->getTrace(),
); );
} }
@ -208,14 +208,14 @@ class FlattenException
{ {
$this->trace = array(); $this->trace = array();
$this->trace[] = array( $this->trace[] = array(
'namespace' => '', 'namespace' => '',
'short_class' => '', 'short_class' => '',
'class' => '', 'class' => '',
'type' => '', 'type' => '',
'function' => '', 'function' => '',
'file' => $file, 'file' => $file,
'line' => $line, 'line' => $line,
'args' => array(), 'args' => array(),
); );
foreach ($trace as $entry) { foreach ($trace as $entry) {
$class = ''; $class = '';
@ -227,14 +227,14 @@ class FlattenException
} }
$this->trace[] = array( $this->trace[] = array(
'namespace' => $namespace, 'namespace' => $namespace,
'short_class' => $class, 'short_class' => $class,
'class' => isset($entry['class']) ? $entry['class'] : '', 'class' => isset($entry['class']) ? $entry['class'] : '',
'type' => isset($entry['type']) ? $entry['type'] : '', 'type' => isset($entry['type']) ? $entry['type'] : '',
'function' => isset($entry['function']) ? $entry['function'] : null, 'function' => isset($entry['function']) ? $entry['function'] : null,
'file' => isset($entry['file']) ? $entry['file'] : null, 'file' => isset($entry['file']) ? $entry['file'] : null,
'line' => isset($entry['line']) ? $entry['line'] : null, 'line' => isset($entry['line']) ? $entry['line'] : null,
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
); );
} }
} }

View File

@ -298,7 +298,7 @@ EOF;
$formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1])); $formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1]));
} elseif ('array' === $item[0]) { } elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) { } elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset)); $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset));
} elseif ('null' === $item[0]) { } elseif ('null' === $item[0]) {
$formattedValue = '<em>null</em>'; $formattedValue = '<em>null</em>';

View File

@ -162,8 +162,8 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
'message' => 'test', 'message' => 'test',
'class' => 'Exception', 'class' => 'Exception',
'trace' => array(array( 'trace' => array(array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'file' => 'foo.php', 'line' => 123, 'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'file' => 'foo.php', 'line' => 123,
'args' => array(), 'args' => array(),
)), )),
), ),
), $flattened->toArray()); ), $flattened->toArray());
@ -214,14 +214,14 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
'class' => 'Exception', 'class' => 'Exception',
'trace' => array( 'trace' => array(
array( array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '', 'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => '',
'file' => 'foo.php', 'line' => 123, 'file' => 'foo.php', 'line' => 123,
'args' => array(), 'args' => array(),
), ),
array( array(
'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => 'test', 'namespace' => '', 'short_class' => '', 'class' => '','type' => '','function' => 'test',
'file' => __FILE__, 'line' => 123, 'file' => __FILE__, 'line' => 123,
'args' => array( 'args' => array(
array( array(
'incomplete-object', 'BogusTestClass', 'incomplete-object', 'BogusTestClass',
), ),

View File

@ -59,7 +59,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
public function process(ContainerBuilder $container) public function process(ContainerBuilder $container)
{ {
$this->container = $container; $this->container = $container;
$this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph = $container->getCompiler()->getServiceReferenceGraph();
$this->graph->clear(); $this->graph->clear();
foreach ($container->getDefinitions() as $id => $definition) { foreach ($container->getDefinitions() as $id => $definition) {

View File

@ -58,8 +58,8 @@ class CheckCircularReferencesPass implements CompilerPassInterface
private function checkOutEdges(array $edges) private function checkOutEdges(array $edges)
{ {
foreach ($edges as $edge) { foreach ($edges as $edge) {
$node = $edge->getDestNode(); $node = $edge->getDestNode();
$id = $node->getId(); $id = $node->getId();
if (empty($this->checkedNodes[$id])) { if (empty($this->checkedNodes[$id])) {
$searchKey = array_search($id, $this->currentPath); $searchKey = array_search($id, $this->currentPath);

View File

@ -87,12 +87,12 @@ class Container implements IntrospectableContainerInterface
{ {
$this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag; $this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
$this->services = array(); $this->services = array();
$this->aliases = array(); $this->aliases = array();
$this->scopes = array(); $this->scopes = array();
$this->scopeChildren = array(); $this->scopeChildren = array();
$this->scopedServices = array(); $this->scopedServices = array();
$this->scopeStacks = array(); $this->scopeStacks = array();
} }
/** /**

View File

@ -26,10 +26,10 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
interface ContainerInterface interface ContainerInterface
{ {
const EXCEPTION_ON_INVALID_REFERENCE = 1; const EXCEPTION_ON_INVALID_REFERENCE = 1;
const NULL_ON_INVALID_REFERENCE = 2; const NULL_ON_INVALID_REFERENCE = 2;
const IGNORE_ON_INVALID_REFERENCE = 3; const IGNORE_ON_INVALID_REFERENCE = 3;
const SCOPE_CONTAINER = 'container'; const SCOPE_CONTAINER = 'container';
const SCOPE_PROTOTYPE = 'prototype'; const SCOPE_PROTOTYPE = 'prototype';
/** /**
* Sets a service. * Sets a service.

View File

@ -34,8 +34,8 @@ class GraphvizDumper extends Dumper
private $edges; private $edges;
private $options = array( private $options = array(
'graph' => array('ratio' => 'compress'), 'graph' => array('ratio' => 'compress'),
'node' => array('fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'), 'node' => array('fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'),
'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5), 'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5),
'node.instance' => array('fillcolor' => '#9999ff', 'style' => 'filled'), 'node.instance' => array('fillcolor' => '#9999ff', 'style' => 'filled'),
'node.definition' => array('fillcolor' => '#eeeeee'), 'node.definition' => array('fillcolor' => '#eeeeee'),
'node.missing' => array('fillcolor' => '#ff9999', 'style' => 'filled'), 'node.missing' => array('fillcolor' => '#ff9999', 'style' => 'filled'),

View File

@ -96,7 +96,7 @@ class PhpDumper extends Dumper
public function dump(array $options = array()) public function dump(array $options = array())
{ {
$options = array_merge(array( $options = array_merge(array(
'class' => 'ProjectServiceContainer', 'class' => 'ProjectServiceContainer',
'base_class' => 'Container', 'base_class' => 'Container',
), $options); ), $options);
@ -333,9 +333,9 @@ class PhpDumper extends Dumper
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id)); throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
} }
$simple = $this->isSimpleInstance($id, $definition); $simple = $this->isSimpleInstance($id, $definition);
$isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition);
$instantiation = ''; $instantiation = '';
if (!$isProxyCandidate && ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) { if (!$isProxyCandidate && ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
$instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance'); $instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance');
@ -546,17 +546,17 @@ EOF;
} }
if ($definition->isLazy()) { if ($definition->isLazy()) {
$lazyInitialization = '$lazyLoad = true'; $lazyInitialization = '$lazyLoad = true';
$lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *"; $lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *";
} else { } else {
$lazyInitialization = ''; $lazyInitialization = '';
$lazyInitializationDoc = ''; $lazyInitializationDoc = '';
} }
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer // with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
$isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition);
$visibility = $isProxyCandidate ? 'public' : 'protected'; $visibility = $isProxyCandidate ? 'public' : 'protected';
$code = <<<EOF $code = <<<EOF
/** /**
* Gets the '$id' service.$doc * Gets the '$id' service.$doc

View File

@ -572,7 +572,7 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$container->compile(); $container->compile();
$classesPath = realpath(__DIR__.'/Fixtures/includes/classes.php'); $classesPath = realpath(__DIR__.'/Fixtures/includes/classes.php');
$matchingResources = array_filter( $matchingResources = array_filter(
$container->getResources(), $container->getResources(),
function (ResourceInterface $resource) use ($classesPath) { function (ResourceInterface $resource) use ($classesPath) {
@ -650,16 +650,16 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
public function testPrivateServiceUser() public function testPrivateServiceUser()
{ {
$fooDefinition = new Definition('BarClass'); $fooDefinition = new Definition('BarClass');
$fooUserDefinition = new Definition('BarUserClass', array(new Reference('bar'))); $fooUserDefinition = new Definition('BarUserClass', array(new Reference('bar')));
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->setResourceTracking(false); $container->setResourceTracking(false);
$fooDefinition->setPublic(false); $fooDefinition->setPublic(false);
$container->addDefinitions(array( $container->addDefinitions(array(
'bar' => $fooDefinition, 'bar' => $fooDefinition,
'bar_user' => $fooUserDefinition, 'bar_user' => $fooUserDefinition,
)); ));
$container->compile(); $container->compile();

View File

@ -41,8 +41,8 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase
$dumper = new GraphvizDumper($container); $dumper = new GraphvizDumper($container);
$this->assertEquals($dumper->dump(array( $this->assertEquals($dumper->dump(array(
'graph' => array('ratio' => 'normal'), 'graph' => array('ratio' => 'normal'),
'node' => array('fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'), 'node' => array('fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'),
'edge' => array('fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1), 'edge' => array('fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1),
'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'), 'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'),
'node.definition' => array('fillcolor' => 'grey'), 'node.definition' => array('fillcolor' => 'grey'),
'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'), 'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'),

Some files were not shown because too many files have changed in this diff Show More