Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Code Style #90

Merged
merged 5 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ phpunit.xml
composer.lock
.php_cs.cache
.phpunit.result.cache
.php-cs-fixer.cache

10 changes: 5 additions & 5 deletions src/Command/UpdateDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function configure(): void
$databases_help .= sprintf(' * <info>%s</info>'.PHP_EOL, $name);
}

[$first, $second, ] = array_keys($this->databases);
[$first, $second] = array_keys($this->databases);

$help .= <<<EOT

Expand Down Expand Up @@ -105,10 +105,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
throw new \InvalidArgumentException(sprintf('Undefined "%s" database.', $database));
}

if (!array_key_exists('url', $this->databases[$database]) ||
!array_key_exists('path', $this->databases[$database]) ||
!is_string($this->databases[$database]['url']) ||
!is_string($this->databases[$database]['path'])
if (!array_key_exists('url', $this->databases[$database])
|| !array_key_exists('path', $this->databases[$database])
|| !is_string($this->databases[$database]['url'])
|| !is_string($this->databases[$database]['path'])
) {
throw new \InvalidArgumentException(sprintf('Invalid "%s" database config.', $database));
}
Expand Down
40 changes: 20 additions & 20 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ private function normalizeDefaultDatabase(NodeDefinition $root_node): void
->beforeNormalization()
->ifTrue(static function ($v): bool {
return
is_array($v) &&
!array_key_exists('default_database', $v) &&
!empty($v['databases']) &&
is_array($v['databases']);
is_array($v)
&& !array_key_exists('default_database', $v)
&& !empty($v['databases'])
&& is_array($v['databases']);
})
->then(static function (array $v): array {
$keys = array_keys($v['databases']);
Expand Down Expand Up @@ -268,10 +268,10 @@ private function validateAvailableDefaultDatabase(NodeDefinition $root_node): vo
->validate()
->ifTrue(static function ($v): bool {
return
is_array($v) &&
array_key_exists('default_database', $v) &&
!empty($v['databases']) &&
!array_key_exists($v['default_database'], $v['databases']);
is_array($v)
&& array_key_exists('default_database', $v)
&& !empty($v['databases'])
&& !array_key_exists($v['default_database'], $v['databases']);
})
->then(static function (array $v): array {
$databases = implode('", "', array_keys($v['databases']));
Expand All @@ -292,10 +292,10 @@ private function allowGlobalLicense(NodeDefinition $root_node): void
->beforeNormalization()
->ifTrue(static function ($v): bool {
return
is_array($v) &&
array_key_exists('license', $v) &&
array_key_exists('databases', $v) &&
is_array($v['databases']);
is_array($v)
&& array_key_exists('license', $v)
&& array_key_exists('databases', $v)
&& is_array($v['databases']);
})
->then(static function (array $v): array {
foreach ($v['databases'] as $name => $database) {
Expand All @@ -320,10 +320,10 @@ private function allowGlobalLocales(NodeDefinition $root_node): void
->beforeNormalization()
->ifTrue(static function ($v): bool {
return
is_array($v) &&
array_key_exists('locales', $v) &&
array_key_exists('databases', $v) &&
is_array($v['databases']);
is_array($v)
&& array_key_exists('locales', $v)
&& array_key_exists('databases', $v)
&& is_array($v['databases']);
})
->then(static function (array $v): array {
foreach ($v['databases'] as $name => $database) {
Expand Down Expand Up @@ -386,10 +386,10 @@ private function normalizeUrl(NodeDefinition $database_node): void
->beforeNormalization()
->ifTrue(static function ($v): bool {
return
is_array($v) &&
!array_key_exists('url', $v) &&
array_key_exists('license', $v) &&
array_key_exists('edition', $v);
is_array($v)
&& !array_key_exists('url', $v)
&& array_key_exists('license', $v)
&& array_key_exists('edition', $v);
})
->then(static function (array $v): array {
$v['url'] = sprintf(self::URL, urlencode($v['edition']), urlencode($v['license']));
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/ReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(array $databases, string $reader_class = Reader::cla
*
* @return Reader
*/
public function create(string $database, ?array $locales = null): Reader
public function create(string $database, array $locales = null): Reader
{
if (!array_key_exists($database, $this->databases)) {
$databases = implode('", "', array_keys($this->databases));
Expand Down
Loading