Skip to content

Commit

Permalink
Merge pull request #90 from gpslab/cs-fix
Browse files Browse the repository at this point in the history
Fix Code Style
  • Loading branch information
peter-gribanov authored Dec 20, 2023
2 parents 767829c + 47082e2 commit 947ba5d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
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

0 comments on commit 947ba5d

Please sign in to comment.