8000 [DoctrineBundle] fixed CS · johnnywalker/symfony@6edb644 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6edb644

Browse files
committed
[DoctrineBundle] fixed CS
1 parent 74a243b commit 6edb644

File tree

6 files changed

+20
-23
lines changed

6 files changed

+20
-23
lines changed

src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5656

5757
$params = $connection->getParams();
5858

59-
$name = isset($params['path'])?$params['path']:(isset($params['dbname'])?$params['dbname']:false);
59+
$name = isset($params['path']) ? $params['path'] : (isset($params['dbname']) ? $params['dbname'] : false);
6060

6161
if (!$name) {
6262
throw new \InvalidArgumentException("Connection does not contain a 'path' or 'dbname' parameter and cannot be dropped.");
@@ -71,7 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
7171
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
7272
}
7373
} else {
74-
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.' . PHP_EOL);
74+
$output->writeln('<error>ATTENTION:</error> This operation should not be executed in a production environment.');
75+
$output->writeln('');
7576
$output->writeln(sprintf('<info>Would drop the database named <comment>%s</comment>.</info>', $name));
7677
$output->writeln('Please run the operation with --force to execute');
7778
$output->writeln('<error>All data will be lost!</error>');

src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntitiesDoctrineCommand.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
6565
}
6666

6767
if (strpos($metadata->name, $foundBundle->getNamespace()) === false) {
68-
throw new \RuntimeException(
69-
"Entity " . $metadata->name . " and bundle don't have a common namespace, ".
70-
"generation failed because the target directory cannot be detected.");
68+
throw new \RuntimeException(sprintf('Entity "%s" and bundle don\'t have a common namespace, generation failed because the target directory cannot be detected.', $metadata->name));
7169
}
7270

7371
$output->writeln(sprintf(' > generating <comment>%s</comment>', $metadata->name));
7472
$entityGenerator->generate(array($metadata), $this->findBasePathForBundle($foundBundle));
7573
}
7674
} else {
77-
throw new \RuntimeException("Bundle " . $bundleName . " does not contain any mapped entities.");
75+
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundleName));
7876
}
7977
}
80-
}
78+
}

src/Symfony/Bundle/DoctrineBundle/Command/GenerateRepositoriesDoctrineCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5959

6060
if ($metadata->customRepositoryClassName) {
6161
if (strpos($metadata->customRepositoryClassName, $foundBundle->getNamespace()) === false) {
62-
throw new \RuntimeException(
63-
"Repository " . $metadata->customRepositoryClassName . " and bundle don't have a common namespace, ".
64-
"generation failed because the target directory cannot be detected.");
62+
throw new \RuntimeException(sprintf('Repository "%s" and bundle don\'t have a common namespace, generation failed because the target directory cannot be detected.', $metadata->customRepositoryClassName));
6563
}
6664

6765
$output->writeln(sprintf(' > <info>OK</info> generating <comment>%s</comment>', $metadata->customRepositoryClassName));
@@ -71,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7169
}
7270
}
7371
} else {
74-
throw new \RuntimeException("Bundle " . $bundleName . " does not contain any mapped entities.");
72+
throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundleName));
7573
}
7674
}
7775
}

src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
103103
file_put_contents($path, $code);
104104
}
105105
} else {
106-
$output->writeln('Database does not have any mapping information.'.PHP_EOL, 'ERROR');
106+
$output->writeln('Database does not have any mapping information.', 'ERROR');
107+
$output->writeln('', 'ERROR');
107108
}
108109
}
109110
}

src/Symfony/Bundle/DoctrineBundle/Command/InfoDoctrineCommand.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
6464
);
6565
}
6666

67-
$output->write(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:\n",
68-
count($entityClassNames), $entityManagerName), true);
67+
$output->writeln(sprintf("Found <info>%d</info> entities mapped in entity manager <info>%s</info>:", count($entityClassNames), $entityManagerName));
6968

7069
foreach ($entityClassNames as $entityClassName) {
7170
try {
7271
$cm = $entityManager->getClassMetadata($entityClassName);
73-
$output->write("<info>[OK]</info> " . $entityClassName, true);
72+
$output->writeln(sprintf("<info>[OK]</info> %s", $entityClassName));
7473
} catch (MappingException $e) {
75-
$output->write("<error>[FAIL]</error> " . $entityClassName, true);
76-
$output->write("<comment>" . $e->getMessage()."</comment>", true);
77-
$output->write("", true);
74+
$output->writeln("<error>[FAIL]</error> ".$entityClassName);
75+
$output->writeln(sprintf("<comment>%s</comment>", $e->getMessage()));
76+
$output->writeln('');
7877
}
7978
}
8079
}

src/Symfony/Bundle/DoctrineBundle/Tests/Command/InfoDoctrineCommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public function testAnnotationsBundle()
1616
$input = new StringInput("doctrine:mapping:info");
1717
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
1818
$output->expects($this->at(0))
19-
->method('write')
20-
->with($this->equalTo("Found <info>1</info> entities mapped in entity manager <info>default</info>:\n"), $this->equalTo(true));
19+
->method('writeln')
20+
->with($this->equalTo("Found <info>1</info> entities mapped in entity manager <info>default</info>:"));
2121
$output->expects($this->at(1))
22-
->method('write')
23-
->with($this->equalTo("<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test"), $this->equalTo(true));
22+
->method('writeln')
23+
->with($this->equalTo("<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test"));
2424

2525
$testContainer = $this->createYamlBundleTestContainer();
2626
$kernel = $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false);
@@ -36,4 +36,4 @@ public function testAnnotationsBundle()
3636
$cmd->setApplication($application);
3737
$cmd->run($input, $output);
3838
}
39-
}
39+
}

0 commit comments

Comments
 (0)
0