@@ -120,6 +120,6 @@ |
||
| 120 | 120 | { |
| 121 | 121 | $rootDir = realpath($this->kernel->getRootDir() . '/..') . '/'; |
| 122 | 122 | // note: we handle the case of 'path = root dir', but path is expected to include a filename... |
| 123 | - return $path === $rootDir ? './' : preg_replace('#^' . preg_quote($rootDir, '#'). '#', '', $path); |
|
| 123 | + return $path === $rootDir ? './' : preg_replace('#^' . preg_quote($rootDir, '#') . '#', '', $path); |
|
| 124 | 124 | } |
| 125 | 125 | } |
@@ -45,12 +45,12 @@ |
||
| 45 | 45 | return array( |
| 46 | 46 | new ExpressionFunction( |
| 47 | 47 | 'resolve', |
| 48 | - function ($str) { |
|
| 48 | + function($str) { |
|
| 49 | 49 | /// @todo we could implement this via eg a static class var which holds a pointer to $this->referenceResolver |
| 50 | 50 | //return sprintf('(is_string(%1$s) ? FakerResolver::resolveExpressionLanguageReference(%1$s) : %1$s)', $str); |
| 51 | 51 | return "throw new MigrationBundleException('The \'resolve\' expression language operator can not be compiled, only evaluated'"; |
| 52 | 52 | }, |
| 53 | - function ($arguments, $str) use ($resolver) { |
|
| 53 | + function($arguments, $str) use ($resolver) { |
|
| 54 | 54 | if (!is_string($str)) { |
| 55 | 55 | return $str; |
| 56 | 56 | } |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | $refs = array(); |
| 133 | 133 | |
| 134 | 134 | foreach ($this->resolvers as $resolver) { |
| 135 | - if (! $resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 135 | + if (!$resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 136 | 136 | // Disabled - we now allow chaining enumerable and non-enumerable sets |
| 137 | 137 | //throw new MigrationBundleException("Could not enumerate references because of chained resolver of type: " . get_class($resolver)); |
| 138 | 138 | continue; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | throw new MigrationBundleException("Invalid step definition: file '$fileName' for saving references already exists"); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! $this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 166 | + if (!$this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 167 | 167 | throw new MigrationBundleException("Can not save references as resolver is not enumerable"); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $value = $this->dumpVar($this->referenceResolver->resolveReference($dsl['identifier'])); |
| 209 | 209 | |
| 210 | 210 | if (isset($context['output']) && $context['output'] instanceof OutputInterface) { |
| 211 | - $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_NORMAL); |
|
| 211 | + $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL); |
|
| 212 | 212 | } else { |
| 213 | 213 | echo $label . $value; |
| 214 | 214 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $dumper->dump( |
| 232 | 232 | $cloner->cloneVar($var), |
| 233 | - function ($line, $depth) use (&$output) { |
|
| 233 | + function($line, $depth) use (&$output) { |
|
| 234 | 234 | // A negative depth means "end of dump" |
| 235 | 235 | if ($depth >= 0) { |
| 236 | 236 | // Adds a two spaces indentation to the line |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - } |
|
| 65 | - else { |
|
| 64 | + } else { |
|
| 66 | 65 | throw new MigrationBundleException("Path '$path' is neither a file nor directory"); |
| 67 | 66 | } |
| 68 | 67 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
| 13 | 13 | { |
| 14 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 14 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 15 | 15 | throw new MigrationBundleException("Reference resolver injected into EzRichText field handler should implement EmbeddedReferenceResolverInterface"); |
| 16 | 16 | } |
| 17 | 17 | parent::setReferenceResolver($referenceResolver); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
| 14 | 14 | { |
| 15 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 15 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
| 16 | 16 | throw new MigrationBundleException("Reference resolver injected into EzXmlText field handler should implement EmbeddedReferenceResolverInterface"); |
| 17 | 17 | } |
| 18 | 18 | parent::setReferenceResolver($referenceResolver); |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $missed = $total - $this->migrationsDone[Migration::STATUS_DONE] - $this->migrationsDone[Migration::STATUS_FAILED] - $this->migrationsDone[Migration::STATUS_SKIPPED]; |
| 183 | - $this->writeln("\nExecuted ".$this->migrationsDone[Migration::STATUS_DONE].' migrations'. |
|
| 184 | - ', failed '.$this->migrationsDone[Migration::STATUS_FAILED]. |
|
| 185 | - ', skipped '.$this->migrationsDone[Migration::STATUS_SKIPPED]. |
|
| 183 | + $this->writeln("\nExecuted " . $this->migrationsDone[Migration::STATUS_DONE] . ' migrations' . |
|
| 184 | + ', failed ' . $this->migrationsDone[Migration::STATUS_FAILED] . |
|
| 185 | + ', skipped ' . $this->migrationsDone[Migration::STATUS_SKIPPED] . |
|
| 186 | 186 | ($missed ? ", missed $missed" : '')); |
| 187 | 187 | |
| 188 | 188 | $time = microtime(true) - $start; |
| 189 | 189 | // since we use subprocesses, we can not measure max memory used |
| 190 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>"); |
|
| 190 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
| 191 | 191 | |
| 192 | 192 | return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed; |
| 193 | 193 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | foreach ($toExecute as $name => $migrationDefinition) { |
| 242 | 242 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
| 243 | 243 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 244 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::$VERBOSITY_CHILD); |
|
| 244 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::$VERBOSITY_CHILD); |
|
| 245 | 245 | $skipped++; |
| 246 | 246 | continue; |
| 247 | 247 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param string $buffer |
| 315 | 315 | * @param null|\Symfony\Component\Process\Process $process |
| 316 | 316 | */ |
| 317 | - public function onChildProcessOutput($type, $buffer, $process=null) |
|
| 317 | + public function onChildProcessOutput($type, $buffer, $process = null) |
|
| 318 | 318 | { |
| 319 | 319 | $lines = explode("\n", trim($buffer)); |
| 320 | 320 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | // we tag the output with the id of the child process |
| 334 | 334 | if (trim($line) !== '') { |
| 335 | - $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
| 335 | + $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
| 336 | 336 | if ($type == 'err') { |
| 337 | 337 | $this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
| 338 | 338 | } else { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | { |
| 409 | 409 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
| 410 | 410 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
| 411 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 411 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 412 | 412 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
| 413 | 413 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
| 414 | 414 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | |
| 132 | 132 | $time = microtime(true) - $start; |
| 133 | 133 | $output->writeln("Resumed $executed migrations, failed $failed"); |
| 134 | - $output->writeln("Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
| 134 | + $output->writeln("Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
| 135 | 135 | |
| 136 | 136 | if ($failed) { |
| 137 | 137 | return 2; |