diff --git a/bundles/CoreBundle/Command/InternalMigrationHelpersCommand.php b/bundles/CoreBundle/Command/InternalMigrationHelpersCommand.php index ba87552d0d3..68edb4139e1 100644 --- a/bundles/CoreBundle/Command/InternalMigrationHelpersCommand.php +++ b/bundles/CoreBundle/Command/InternalMigrationHelpersCommand.php @@ -40,7 +40,7 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - if($input->getOption('is-installed')) { + if ($input->getOption('is-installed')) { try { $output->write((string) \Pimcore::isInstalled()); } catch (\Throwable $e) { diff --git a/bundles/CoreBundle/EventListener/Frontend/FullPageCacheListener.php b/bundles/CoreBundle/EventListener/Frontend/FullPageCacheListener.php index 753db65f415..0ec6a9183a3 100644 --- a/bundles/CoreBundle/EventListener/Frontend/FullPageCacheListener.php +++ b/bundles/CoreBundle/EventListener/Frontend/FullPageCacheListener.php @@ -168,7 +168,7 @@ public function enableExpireHeader() */ public function onKernelRequest(RequestEvent $event) { - if(!$this->isEnabled()) { + if (!$this->isEnabled()) { return; } diff --git a/bundles/CoreBundle/Migrations/Version20201008082752.php b/bundles/CoreBundle/Migrations/Version20201008082752.php index 8ace11fffe6..afacc2c0e30 100644 --- a/bundles/CoreBundle/Migrations/Version20201008082752.php +++ b/bundles/CoreBundle/Migrations/Version20201008082752.php @@ -12,7 +12,7 @@ class Version20201008082752 extends AbstractMigration */ public function up(Schema $schema): void { - if($schema->hasTable('tracking_events')) { + if ($schema->hasTable('tracking_events')) { $this->addSql('RENAME TABLE tracking_events TO PLEASE_DELETE__tracking_events;'); } } diff --git a/bundles/CoreBundle/Migrations/Version20201008101817.php b/bundles/CoreBundle/Migrations/Version20201008101817.php index 2b83a25a4d2..37eacfabcfb 100644 --- a/bundles/CoreBundle/Migrations/Version20201008101817.php +++ b/bundles/CoreBundle/Migrations/Version20201008101817.php @@ -12,7 +12,7 @@ class Version20201008101817 extends AbstractMigration */ public function up(Schema $schema): void { - if($schema->hasTable('documents_elements')) { + if ($schema->hasTable('documents_elements')) { $this->addSql('RENAME TABLE documents_elements TO documents_editables;'); } } diff --git a/bundles/CoreBundle/Migrations/Version20201008132324.php b/bundles/CoreBundle/Migrations/Version20201008132324.php index f2ccea1c6dc..6d329dd7576 100644 --- a/bundles/CoreBundle/Migrations/Version20201008132324.php +++ b/bundles/CoreBundle/Migrations/Version20201008132324.php @@ -12,7 +12,7 @@ class Version20201008132324 extends AbstractMigration */ public function up(Schema $schema): void { - if($schema->hasTable('locks')) { + if ($schema->hasTable('locks')) { $this->addSql('RENAME TABLE locks TO PLEASE_DELETE__locks;'); } } diff --git a/bundles/CoreBundle/Migrations/Version20201009095924.php b/bundles/CoreBundle/Migrations/Version20201009095924.php index b8fdec75c72..2a131054a18 100644 --- a/bundles/CoreBundle/Migrations/Version20201009095924.php +++ b/bundles/CoreBundle/Migrations/Version20201009095924.php @@ -12,7 +12,7 @@ class Version20201009095924 extends AbstractMigration */ public function up(Schema $schema): void { - if($schema->getTable('users')->hasColumn('apiKey')) { + if ($schema->getTable('users')->hasColumn('apiKey')) { $this->addSql('ALTER TABLE `users` DROP COLUMN `apiKey`;'); } } diff --git a/bundles/CoreBundle/Migrations/Version20201012154224.php b/bundles/CoreBundle/Migrations/Version20201012154224.php index 5a569381630..cb4d1bcaf2c 100644 --- a/bundles/CoreBundle/Migrations/Version20201012154224.php +++ b/bundles/CoreBundle/Migrations/Version20201012154224.php @@ -12,7 +12,7 @@ class Version20201012154224 extends AbstractMigration */ public function up(Schema $schema): void { - if($schema->getTable('glossary')->hasColumn('acronym')) { + if ($schema->getTable('glossary')->hasColumn('acronym')) { $this->addSql('ALTER TABLE glossary DROP COLUMN acronym'); } } diff --git a/bundles/CoreBundle/Migrations/Version20201113143914.php b/bundles/CoreBundle/Migrations/Version20201113143914.php index 1d2da35307a..742d7d2c83d 100644 --- a/bundles/CoreBundle/Migrations/Version20201113143914.php +++ b/bundles/CoreBundle/Migrations/Version20201113143914.php @@ -16,11 +16,11 @@ class Version20201113143914 extends AbstractMigration public function up(Schema $schema): void { foreach ($this->tables as $table) { - if($schema->getTable($table)->hasColumn('action')) { + if ($schema->getTable($table)->hasColumn('action')) { $this->addSql(sprintf('ALTER TABLE `%s` DROP COLUMN `action`;', $table)); } - if($schema->getTable($table)->hasColumn('module')) { + if ($schema->getTable($table)->hasColumn('module')) { $this->addSql(sprintf('ALTER TABLE `%s` DROP COLUMN `module`;', $table)); } } diff --git a/bundles/EcommerceFrameworkBundle/Tools/Installer.php b/bundles/EcommerceFrameworkBundle/Tools/Installer.php index 0ecf97d90c5..8ba0b3a1f97 100644 --- a/bundles/EcommerceFrameworkBundle/Tools/Installer.php +++ b/bundles/EcommerceFrameworkBundle/Tools/Installer.php @@ -155,12 +155,11 @@ class Installer extends AbstractInstaller public function __construct( BundleInterface $bundle, ConnectionInterface $connection - ) - { + ) { $this->installSourcesPath = __DIR__ . '/../Resources/install'; $this->bundle = $bundle; $this->db = $connection; - if($this->db instanceof Connection) { + if ($this->db instanceof Connection) { $this->schema = $this->db->getSchemaManager()->createSchema(); } @@ -192,7 +191,7 @@ public function isInstalled() try { // check if if first permission is installed $installed = $this->db->fetchOne('SELECT `key` FROM users_permission_definitions WHERE `key` = :key', [ - 'key' => $this->permissionsToInstall[0] + 'key' => $this->permissionsToInstall[0], ]); } catch (\Exception $e) { // nothing to do @@ -388,7 +387,6 @@ private function installTables() continue; } - $this->db->executeQuery($statement); } } diff --git a/lib/Console/Application.php b/lib/Console/Application.php index d3e41a2260a..7a694cc9e77 100644 --- a/lib/Console/Application.php +++ b/lib/Console/Application.php @@ -75,7 +75,7 @@ public function __construct(KernelInterface $kernel) Admin::activateMaintenanceMode($maintenanceModeId); } - if($event->getCommand() instanceof DoctrineCommand && $prefix = $event->getInput()->getOption('prefix')) { + if ($event->getCommand() instanceof DoctrineCommand && $prefix = $event->getInput()->getOption('prefix')) { $kernel->getContainer()->get(FilteredMigrationsRepository::class)->setPrefix($prefix); $kernel->getContainer()->get(FilteredTableMetadataStorage::class)->setPrefix($prefix); } @@ -107,7 +107,7 @@ public function add(Command $command) { $definition = $command->getDefinition(); - if($command instanceof DoctrineCommand) { + if ($command instanceof DoctrineCommand) { // add filter option $definition->addOption(new InputOption( 'prefix', diff --git a/lib/Extension/Bundle/Installer/AbstractInstaller.php b/lib/Extension/Bundle/Installer/AbstractInstaller.php index 58495a5a0fa..121bada8170 100644 --- a/lib/Extension/Bundle/Installer/AbstractInstaller.php +++ b/lib/Extension/Bundle/Installer/AbstractInstaller.php @@ -25,9 +25,6 @@ class AbstractInstaller implements InstallerInterface */ protected $output; - /** - * - */ public function __construct() { $this->output = new BufferedOutput(Output::VERBOSITY_NORMAL, true); diff --git a/lib/Migrations/FilteredMigrationsRepository.php b/lib/Migrations/FilteredMigrationsRepository.php index 02e14013a1f..4f625e881b3 100644 --- a/lib/Migrations/FilteredMigrationsRepository.php +++ b/lib/Migrations/FilteredMigrationsRepository.php @@ -7,7 +7,6 @@ use Doctrine\Migrations\Metadata\AvailableMigration; use Doctrine\Migrations\Metadata\AvailableMigrationsSet; use Doctrine\Migrations\Version\Version; -use phpDocumentor\Reflection\Types\Self_; class FilteredMigrationsRepository implements \Doctrine\Migrations\MigrationsRepository { @@ -31,10 +30,12 @@ public function __invoke(DependencyFactory $dependencyFactory) ); $this->setFileSystemRepo($filesystemRepo); + return $this; } - private function setFileSystemRepo(FilesystemMigrationsRepository $repository) { + private function setFileSystemRepo(FilesystemMigrationsRepository $repository) + { $this->filesystemRepo = $repository; } @@ -43,27 +44,27 @@ public function setPrefix(?string $prefix): void $this->prefix = $prefix; } - public function hasMigration(string $version) : bool + public function hasMigration(string $version): bool { return $this->filesystemRepo->hasMigration($version); } - public function getMigration(Version $version) : AvailableMigration + public function getMigration(Version $version): AvailableMigration { return $this->filesystemRepo->getMigration($version); } - public function getMigrations() : AvailableMigrationsSet + public function getMigrations(): AvailableMigrationsSet { $migrations = $this->filesystemRepo->getMigrations(); - if(!$this->prefix) { + if (!$this->prefix) { return $migrations; } $filteredMigrations = []; $items = $migrations->getItems(); - foreach($items as $migration) { - if(strpos(get_class($migration->getMigration()), $this->prefix) === 0) { + foreach ($items as $migration) { + if (strpos(get_class($migration->getMigration()), $this->prefix) === 0) { $filteredMigrations[] = $migration; } } diff --git a/lib/Migrations/FilteredTableMetadataStorage.php b/lib/Migrations/FilteredTableMetadataStorage.php index 26028d95779..1a30c04ae3a 100644 --- a/lib/Migrations/FilteredTableMetadataStorage.php +++ b/lib/Migrations/FilteredTableMetadataStorage.php @@ -30,6 +30,7 @@ public function __invoke(DependencyFactory $dependencyFactory) ); $this->setStorage($storage); + return $this; } @@ -46,22 +47,22 @@ public function setPrefix(?string $prefix): void $this->prefix = $prefix; } - public function ensureInitialized() : void + public function ensureInitialized(): void { - $this->storage->ensureInitialized();; + $this->storage->ensureInitialized(); } - public function getExecutedMigrations() : ExecutedMigrationsList + public function getExecutedMigrations(): ExecutedMigrationsList { $migrations = $this->storage->getExecutedMigrations(); - if(!$this->prefix) { + if (!$this->prefix) { return $migrations; } $filteredMigrations = []; $items = $migrations->getItems(); - foreach($items as $migration) { - if(strpos($migration->getVersion(), $this->prefix) === 0) { + foreach ($items as $migration) { + if (strpos($migration->getVersion(), $this->prefix) === 0) { $filteredMigrations[] = $migration; } } @@ -69,12 +70,12 @@ public function getExecutedMigrations() : ExecutedMigrationsList return new ExecutedMigrationsList($filteredMigrations); } - public function complete(ExecutionResult $migration) : void + public function complete(ExecutionResult $migration): void { $this->storage->complete($migration); } - public function reset() : void + public function reset(): void { $this->storage->reset(); } diff --git a/lib/Pimcore.php b/lib/Pimcore.php index 24337b9c5d6..fc4613878d6 100644 --- a/lib/Pimcore.php +++ b/lib/Pimcore.php @@ -153,6 +153,7 @@ public static function isInstalled() { try { \Pimcore\Db::get()->fetchOne('SELECT VERSION()'); + return true; } catch (\Exception $e) { return false; diff --git a/tests/_support/Helper/DataType/TestDataHelper.php b/tests/_support/Helper/DataType/TestDataHelper.php index 8a494475660..82b0b4f04ea 100644 --- a/tests/_support/Helper/DataType/TestDataHelper.php +++ b/tests/_support/Helper/DataType/TestDataHelper.php @@ -1188,8 +1188,8 @@ public function assertObjectsWithMetadata(Concrete $object, $field, Concrete $co protected function assertObjectMetadataEqual($expected, $value) { // see https://github.com/sebastianbergmann/phpunit/commit/50ad7e1c4e74dce3beff17bf9c9f5a458cbe9958 - $this->assertTrue(is_array($expected), "expected an array"); - $this->assertTrue(is_array($value), "expected an array"); + $this->assertTrue(is_array($expected), 'expected an array'); + $this->assertTrue(is_array($value), 'expected an array'); $this->assertCount(count($expected), $value);