Skip to content

Commit 8772cc4

Browse files
committed
Use Laravel Pint as code style fixer
1 parent 5b682a0 commit 8772cc4

File tree

7 files changed

+47
-102
lines changed

7 files changed

+47
-102
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"require-dev": {
2121
"orchestra/testbench": "^7.0 || ^8.0",
22-
"symplify/easy-coding-standard": "^11.1",
23-
"phpunit/phpunit": "^9.6"
22+
"phpunit/phpunit": "^9.6",
23+
"laravel/pint": "^1.13"
2424
},
2525
"autoload": {
2626
"psr-4": {
@@ -44,7 +44,7 @@
4444
},
4545
"scripts": {
4646
"cs": [
47-
"vendor/bin/ecs --fix"
47+
"vendor/bin/pint"
4848
],
4949
"test": [
5050
"vendor/bin/phpunit"

ecs.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/FirebaseProject.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ class FirebaseProject
2121
protected array $config;
2222

2323
protected ?AppCheck $appCheck = null;
24+
2425
protected ?Auth $auth = null;
26+
2527
protected ?Database $database = null;
28+
2629
protected ?DynamicLinks $dynamicLinks = null;
30+
2731
protected ?Firestore $firestore = null;
32+
2833
protected ?Messaging $messaging = null;
34+
2935
protected ?RemoteConfig $remoteConfig = null;
36+
3037
protected ?Storage $storage = null;
3138

3239
public function __construct(Factory $factory, array $config)
@@ -37,7 +44,7 @@ public function __construct(Factory $factory, array $config)
3744

3845
public function appCheck(): AppCheck
3946
{
40-
if (!$this->appCheck) {
47+
if (! $this->appCheck) {
4148
$this->appCheck = $this->factory->createAppCheck();
4249
}
4350

@@ -46,7 +53,7 @@ public function appCheck(): AppCheck
4653

4754
public function auth(): Auth
4855
{
49-
if (!$this->auth) {
56+
if (! $this->auth) {
5057
$this->auth = $this->factory->createAuth();
5158
}
5259

@@ -55,7 +62,7 @@ public function auth(): Auth
5562

5663
public function database(): Database
5764
{
58-
if (!$this->database) {
65+
if (! $this->database) {
5966
$this->database = $this->factory->createDatabase();
6067
}
6168

@@ -64,7 +71,7 @@ public function database(): Database
6471

6572
public function dynamicLinks(): DynamicLinks
6673
{
67-
if (!$this->dynamicLinks) {
74+
if (! $this->dynamicLinks) {
6875
$this->dynamicLinks = $this->factory->createDynamicLinksService($this->config['dynamic_links']['default_domain'] ?? null);
6976
}
7077

@@ -73,7 +80,7 @@ public function dynamicLinks(): DynamicLinks
7380

7481
public function firestore(): Firestore
7582
{
76-
if (!$this->firestore) {
83+
if (! $this->firestore) {
7784
$this->firestore = $this->factory->createFirestore();
7885
}
7986

@@ -82,7 +89,7 @@ public function firestore(): Firestore
8289

8390
public function messaging(): Messaging
8491
{
85-
if (!$this->messaging) {
92+
if (! $this->messaging) {
8693
$this->messaging = $this->factory->createMessaging();
8794
}
8895

@@ -91,7 +98,7 @@ public function messaging(): Messaging
9198

9299
public function remoteConfig(): RemoteConfig
93100
{
94-
if (!$this->remoteConfig) {
101+
if (! $this->remoteConfig) {
95102
$this->remoteConfig = $this->factory->createRemoteConfig();
96103
}
97104

@@ -100,7 +107,7 @@ public function remoteConfig(): RemoteConfig
100107

101108
public function storage(): Storage
102109
{
103-
if (!$this->storage) {
110+
if (! $this->storage) {
104111
$this->storage = $this->factory->createStorage();
105112
}
106113

src/FirebaseProjectManager.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public function __construct(Container $app)
2525
$this->app = $app;
2626
}
2727

28-
public function project(?string $name = null): FirebaseProject
28+
public function project(string $name = null): FirebaseProject
2929
{
3030
$name = $name ?? $this->getDefaultProject();
3131

32-
if (!isset($this->projects[$name])) {
32+
if (! isset($this->projects[$name])) {
3333
$this->projects[$name] = $this->configure($name);
3434
}
3535

@@ -38,9 +38,9 @@ public function project(?string $name = null): FirebaseProject
3838

3939
protected function configuration(string $name): array
4040
{
41-
$config = $this->app->config->get('firebase.projects.' . $name);
41+
$config = $this->app->config->get('firebase.projects.'.$name);
4242

43-
if (!$config) {
43+
if (! $config) {
4444
throw new InvalidArgumentException("Firebase project [{$name}] not configured.");
4545
}
4646

@@ -53,7 +53,7 @@ protected function resolveJsonCredentials(string $credentials): string
5353
$isAbsoluteLinuxPath = \str_starts_with($credentials, '/');
5454
$isAbsoluteWindowsPath = \str_contains($credentials, ':\\');
5555

56-
$isRelativePath = !$isJsonString && !$isAbsoluteLinuxPath && !$isAbsoluteWindowsPath;
56+
$isRelativePath = ! $isJsonString && ! $isAbsoluteLinuxPath && ! $isAbsoluteWindowsPath;
5757

5858
return $isRelativePath ? $this->app->basePath($credentials) : $credentials;
5959
}

src/ServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ final class ServiceProvider extends \Illuminate\Support\ServiceProvider
1212
public function boot(): void
1313
{
1414
// @codeCoverageIgnoreStart
15-
if (!$this->app->runningInConsole()) {
15+
if (! $this->app->runningInConsole()) {
1616
return;
1717
}
1818
// @codeCoverageIgnoreEnd
1919

2020
$this->publishes([
21-
__DIR__ . '/../config/firebase.php' => $this->app->configPath('firebase.php'),
21+
__DIR__.'/../config/firebase.php' => $this->app->configPath('firebase.php'),
2222
], 'config');
2323
}
2424

2525
public function register(): void
2626
{
27-
$this->mergeConfigFrom(__DIR__ . '/../config/firebase.php', 'firebase');
27+
$this->mergeConfigFrom(__DIR__.'/../config/firebase.php', 'firebase');
2828

2929
$this->registerManager();
3030
$this->registerComponents();

tests/FirebaseProjectManagerTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class FirebaseProjectManagerTest extends TestCase
1919
{
2020
protected function defineEnvironment($app): void
2121
{
22-
$app['config']->set('firebase.projects.app.credentials', __DIR__ . '/_fixtures/service_account.json');
22+
$app['config']->set('firebase.projects.app.credentials', __DIR__.'/_fixtures/service_account.json');
2323
}
2424

2525
/**
@@ -69,12 +69,12 @@ public function calls_are_passed_to_default_project(): void
6969
public function credentials_can_be_configured_using_a_json_file(): void
7070
{
7171
// Reference credentials
72-
$credentialsPath = \realpath(__DIR__ . '/_fixtures/service_account.json');
72+
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
7373
$credentials = \json_decode(\file_get_contents($credentialsPath), true);
7474

7575
// Set configuration and retrieve project
7676
$projectName = 'app';
77-
$this->app->config->set('firebase.projects.' . $projectName . '.credentials', \realpath(__DIR__ . '/_fixtures/service_account.json'));
77+
$this->app->config->set('firebase.projects.'.$projectName.'.credentials', \realpath(__DIR__.'/_fixtures/service_account.json'));
7878
$factory = $this->factoryForProject($projectName);
7979

8080
// Retrieve service account
@@ -90,12 +90,12 @@ public function credentials_can_be_configured_using_a_json_file(): void
9090
public function json_file_credentials_can_be_used_using_the_deprecated_configuration_entry(): void
9191
{
9292
// Reference credentials
93-
$credentialsPath = \realpath(__DIR__ . '/_fixtures/service_account.json');
93+
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
9494
$credentials = \json_decode(\file_get_contents($credentialsPath), true);
9595

9696
// Set configuration and retrieve project
9797
$projectName = 'app';
98-
$this->app->config->set('firebase.projects.' . $projectName . '.credentials.file', \realpath(__DIR__ . '/_fixtures/service_account.json'));
98+
$this->app->config->set('firebase.projects.'.$projectName.'.credentials.file', \realpath(__DIR__.'/_fixtures/service_account.json'));
9999
$factory = $this->factoryForProject($projectName);
100100

101101
// Retrieve service account
@@ -112,7 +112,7 @@ public function credentials_can_be_configured_using_an_array(): void
112112
{
113113
// Set configuration and retrieve project
114114
$projectName = 'app';
115-
$this->app->config->set('firebase.projects.' . $projectName . '.credentials', $credentials = [
115+
$this->app->config->set('firebase.projects.'.$projectName.'.credentials', $credentials = [
116116
'type' => 'service_account',
117117
'project_id' => 'project',
118118
'private_key_id' => 'private_key_id',
@@ -139,19 +139,19 @@ public function credentials_can_be_configured_using_an_array(): void
139139
public function projects_can_have_different_credentials(): void
140140
{
141141
// Reference credentials
142-
$credentialsPath = \realpath(__DIR__ . '/_fixtures/service_account.json');
142+
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
143143
$credentials = \json_decode(\file_get_contents($credentialsPath), true);
144144

145-
$secondCredentialsPath = \realpath(__DIR__ . '/_fixtures/another_service_account.json');
145+
$secondCredentialsPath = \realpath(__DIR__.'/_fixtures/another_service_account.json');
146146
$secondCredentials = \json_decode(\file_get_contents($secondCredentialsPath), true);
147147

148148
// Project names to use
149149
$projectName = 'app';
150150
$secondProjectName = 'another-app';
151151

152152
// Set service accounts explicitly
153-
$this->app->config->set('firebase.projects.' . $projectName . '.credentials', \realpath(__DIR__ . '/_fixtures/service_account.json'));
154-
$this->app->config->set('firebase.projects.' . $secondProjectName . '.credentials', \realpath(__DIR__ . '/_fixtures/another_service_account.json'));
153+
$this->app->config->set('firebase.projects.'.$projectName.'.credentials', \realpath(__DIR__.'/_fixtures/service_account.json'));
154+
$this->app->config->set('firebase.projects.'.$secondProjectName.'.credentials', \realpath(__DIR__.'/_fixtures/another_service_account.json'));
155155

156156
// Retrieve factories and service accounts
157157
$factory = $this->factoryForProject($projectName);
@@ -171,8 +171,8 @@ public function projects_can_have_different_credentials(): void
171171
public function the_realtime_database_url_can_be_configured(): void
172172
{
173173
$projectName = $this->app->config->get('firebase.default');
174-
$this->app->config->set('firebase.projects.' . $projectName . '.database.url', $url = 'https://domain.tld');
175-
$this->app->config->set('firebase.projects.' . $projectName . '.database.auth_variable_override', ['uid' => 'some-uid']);
174+
$this->app->config->set('firebase.projects.'.$projectName.'.database.url', $url = 'https://domain.tld');
175+
$this->app->config->set('firebase.projects.'.$projectName.'.database.auth_variable_override', ['uid' => 'some-uid']);
176176

177177
$database = $this->app->make(Firebase\Contract\Database::class);
178178

@@ -187,7 +187,7 @@ public function the_realtime_database_url_can_be_configured(): void
187187
public function the_dynamic_links_default_domain_can_be_configured(): void
188188
{
189189
$projectName = $this->app->config->get('firebase.default');
190-
$this->app->config->set('firebase.projects.' . $projectName . '.dynamic_links.default_domain', $domain = 'https://domain.tld');
190+
$this->app->config->set('firebase.projects.'.$projectName.'.dynamic_links.default_domain', $domain = 'https://domain.tld');
191191

192192
$dynamicLinks = $this->app->make(Firebase\Contract\DynamicLinks::class);
193193

@@ -204,7 +204,7 @@ public function the_dynamic_links_default_domain_can_be_configured(): void
204204
public function the_storage_default_bucket_can_be_configured(): void
205205
{
206206
$projectName = $this->app->config->get('firebase.default');
207-
$this->app->config->set('firebase.projects.' . $projectName . '.storage.default_bucket', $name = 'my-bucket');
207+
$this->app->config->set('firebase.projects.'.$projectName.'.storage.default_bucket', $name = 'my-bucket');
208208

209209
$storage = $this->app->make(Firebase\Contract\Storage::class);
210210

@@ -219,7 +219,7 @@ public function the_storage_default_bucket_can_be_configured(): void
219219
public function logging_can_be_configured(): void
220220
{
221221
$projectName = $this->app->config->get('firebase.default');
222-
$this->app->config->set('firebase.projects.' . $projectName . '.logging.http_log_channel', 'stack');
222+
$this->app->config->set('firebase.projects.'.$projectName.'.logging.http_log_channel', 'stack');
223223

224224
$factory = $this->factoryForProject($projectName);
225225

@@ -234,7 +234,7 @@ public function logging_can_be_configured(): void
234234
public function debug_logging_can_be_configured(): void
235235
{
236236
$projectName = $this->app->config->get('firebase.default');
237-
$this->app->config->set('firebase.projects.' . $projectName . '.logging.http_debug_log_channel', 'stack');
237+
$this->app->config->set('firebase.projects.'.$projectName.'.logging.http_debug_log_channel', 'stack');
238238

239239
$factory = $this->factoryForProject($projectName);
240240

@@ -249,9 +249,9 @@ public function debug_logging_can_be_configured(): void
249249
public function http_client_options_can_be_configured(): void
250250
{
251251
$projectName = $this->app->config->get('firebase.default');
252-
$this->app->config->set('firebase.projects.' . $projectName . '.http_client_options.proxy', 'proxy.domain.tld');
253-
$this->app->config->set('firebase.projects.' . $projectName . '.http_client_options.timeout', 1.23);
254-
$this->app->config->set('firebase.projects.' . $projectName . '.http_client_options.guzzle_middlewares', [RetryMiddleware::class]);
252+
$this->app->config->set('firebase.projects.'.$projectName.'.http_client_options.proxy', 'proxy.domain.tld');
253+
$this->app->config->set('firebase.projects.'.$projectName.'.http_client_options.timeout', 1.23);
254+
$this->app->config->set('firebase.projects.'.$projectName.'.http_client_options.guzzle_middlewares', [RetryMiddleware::class]);
255255

256256
$factory = $this->factoryForProject($projectName);
257257

@@ -289,7 +289,7 @@ public function it_uses_the_laravel_cache_as_auth_token_cache(): void
289289
$this->assertInstanceOf(CacheItemPoolInterface::class, $property->getValue($factory));
290290
}
291291

292-
private function factoryForProject(?string $project = null): Factory
292+
private function factoryForProject(string $project = null): Factory
293293
{
294294
$project = $this->app->make(FirebaseProjectManager::class)->project($project);
295295

tests/ServiceProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class ServiceProviderTest extends TestCase
1616
*/
1717
public function it_provides_components(): void
1818
{
19-
$this->app->config->set('firebase.projects.app.credentials', \realpath(__DIR__ . '/_fixtures/service_account.json'));
19+
$this->app->config->set('firebase.projects.app.credentials', \realpath(__DIR__.'/_fixtures/service_account.json'));
2020

2121
$this->assertInstanceOf(Firebase\Contract\AppCheck::class, $this->app->make(Firebase\Contract\AppCheck::class));
2222
$this->assertInstanceOf(Firebase\Contract\Auth::class, $this->app->make(Firebase\Contract\Auth::class));

0 commit comments

Comments
 (0)