Skip to content

Commit

Permalink
Coding Standards Fixer Bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimcore Bot committed Nov 18, 2020
1 parent c0ca10f commit 0acbd02
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 37 deletions.
Expand Up @@ -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) {
Expand Down
Expand Up @@ -168,7 +168,7 @@ public function enableExpireHeader()
*/
public function onKernelRequest(RequestEvent $event)
{
if(!$this->isEnabled()) {
if (!$this->isEnabled()) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion bundles/CoreBundle/Migrations/Version20201008082752.php
Expand Up @@ -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;');
}
}
Expand Down
2 changes: 1 addition & 1 deletion bundles/CoreBundle/Migrations/Version20201008101817.php
Expand Up @@ -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;');
}
}
Expand Down
2 changes: 1 addition & 1 deletion bundles/CoreBundle/Migrations/Version20201008132324.php
Expand Up @@ -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;');
}
}
Expand Down
2 changes: 1 addition & 1 deletion bundles/CoreBundle/Migrations/Version20201009095924.php
Expand Up @@ -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`;');
}
}
Expand Down
2 changes: 1 addition & 1 deletion bundles/CoreBundle/Migrations/Version20201012154224.php
Expand Up @@ -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');
}
}
Expand Down
4 changes: 2 additions & 2 deletions bundles/CoreBundle/Migrations/Version20201113143914.php
Expand Up @@ -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));
}
}
Expand Down
8 changes: 3 additions & 5 deletions bundles/EcommerceFrameworkBundle/Tools/Installer.php
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -388,7 +387,6 @@ private function installTables()
continue;
}


$this->db->executeQuery($statement);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Console/Application.php
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 0 additions & 3 deletions lib/Extension/Bundle/Installer/AbstractInstaller.php
Expand Up @@ -25,9 +25,6 @@ class AbstractInstaller implements InstallerInterface
*/
protected $output;

/**
*
*/
public function __construct()
{
$this->output = new BufferedOutput(Output::VERBOSITY_NORMAL, true);
Expand Down
17 changes: 9 additions & 8 deletions lib/Migrations/FilteredMigrationsRepository.php
Expand Up @@ -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
{
Expand All @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
17 changes: 9 additions & 8 deletions lib/Migrations/FilteredTableMetadataStorage.php
Expand Up @@ -30,6 +30,7 @@ public function __invoke(DependencyFactory $dependencyFactory)
);

$this->setStorage($storage);

return $this;
}

Expand All @@ -46,35 +47,35 @@ 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;
}
}

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();
}
Expand Down
1 change: 1 addition & 0 deletions lib/Pimcore.php
Expand Up @@ -153,6 +153,7 @@ public static function isInstalled()
{
try {
\Pimcore\Db::get()->fetchOne('SELECT VERSION()');

return true;
} catch (\Exception $e) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions tests/_support/Helper/DataType/TestDataHelper.php
Expand Up @@ -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);

Expand Down

0 comments on commit 0acbd02

Please sign in to comment.