@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | if (array_key_exists('policies', $this->dsl)) { |
| 44 | 44 | $ymlPolicies = $this->dsl['policies']; |
| 45 | - foreach($ymlPolicies as $key => $ymlPolicy) { |
|
| 45 | + foreach ($ymlPolicies as $key => $ymlPolicy) { |
|
| 46 | 46 | $this->addPolicy($role, $roleService, $ymlPolicy); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | // Removing all policies so we can add them back. |
| 83 | 83 | // TODO: Check and update policies instead of remove and add. |
| 84 | 84 | $policies = $role->getPolicies(); |
| 85 | - foreach($policies as $policy) { |
|
| 85 | + foreach ($policies as $policy) { |
|
| 86 | 86 | $roleService->deletePolicy($policy); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - foreach($ymlPolicies as $key => $ymlPolicy) { |
|
| 89 | + foreach ($ymlPolicies as $key => $ymlPolicy) { |
|
| 90 | 90 | $this->addPolicy($role, $roleService, $ymlPolicy); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']); |
| 177 | 177 | |
| 178 | - foreach($limitationValue as $id => $value) { |
|
| 178 | + foreach ($limitationValue as $id => $value) { |
|
| 179 | 179 | if ($this->referenceResolver->isReference($value)) { |
| 180 | 180 | $value = $this->referenceResolver->getReferenceValue($value); |
| 181 | 181 | $limitationValue[$id] = $value; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $activeBundles = array(); |
| 83 | - foreach($this->getApplication()->getKernel()->getBundles() as $bundle) |
|
| 83 | + foreach ($this->getApplication()->getKernel()->getBundles() as $bundle) |
|
| 84 | 84 | { |
| 85 | 85 | $activeBundles[] = $bundle->getName(); |
| 86 | 86 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $className = 'Migration'; |
| 156 | 156 | } |
| 157 | 157 | // Make sure that php class names are unique, not only migration definition file names |
| 158 | - $existingMigrations = count(glob($migrationDirectory.'/*_' . $className .'*.php')); |
|
| 158 | + $existingMigrations = count(glob($migrationDirectory . '/*_' . $className . '*.php')); |
|
| 159 | 159 | if ($existingMigrations) { |
| 160 | 160 | $className = $className . sprintf('%03d', $existingMigrations + 1); |
| 161 | 161 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if ($migrationType == 'role') { |
| 202 | 202 | $code = $this->generateRoleTemplate($parameters['role']); |
| 203 | 203 | } else { |
| 204 | - $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:'.$template, $parameters); |
|
| 204 | + $code = $this->getContainer()->get('twig')->render($this->thisBundle . ':MigrationTemplate:' . $template, $parameters); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | file_put_contents($path, $code); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | /** |
| 99 | 99 | * Creates and stores a new migration (leaving it in TODO status) |
| 100 | 100 | * @param MigrationDefinition $migrationDefinition |
| 101 | - * @return mixed |
|
| 101 | + * @return Migration |
|
| 102 | 102 | * @throws \Exception If the migration exists already (we rely on the PK for that) |
| 103 | 103 | */ |
| 104 | 104 | public function addMigration(MigrationDefinition $migrationDefinition) |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ); |
| 117 | 117 | try { |
| 118 | 118 | $conn->insert($this->migrationsTableName, $this->migrationToArray($migration)); |
| 119 | - } catch(UniqueConstraintViolationException $e) { |
|
| 119 | + } catch (UniqueConstraintViolationException $e) { |
|
| 120 | 120 | throw new \Exception("Migration '{$migrationDefinition->name}' already exists"); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $t->addColumn('execution_error', 'string', array('length' => 4000, 'notnull' => false)); |
| 312 | 312 | $t->setPrimaryKey(array('migration')); |
| 313 | 313 | |
| 314 | - foreach($schema->toSql($dbPlatform) as $sql) { |
|
| 314 | + foreach ($schema->toSql($dbPlatform) as $sql) { |
|
| 315 | 315 | $this->dbHandler->exec($sql); |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | { |
| 327 | 327 | /** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */ |
| 328 | 328 | $sm = $this->dbHandler->getConnection()->getSchemaManager(); |
| 329 | - foreach($sm->listTables() as $table) { |
|
| 329 | + foreach ($sm->listTables() as $table) { |
|
| 330 | 330 | if ($table->getName() == $tableName) { |
| 331 | 331 | return true; |
| 332 | 332 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function execute(InputInterface $input, OutputInterface $output) |
| 51 | 51 | { |
| 52 | - if (! $input->getOption('add') && ! $input->getOption('delete')) { |
|
| 52 | + if (!$input->getOption('add') && !$input->getOption('delete')) { |
|
| 53 | 53 | throw new \InvalidArgumentException('You must specify whether you want to --add or --delete the specified migration.'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | throw new \InvalidArgumentException(sprintf('The path "%s" does not correspond to any migration definition.', $migrationNameOrPath)); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - foreach($migrationDefinitionCollection as $migrationDefinition) { |
|
| 82 | + foreach ($migrationDefinitionCollection as $migrationDefinition) { |
|
| 83 | 83 | $migrationName = basename($migrationDefinition->path); |
| 84 | 84 | |
| 85 | 85 | $migration = $migrationService->getMigration($migrationNameOrPath); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // try to load autoloade both when extension is top-level project and when it is installed as part of a working eZPUblish |
| 4 | -if (!file_exists($file = __DIR__.'/../vendor/autoload.php') && !file_exists($file = __DIR__.'/../../../../vendor/autoload.php')) { |
|
| 4 | +if (!file_exists($file = __DIR__ . '/../vendor/autoload.php') && !file_exists($file = __DIR__ . '/../../../../vendor/autoload.php')) { |
|
| 5 | 5 | throw new \RuntimeException('Install the dependencies to run the test suite.'); |
| 6 | 6 | } |
| 7 | 7 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once(__DIR__.'/CommandTest.php'); |
|
| 3 | +include_once(__DIR__ . '/CommandTest.php'); |
|
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\Console\Input\ArrayInput; |
| 6 | 6 | |
@@ -64,6 +64,6 @@ discard block |
||
| 64 | 64 | $exitCode = $this->app->run($input, $this->output); |
| 65 | 65 | $output = $this->output->fetch(); |
| 66 | 66 | $this->assertSame(0, $exitCode); |
| 67 | - $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output ); |
|
| 67 | + $this->assertRegExp('?\| ' . basename($filePath) . ' +\| not executed \|?', $output); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function setUp() |
| 12 | 12 | { |
| 13 | - $this->connection = DriverManager::getConnection( array( 'driver' => 'pdo_sqlite', 'memory' => true ) ); |
|
| 13 | + $this->connection = DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'memory' => true)); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | protected function tearDown() |
| 30 | 30 | { |
| 31 | - foreach($this->leftovers as $file) { |
|
| 31 | + foreach ($this->leftovers as $file) { |
|
| 32 | 32 | unlink($file); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once(__DIR__.'/CommandTest.php'); |
|
| 3 | +include_once(__DIR__ . '/CommandTest.php'); |
|
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\Console\Input\ArrayInput; |
| 6 | 6 | |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function goodDSLProvider() |
| 83 | 83 | { |
| 84 | - $dslDir = $this->dslDir.'/good'; |
|
| 85 | - if(!is_dir($dslDir)) { |
|
| 84 | + $dslDir = $this->dslDir . '/good'; |
|
| 85 | + if (!is_dir($dslDir)) { |
|
| 86 | 86 | return array(); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $out = array(); |
| 90 | - foreach(scandir($dslDir) as $fileName) { |
|
| 90 | + foreach (scandir($dslDir) as $fileName) { |
|
| 91 | 91 | $filePath = $dslDir . '/' . $fileName; |
| 92 | 92 | if (is_file($filePath)) { |
| 93 | 93 | $out[] = array($filePath); |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function badDSLProvider() |
| 100 | 100 | { |
| 101 | - $dslDir = $this->dslDir.'/bad'; |
|
| 102 | - if(!is_dir($dslDir)) { |
|
| 101 | + $dslDir = $this->dslDir . '/bad'; |
|
| 102 | + if (!is_dir($dslDir)) { |
|
| 103 | 103 | return array(); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $out = array(); |
| 107 | - foreach(scandir($dslDir) as $fileName) { |
|
| 107 | + foreach (scandir($dslDir) as $fileName) { |
|
| 108 | 108 | $filePath = $dslDir . '/' . $fileName; |
| 109 | 109 | if (is_file($filePath)) { |
| 110 | 110 | $out[] = array($filePath); |