Skip to content

Commit

Permalink
Fix code style issues after rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Feb 19, 2024
1 parent 469803d commit f3ff5cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
7 changes: 4 additions & 3 deletions src/Migration/BackboneNavigationMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Contao\CoreBundle\Migration\AbstractMigration;
use Contao\CoreBundle\Migration\MigrationResult;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Column;

use function is_int;
use function sprintf;
Expand Down Expand Up @@ -67,7 +68,7 @@ public function run(): MigrationResult
$this->renameNavigationModules();

$affectedFields = $this->determineAffectedFields();
$table = $this->connection->getSchemaManager()->listTableDetails('tl_module');
$table = $this->connection->createSchemaManager()->introspectTable('tl_module');
foreach ($affectedFields as $oldName => $newName) {
$this->renameField($table->getColumn(self::OLD_PREFIX . $oldName), $newName);
}
Expand Down Expand Up @@ -122,8 +123,8 @@ private function renameField(Column $column, string $newName): void
sprintf(
'ALTER TABLE tl_module CHANGE %s %s',
$column->getName(),
$platform->getColumnDeclarationSQL(self::NEW_PREFIX . $newName, $column->toArray())
)
$platform->getColumnDeclarationSQL(self::NEW_PREFIX . $newName, $column->toArray()),
),
);
}
}
24 changes: 12 additions & 12 deletions src/QueryBuilder/PageQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ function (QueryBuilder $queryBuilder): void {
$queryBuilder
->select(
...array_map(
fn (string $field) => ($field !== '*') ? $this->connection->quoteIdentifier($field) : $field,
$this->fields
)
fn (string $field) => $field !== '*' ? $this->connection->quoteIdentifier($field) : $field,
$this->fields,
),
)
->andWhere('type != :rootType')
->setParameter('rootType', 'root')
Expand Down Expand Up @@ -105,8 +105,8 @@ function (QueryBuilder $queryBuilder): void {
->select(
...array_map(
fn (string $field) => $this->connection->quoteIdentifier($field),
['id', 'pid', 'protected', 'groups']
)
['id', 'pid', 'protected', 'groups'],
),
);

$this
Expand Down Expand Up @@ -139,8 +139,8 @@ function (QueryBuilder $queryBuilder): void {
$queryBuilder->select(
...array_map(
fn (string $field) => $this->connection->quoteIdentifier($field),
['id', 'pid', 'protected', 'groups']
)
['id', 'pid', 'protected', 'groups'],
),
);

$this
Expand Down Expand Up @@ -169,8 +169,8 @@ function (QueryBuilder $queryBuilder): void {
->select(
...array_map(
fn (string $field) => $this->connection->quoteIdentifier($field),
['id', 'pid', 'protected', 'groups']
)
['id', 'pid', 'protected', 'groups'],
),
)
->where('id IN (:ids)');
},
Expand All @@ -191,8 +191,8 @@ function (QueryBuilder $queryBuilder): void {
->select(
...array_map(
fn (string $field) => $this->connection->quoteIdentifier($field),
$this->fields
)
$this->fields,
),
)
->where('id IN (:rootIds)');
},
Expand All @@ -215,7 +215,7 @@ static function (QueryBuilder $queryBuilder): void {
},
);

$query->setParameter('ids', $pageIds, Connection::PARAM_STR_ARRAY);
$query->setParameter('ids', $pageIds, ArrayParameterType::STRING);

return $query;
}
Expand Down
10 changes: 6 additions & 4 deletions src/Renderer/NavigationRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,27 @@ private function renderTree(
$containsActive = true;

if ($item['href'] === Environment::get('request')) {
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isInTrail'] = false;
$item['isActive'] = true; // nothing else (active class is set in template)
} else {
$item['isActive'] = false; // nothing else (active class is set in template)
$item['isInTrail'] = true;
}
} else { // do not flatten if/else
/** @psalm-suppress RiskyTruthyFalsyComparison */
if (isset($item['tid']) && $item['tid'] === $activeId) {
if ($item['href'] === Environment::get('request')) {
$item['isActive'] = true; // nothing else (active class is set in template)
$item['isActive'] = true; // nothing else (active class is set in template)
} else {
$item['isInTrail'] = true;
}
}
}

/** @psalm-suppress RiskyTruthyFalsyComparison */
if ($item['isInTrail']) {
$item['class'] .= ' trail';
}

/** @psalm-suppress RiskyTruthyFalsyComparison */
if (! isset($this->items->subItems[$itemId])) {
$item['class'] .= ' leaf';
} elseif ($currentLevel >= $hardLevel) {
Expand Down Expand Up @@ -196,6 +197,7 @@ private function renderTree(

if ($containsActive) {
foreach ($renderedItems as &$item) {
/** @psalm-suppress RiskyTruthyFalsyComparison */
if ($item['isActive']) {
continue;
}
Expand Down

0 comments on commit f3ff5cb

Please sign in to comment.