Skip to content

Commit 024d1ce

Browse files
committed
PHP CS Fixer
1 parent dc0aa66 commit 024d1ce

21 files changed

+75
-72
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ composer.lock
88
*/.iws
99
npm-debug.log
1010
.phpunit.result.cache
11+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
'no_empty_comment' => true,
3535
'no_empty_phpdoc' => true,
3636
'no_extra_blank_lines' => [
37-
'extra',
38-
'use',
39-
'use_trait',
40-
'return',
37+
'tokens' => [
38+
'extra',
39+
'use',
40+
'use_trait',
41+
'return',
42+
],
4143
],
4244
'no_leading_import_slash' => true,
4345
'no_leading_namespace_whitespace' => true,
@@ -48,7 +50,7 @@
4850
'no_useless_else' => true,
4951
'no_useless_return' => true,
5052
'single_trait_insert_per_statement' => true,
51-
'psr4' => true,
53+
'psr_autoloading' => true,
5254
'dir_constant' => true,
5355
'single_line_comment_style' => [
5456
'comment_types' => ['hash'],
@@ -97,7 +99,7 @@
9799
'standardize_not_equals' => true,
98100
'ternary_operator_spaces' => true,
99101
'whitespace_after_comma_in_array' => true,
100-
'trailing_comma_in_multiline_array' => true,
102+
'trailing_comma_in_multiline' => true,
101103
'trim_array_spaces' => true,
102104
'binary_operator_spaces' => true,
103105
'unary_operator_spaces' => true,

config/addressing.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
return [
44
/*
5-
|--------------------------------------------------------------------------
6-
| Route Configuration
7-
|--------------------------------------------------------------------------
8-
*/
5+
|--------------------------------------------------------------------------
6+
| Route Configuration
7+
|--------------------------------------------------------------------------
8+
*/
99
'routes' => [
1010
'enabled' => true,
1111
'prefix' => 'galahad/addressing',

src/Collection/CountryCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function toArray(): array
7474

7575
public function toSelectArray(): array
7676
{
77-
return $this->mapWithKeys(static function (Country $country) {
77+
return $this->mapWithKeys(static function(Country $country) {
7878
return [$country->getCountryCode() => $country->getName()];
7979
})->toArray();
8080
}

src/Collection/SubdivisionCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function toArray(): array
109109

110110
public function toSelectArray(): array
111111
{
112-
return $this->mapWithKeys(static function (Subdivision $subdivision) {
112+
return $this->mapWithKeys(static function(Subdivision $subdivision) {
113113
return [$subdivision->getCode() => $subdivision->getName()];
114114
})->toArray();
115115
}

src/Entity/AdministrativeArea.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function is(Subdivision $subdivision = null): bool
2525
}
2626

2727
return $this->getCountry()->is($subdivision->getCountry())
28-
&& $this->getCode() === $subdivision->getCode();
28+
&& $this->getCode() === $subdivision->getCode();
2929
}
3030
}

src/Entity/Country.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public function administrativeArea(string $code): ?AdministrativeArea
8282
// If that doesn't work, do a case-insensitive lookup.
8383

8484
return $this->administrativeAreas()->get(strtoupper($code))
85-
?? $this->administrativeAreas()->first(fn(AdministrativeArea $subdivision) => 0 === strcasecmp($subdivision->getCode(), $code));
85+
?? $this->administrativeAreas()->first(fn(AdministrativeArea $subdivision) => 0 === strcasecmp($subdivision->getCode(), $code));
8686
}
8787

8888
public function administrativeAreaByName(string $name): ?AdministrativeArea
8989
{
9090
return $this->administrativeAreas()
91-
->first(fn(AdministrativeArea $subdivision) => 0 === strcasecmp($subdivision->getName(), $name));
91+
->first(fn(AdministrativeArea $subdivision) => 0 === strcasecmp($subdivision->getName(), $name));
9292
}
9393

9494
/**

src/Entity/Subdivision.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getParent(): ?self
5959
public function getPostalCodePattern(): ?string
6060
{
6161
return $this->subdivision->getPostalCodePattern()
62-
?? $this->country->addressFormat()->getPostalCodePattern();
62+
?? $this->country->addressFormat()->getPostalCodePattern();
6363
}
6464

6565
public function getPostalCodePatternType(): string

src/LaravelAddressing.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function country($country_code, $locale = null): ?Country
9393
$this->address_format_repository
9494
));
9595
} catch (UnknownCountryException $exception) {
96-
//
96+
9797
}
9898
}
9999

@@ -135,9 +135,9 @@ public function countries($locale = null): CountryCollection
135135
public function countryByName($name): ?Country
136136
{
137137
return $this->countries()
138-
->first(static function (Country $country) use ($name) {
139-
return 0 === strcasecmp($country->getName(), $name);
140-
});
138+
->first(static function(Country $country) use ($name) {
139+
return 0 === strcasecmp($country->getName(), $name);
140+
});
141141
}
142142

143143
/**

src/Support/AddressingServiceProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function register(): void
3636
{
3737
$this->mergeConfigFrom(__DIR__.'/../../config/addressing.php', 'addressing');
3838

39-
$this->app->singleton(LaravelAddressing::class, static function (Application $app) {
39+
$this->app->singleton(LaravelAddressing::class, static function(Application $app) {
4040
$locale = $app['config']->get('app.locale', 'en');
4141
$fallback_locale = $app['config']->get('app.fallback_locale', 'en');
4242

@@ -79,12 +79,12 @@ protected function bootRoutes(): void
7979

8080
$prefix = $config->get('addressing.routes.prefix', 'galahad/addressing');
8181

82-
$router->group(compact('prefix'), static function (Registrar $route) {
82+
$router->group(compact('prefix'), static function(Registrar $route) {
8383
$route->get('/countries', CountriesController::class)
84-
->name('galahad.addressing.countries');
84+
->name('galahad.addressing.countries');
8585

8686
$route->get('/countries/{country_code}/administrative-areas', AdministrativeAreasController::class)
87-
->name('galahad.addressing.administrative-areas');
87+
->name('galahad.addressing.administrative-areas');
8888
});
8989
} catch (BindingResolutionException $exception) {
9090
// Skip routes if no router exists
@@ -96,7 +96,7 @@ protected function bootRoutes(): void
9696
*/
9797
protected function registerValidators(): void
9898
{
99-
$this->app->resolving(Factory::class, static function (Factory $validation_factory, Container $app) {
99+
$this->app->resolving(Factory::class, static function(Factory $validation_factory, Container $app) {
100100
$validator = new Validator($app->make(LaravelAddressing::class));
101101

102102
$validation_factory->extend('country', Closure::fromCallable([$validator, 'looseCountry']));

0 commit comments

Comments
 (0)