Skip to content

Cs fix #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from
Feb 27, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function warmUp($cacheDir)
}

$entityManagers = $this->container->getParameter('doctrine.orm.entity_managers');
foreach ($entityManagers AS $entityManagerName) {
foreach ($entityManagers as $entityManagerName) {
$em = $this->container->get(sprintf('doctrine.orm.%s_entity_manager', $entityManagerName));
/* @var $em Doctrine\ORM\EntityManager */
$classes = $em->getMetadataFactory()->getAllMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected function getDoctrineEntityManagers()
{
$entityManagerNames = $this->container->getParameter('doctrine.orm.entity_managers');
$entityManagers = array();
foreach ($entityManagerNames AS $entityManagerName) {
foreach ($entityManagerNames as $entityManagerName) {
$em = $this->container->get(sprintf('doctrine.orm.%s_entity_manager', $entityManagerName));
$entityManagers[] = $em;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$entityManagerName = $input->getOption('em') ?
$input->getOption('em') :
$this->container->getParameter('doctrine.orm.default_entity_manager');
-

$entityManagerService = sprintf('doctrine.orm.%s_entity_manager', $entityManagerName);

/* @var $entityManager Doctrine\ORM\EntityManager */
Expand All @@ -61,11 +61,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->write(sprintf("Found %d entities mapped in entity manager '%s':",
count($entityClassNames), $entityManagerName), true);

foreach ($entityClassNames AS $entityClassName) {
foreach ($entityClassNames as $entityClassName) {
try {
$cm = $entityManager->getClassMetadata($entityClassName);
$output->write("<info>[OK]</info> " . $entityClassName, true);
} catch(MappingException $e) {
} catch (MappingException $e) {
$output->write("<error>[FAIL]</error> " . $entityClassName, true);
$output->write("<comment>" . $e->getMessage()."</comment>", true);
$output->write("", true);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/DoctrineBundle/ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function createConnection(array $params, Configuration $config = null, Ev

private function initializeTypes()
{
foreach ($this->typesConfig AS $type => $className) {
foreach ($this->typesConfig as $type => $className) {
if (Type::hasType($type)) {
Type::overrideType($type, $className);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testWarmCache()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.orm.auto_generate_proxy_classes'))
->will($this->returnValue( false ));
->will($this->returnValue(false));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('doctrine.orm.entity_managers'))
Expand Down Expand Up @@ -69,11 +69,11 @@ public function testSkipWhenProxiesAreAutoGenerated()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.orm.auto_generate_proxy_classes'))
->will($this->returnValue( true ));
->will($this->returnValue(true));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('assertion'))
->will($this->returnValue( true ));
->will($this->returnValue(true));

$cacheWarmer = new ProxyCacheWarmer($container);
$cacheWarmer->warmUp(sys_get_temp_dir());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ protected function assertDICDefinitionMethodCallOnce($definition, $methodName, a
{
$calls = $definition->getMethodCalls();
$called = false;
foreach ($calls AS $call) {
foreach ($calls as $call) {
if ($call[0] == $methodName) {
if ($called) {
$this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static public function dataValidateSchemaFiles()
{
$schemaFiles = array();
$di = new \DirectoryIterator(__DIR__ . "/Fixtures/config/xml");
foreach ($di AS $element) {
foreach ($di as $element) {
if ($element->isFile() && strpos($element->getFilename(), ".xml") !== false) {
$schemaFiles[] = array($element->getPathname());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function warmUp($cacheDir)
}

$documentManagers = $this->container->getParameter('doctrine.odm.mongodb.document_managers');
foreach ($documentManagers AS $documentManagerName) {
foreach ($documentManagers as $documentManagerName) {
$dm = $this->container->get(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManagerName));
/* @var $dm Doctrine\ODM\MongoDB\DocumentManager */
$classes = $dm->getMetadataFactory()->getAllMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function warmUp($cacheDir)
}

$documentManagers = $this->container->getParameter('doctrine.odm.mongodb.document_managers');
foreach ($documentManagers AS $documentManagerName) {
foreach ($documentManagers as $documentManagerName) {
$dm = $this->container->get(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManagerName));
/* @var $dm Doctrine\ODM\MongoDB\DocumentManager */
$classes = $dm->getMetadataFactory()->getAllMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function getDoctrineDocumentManagers()
{
$documentManagerNames = $this->container->getParameter('doctrine.odm.mongodb.document_managers');
$documentManagers = array();
foreach ($documentManagerNames AS $documentManagerName) {
foreach ($documentManagerNames as $documentManagerName) {
$dm = $this->container->get(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManagerName));
$documentManagers[] = $dm;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ protected function loadDocumentManagerBundlesMappingInformation(array $documentM
if ($odmConfigDef->hasMethodCall('setDocumentNamespaces')) {
// TODO: Can we make a method out of it on Definition? replaceMethodArguments() or something.
$calls = $odmConfigDef->getMethodCalls();
foreach ($calls AS $call) {
foreach ($calls as $call) {
if ($call[0] == 'setDocumentNamespaces') {
$this->aliasMap = array_merge($call[1][0], $this->aliasMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testWarmCache()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.auto_generate_hydrator_classes'))
->will($this->returnValue( false ));
->will($this->returnValue(false));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.document_managers'))
Expand Down Expand Up @@ -72,11 +72,11 @@ public function testSkipWhenHydratorsAreAutoGenerated()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.auto_generate_hydrator_classes'))
->will($this->returnValue( true ));
->will($this->returnValue(true));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('assertion'))
->will($this->returnValue( true ));
->will($this->returnValue(true));

$cacheWarmer = new HydratorCacheWarmer($container);
$cacheWarmer->warmUp(sys_get_temp_dir());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testWarmCache()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.auto_generate_proxy_classes'))
->will($this->returnValue( false ));
->will($this->returnValue(false));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.document_managers'))
Expand Down Expand Up @@ -72,11 +72,11 @@ public function testSkipWhenProxiesAreAutoGenerated()
$container->expects($this->at(1))
->method('getParameter')
->with($this->equalTo('doctrine.odm.mongodb.auto_generate_proxy_classes'))
->will($this->returnValue( true ));
->will($this->returnValue(true));
$container->expects($this->at(2))
->method('getParameter')
->with($this->equalTo('assertion'))
->will($this->returnValue( true ));
->will($this->returnValue(true));

$cacheWarmer = new ProxyCacheWarmer($container);
$cacheWarmer->warmUp(sys_get_temp_dir());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public function indexAction($path, $controller)

$attributes->remove('path');
$attributes->remove('controller');
if ('none' !== $path)
{
if ('none' !== $path) {
parse_str($path, $tmp);
$attributes->add($tmp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public function render($controller, array $attributes = array(), array $options
{
$options['attributes'] = $attributes;

if (isset($options['query']))
{
if (isset($options['query'])) {
$options['query'] = $options['query'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function parse($name)
}

// normalize name
$name = str_replace(':/' , ':', preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')));
$name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')));

if (false !== strpos($name, '..')) {
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testRoute($permanent, $expectedCode)
$router
->expects($this->once())
->method('generate')
->with($this->equalTo($route),$this->equalTo($params))
->with($this->equalTo($route), $this->equalTo($params))
->will($this->returnValue($url));

$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Util/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function copy($originFile, $targetFile, $options = array())
$mostRecent = false;
if (file_exists($targetFile)) {
$statTarget = stat($targetFile);
$stat_origin = stat($originFile);
$mostRecent = ($stat_origin['mtime'] > $statTarget['mtime']) ? true : false;
$statOrigin = stat($originFile);
$mostRecent = $statOrigin['mtime'] > $statTarget['mtime'];
}

if ($options['override'] || !file_exists($targetFile) || $mostRecent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public function renderAction($controller, array $attributes = array(), array $op
{
$options['attributes'] = $attributes;

if (isset($options['query']))
{
if (isset($options['query'])) {
$options['query'] = $options['query'];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/Definition/ArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ protected function finalizeValue($value)
));
}

if ($child->hasDefaultValue()) {
if ($child->hasDefaultValue()) {
$value[$name] = $child->getDefaultValue();
}

Expand Down
64 changes: 32 additions & 32 deletions src/Symfony/Component/Config/Definition/BooleanNode.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
class BooleanNode extends ScalarNode
{
/**
* {@inheritDoc}
*/
protected function validateType($value)
{
parent::validateType($value);
if (!is_bool($value)) {
throw new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected boolean, but got %s.',
$this->getPath(),
json_encode($value)
));
}
}
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Definition;

use Symfony\Component\Config\Definition\Exception\InvalidTypeException;

class BooleanNode extends ScalarNode
{
/**
* {@inheritDoc}
*/
protected function validateType($value)
{
parent::validateType($value);

if (!is_bool($value)) {
throw new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected boolean, but got %s.',
$this->getPath(),
json_encode($value)
));
}
}
}
Loading