Skip to content

Commit 5b6844f

Browse files
committed
Add spacing around string concat operator
1 parent 2dae57b commit 5b6844f

File tree

13 files changed

+40
-39
lines changed

13 files changed

+40
-39
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $config = PhpCsFixer\Config::create()
99
'@PSR2' => true,
1010
'@Symfony' => true,
1111
'array_syntax' => ['syntax' => 'short'],
12+
'concat_space' => ['spacing' => 'one'],
1213
])
1314
->setFinder($finder)
1415
;

src/AntiMattr/MongoDB/Migrations/AbstractMigration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function warnIf($condition, $message = '')
118118
$message = (strlen($message)) ? $message : 'Unknown Reason';
119119

120120
if (true === $condition) {
121-
$this->outputWriter->write(' <warning>Warning during '.$this->version->getExecutionState().': '.$message.'</warning>');
121+
$this->outputWriter->write(' <warning>Warning during ' . $this->version->getExecutionState() . ': ' . $message . '</warning>');
122122
}
123123
}
124124

src/AntiMattr/MongoDB/Migrations/Configuration/AbstractFileConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function load($file)
4444
if ($this->loaded) {
4545
throw new ConfigurationFileAlreadyLoadedException('Migrations configuration file already loaded');
4646
}
47-
if (file_exists($path = getcwd().'/'.$file)) {
47+
if (file_exists($path = getcwd() . '/' . $file)) {
4848
$file = $path;
4949
}
5050
$this->file = $file;
@@ -54,7 +54,7 @@ public function load($file)
5454

5555
protected function getDirectoryRelativeToFile($file, $input)
5656
{
57-
$path = realpath(dirname($file).'/'.$input);
57+
$path = realpath(dirname($file) . '/' . $input);
5858
if (false !== $path) {
5959
$directory = $path;
6060
} else {

src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ public function registerMigrationsFromDirectory($path)
443443
{
444444
$path = realpath($path);
445445
$path = rtrim($path, '/');
446-
$files = glob($path.'/Version*.php');
446+
$files = glob($path . '/Version*.php');
447447
$versions = [];
448448
if ($files) {
449449
foreach ($files as $file) {
450450
require_once $file;
451451
$info = pathinfo($file);
452452
$version = substr($info['filename'], 7);
453-
$class = $this->migrationsNamespace.'\\'.$info['filename'];
453+
$class = $this->migrationsNamespace . '\\' . $info['filename'];
454454
$versions[] = $this->registerMigration($version, $class);
455455
}
456456
}

src/AntiMattr/MongoDB/Migrations/Tools/Console/Command/AbstractCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ protected function outputHeader(Configuration $configuration, OutputInterface $o
5050
{
5151
$name = $configuration->getName();
5252
$name = $name ? $name : 'AntiMattr Database Migrations';
53-
$name = str_repeat(' ', 20).$name.str_repeat(' ', 20);
54-
$output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>');
55-
$output->writeln('<question>'.$name.'</question>');
56-
$output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>');
53+
$name = str_repeat(' ', 20) . $name . str_repeat(' ', 20);
54+
$output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
55+
$output->writeln('<question>' . $name . '</question>');
56+
$output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
5757
$output->writeln('');
5858
}
5959

@@ -120,15 +120,15 @@ protected function createConnection($params)
120120
{
121121
$credentials = '';
122122
if (isset($params['password'])) {
123-
$credentials = ':'.$params['password'];
123+
$credentials = ':' . $params['password'];
124124
}
125125
if (isset($params['user'])) {
126-
$credentials = $params['user'].$credentials.'@';
126+
$credentials = $params['user'] . $credentials . '@';
127127
}
128128

129129
$database = '';
130130
if (isset($params['dbname'])) {
131-
$database = '/'.$params['dbname'];
131+
$database = '/' . $params['dbname'];
132132
}
133133

134134
$server = sprintf(

src/AntiMattr/MongoDB/Migrations/Tools/Console/Command/GenerateCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ protected function generateMigration(Configuration $configuration, InputInterfac
114114
$replacements = [
115115
$configuration->getMigrationsNamespace(),
116116
$version,
117-
$up ? ' '.implode("\n ", explode("\n", $up)) : null,
118-
$down ? ' '.implode("\n ", explode("\n", $down)) : null,
117+
$up ? ' ' . implode("\n ", explode("\n", $up)) : null,
118+
$down ? ' ' . implode("\n ", explode("\n", $down)) : null,
119119
];
120120
$code = str_replace($placeHolders, $replacements, self::$_template);
121121

src/AntiMattr/MongoDB/Migrations/Tools/Console/Command/StatusCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ public function execute(InputInterface $input, OutputInterface $output)
100100
'Current Version' => $currentVersionFormatted,
101101
'Latest Version' => $latestVersionFormatted,
102102
'Executed Migrations' => $configMap['num_executed_migrations'],
103-
'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations > 0 ? '<error>'.$numExecutedUnavailableMigrations.'</error>' : 0,
103+
'Executed Unavailable Migrations' => $numExecutedUnavailableMigrations > 0 ? '<error>' . $numExecutedUnavailableMigrations . '</error>' : 0,
104104
'Available Migrations' => $configMap['num_available_migrations'],
105-
'New Migrations' => $numNewMigrations > 0 ? '<question>'.$numNewMigrations.'</question>' : 0,
105+
'New Migrations' => $numNewMigrations > 0 ? '<question>' . $numNewMigrations . '</question>' : 0,
106106
];
107107

108108
foreach ($info as $name => $value) {
@@ -133,7 +133,7 @@ public function execute(InputInterface $input, OutputInterface $output)
133133
$versionTxt = sprintf('<comment>%s</comment>', $version->getVersion());
134134
$desc = $version->getMigration()->getDescription();
135135
if (strlen($desc) > 80) {
136-
$desc = substr($desc, 0, 78).'...';
136+
$desc = substr($desc, 0, 78) . '...';
137137
}
138138

139139
$rows[] = [$versionTxt, $status, $desc];

src/AntiMattr/MongoDB/Migrations/Version.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ public function execute($direction, $replay = false)
187187

188188
$this->state = self::STATE_PRE;
189189

190-
$this->migration->{'pre'.ucfirst($direction)}($this->db);
190+
$this->migration->{'pre' . ucfirst($direction)}($this->db);
191191

192192
if ('up' === $direction) {
193-
$this->outputWriter->write("\n".sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version)."\n");
193+
$this->outputWriter->write("\n" . sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n");
194194
} else {
195-
$this->outputWriter->write("\n".sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version)."\n");
195+
$this->outputWriter->write("\n" . sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n");
196196
}
197197

198198
$this->state = self::STATE_EXEC;
@@ -210,7 +210,7 @@ public function execute($direction, $replay = false)
210210
$this->summarizeStatistics();
211211

212212
$this->state = self::STATE_POST;
213-
$this->migration->{'post'.ucfirst($direction)}($this->db);
213+
$this->migration->{'post' . ucfirst($direction)}($this->db);
214214

215215
$end = microtime(true);
216216
$this->time = round($end - $start, 2);
@@ -260,7 +260,7 @@ public function executeScript(Database $db, $file)
260260
throw new \RuntimeException('Missing Configuration for migrations script directory');
261261
}
262262

263-
$path = realpath($scripts.'/'.$file);
263+
$path = realpath($scripts . '/' . $file);
264264
if (!file_exists($path)) {
265265
throw new \InvalidArgumentException(sprintf('Could not execute %s. File does not exist.', $path));
266266
}
@@ -337,12 +337,12 @@ private function summarizeStatistics()
337337
$this->outputWriter->write(sprintf("\n Collection %s\n", $key));
338338

339339
$line = ' ';
340-
$line .= 'metric '.str_repeat(' ', 16 - strlen('metric'));
341-
$line .= 'before '.str_repeat(' ', 20 - strlen('before'));
342-
$line .= 'after '.str_repeat(' ', 20 - strlen('after'));
343-
$line .= 'difference '.str_repeat(' ', 20 - strlen('difference'));
340+
$line .= 'metric ' . str_repeat(' ', 16 - strlen('metric'));
341+
$line .= 'before ' . str_repeat(' ', 20 - strlen('before'));
342+
$line .= 'after ' . str_repeat(' ', 20 - strlen('after'));
343+
$line .= 'difference ' . str_repeat(' ', 20 - strlen('difference'));
344344

345-
$this->outputWriter->write($line."\n ".str_repeat('=', 80));
345+
$this->outputWriter->write($line . "\n " . str_repeat('=', 80));
346346
$before = $statistic->getBefore();
347347
$after = $statistic->getAfter();
348348

@@ -351,10 +351,10 @@ private function summarizeStatistics()
351351
$valueAfter = isset($after[$metric]) ? $after[$metric] : 0;
352352
$difference = $valueAfter - $valueBefore;
353353

354-
$nameMessage = $metric.str_repeat(' ', 16 - strlen($metric));
355-
$beforeMessage = $valueBefore.str_repeat(' ', 20 - strlen($valueBefore));
356-
$afterMessage = $valueAfter.str_repeat(' ', 20 - strlen($valueAfter));
357-
$differenceMessage = $difference.str_repeat(' ', 20 - strlen($difference));
354+
$nameMessage = $metric . str_repeat(' ', 16 - strlen($metric));
355+
$beforeMessage = $valueBefore . str_repeat(' ', 20 - strlen($valueBefore));
356+
$afterMessage = $valueAfter . str_repeat(' ', 20 - strlen($valueAfter));
357+
$differenceMessage = $difference . str_repeat(' ', 20 - strlen($difference));
358358

359359
$line = sprintf(
360360
' %s %s %s %s',

tests/AntiMattr/Tests/MongoDB/Migrations/Configuration/ConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testGetCurrentVersion()
4949
{
5050
$this->prepareValidConfiguration();
5151

52-
$directory = dirname(__DIR__).'/Resources/Migrations/';
52+
$directory = dirname(__DIR__) . '/Resources/Migrations/';
5353
$this->configuration->registerMigrationsFromDirectory($directory);
5454

5555
$collection = $this->buildMock('Doctrine\MongoDB\Collection');
@@ -178,7 +178,7 @@ public function testRegisterMigrationsFromDirectory()
178178
$this->configuration->setMigrationsNamespace('Example\Migrations\TestAntiMattr\MongoDB');
179179
$this->assertFalse($this->configuration->hasVersion('20140822185742'));
180180

181-
$directory = dirname(__DIR__).'/Resources/Migrations/';
181+
$directory = dirname(__DIR__) . '/Resources/Migrations/';
182182
$this->configuration->registerMigrationsFromDirectory($directory);
183183

184184
$this->assertEquals(3, count($this->configuration->getMigrations()));
@@ -274,7 +274,7 @@ public function testValidate()
274274

275275
private function prepareValidConfiguration()
276276
{
277-
$directory = dirname(__DIR__).'/Resources/Migrations/';
277+
$directory = dirname(__DIR__) . '/Resources/Migrations/';
278278
$this->configuration->setMigrationsDatabaseName('test_antimattr_migrations');
279279
$this->configuration->setMigrationsDirectory($directory);
280280
$this->configuration->setMigrationsNamespace('Example\Migrations\TestAntiMattr\MongoDB');

tests/AntiMattr/Tests/MongoDB/Migrations/Configuration/XmlConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function loadConfiguration()
1010
{
1111
$connection = $this->getConnection();
1212
$config = new XmlConfiguration($connection);
13-
$config->load(dirname(__DIR__).'/Resources/fixtures/config.xml');
13+
$config->load(dirname(__DIR__) . '/Resources/fixtures/config.xml');
1414

1515
return $config;
1616
}

0 commit comments

Comments
 (0)