Skip to content

Commit c4e0fb0

Browse files
committed
style: add pint and apply styles
1 parent 13f6161 commit c4e0fb0

File tree

87 files changed

+274
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+274
-542
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ jobs:
4040
max_attempts: 5
4141
command: composer update --prefer-dist --no-interaction --no-progress
4242

43+
- name: Execute style
44+
run: composer run style
45+
4346
- name: Execute tests
44-
run: vendor/bin/phpunit
47+
run: composer run test

composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"require-dev": {
2828
"laravel/cashier": "^15.6",
2929
"laravel/legacy-factories": "^1.4",
30+
"laravel/pint": "^1.24",
3031
"orchestra/testbench": "^9.14|^10.0",
3132
"phpunit/phpunit": "^11.5"
3233
},
@@ -40,6 +41,15 @@
4041
"CloudCreativity\\LaravelStripe\\Tests\\": "tests/lib"
4142
}
4243
},
44+
"scripts": {
45+
"all": [
46+
"@style",
47+
"@test"
48+
],
49+
"style": "pint --test",
50+
"style:fix": "pint",
51+
"test": "phpunit"
52+
},
4353
"extra": {
4454
"branch-alias": {
4555
"dev-develop": "1.x-dev"

config/stripe.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
2+
23
/**
3-
* This file is part of cloudcreativity/laravel-stripe
4+
* This file is part of cloudcreativity/laravel-stripe.
45
*
56
* (c) Christopher Gammie <[email protected]>
67
*

database/factories/StripeAccountFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*

database/factories/StripeEventFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*

database/migrations/2019_07_17_074500_create_stripe_accounts_and_events.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*
@@ -22,7 +23,6 @@
2223

2324
class CreateStripeAccountsAndEvents extends Migration
2425
{
25-
2626
/**
2727
* Run the migration.
2828
*

pint.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"preset": "psr12",
3+
"rules": {
4+
"array_syntax": true,
5+
"assign_null_coalescing_to_coalesce_equal": true,
6+
"clean_namespace": true,
7+
"declare_strict_types": false,
8+
"list_syntax": true,
9+
"no_empty_phpdoc": true,
10+
"no_superfluous_elseif": true,
11+
"no_superfluous_phpdoc_tags": {
12+
"remove_inheritdoc": true
13+
},
14+
"no_unneeded_braces": true,
15+
"no_useless_nullsafe_operator": true,
16+
"no_whitespace_before_comma_in_array": true,
17+
"normalize_index_brace": true,
18+
"nullable_type_declaration": true,
19+
"nullable_type_declaration_for_default_null_value": true,
20+
"ordered_attributes": true,
21+
"ordered_traits": true,
22+
"ordered_types": {
23+
"null_adjustment": "always_last"
24+
},
25+
"phpdoc_summary": true,
26+
"phpdoc_trim": true,
27+
"phpdoc_types": true,
28+
"phpdoc_types_order": {
29+
"null_adjustment": "always_last"
30+
},
31+
"simple_to_complex_string_variable": true,
32+
"ternary_to_null_coalescing": true,
33+
"trailing_comma_in_multiline": {
34+
"elements": ["arguments", "arrays", "match", "parameters"]
35+
}
36+
}
37+
}

src/Assert.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*
@@ -42,7 +43,6 @@ public static function id($expected, $id)
4243
/**
4344
* Assert that the currency is supported by the application.
4445
*
45-
* @param $currency
4646
* @return void
4747
*/
4848
public static function supportedCurrency($currency)
@@ -59,8 +59,6 @@ public static function supportedCurrency($currency)
5959
/**
6060
* Assert that the currency and amount are chargeable.
6161
*
62-
* @param $currency
63-
* @param $amount
6462
* @return void
6563
* @see https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts
6664
*/
@@ -82,7 +80,6 @@ public static function chargeAmount($currency, $amount)
8280
/**
8381
* Assert that the value is a zero-decimal amount.
8482
*
85-
* @param $amount
8683
* @return void
8784
* @see https://stripe.com/docs/currencies#zero-decimal
8885
*/

src/Client.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*
@@ -25,16 +26,13 @@
2526

2627
class Client
2728
{
28-
2929
/**
3030
* @var Dispatcher
3131
*/
3232
private $events;
3333

3434
/**
3535
* Client constructor.
36-
*
37-
* @param Dispatcher $events
3836
*/
3937
public function __construct(Dispatcher $events)
4038
{
@@ -44,8 +42,6 @@ public function __construct(Dispatcher $events)
4442
/**
4543
* @param string $class
4644
* @param string $method
47-
* @param mixed ...$args
48-
* @return mixed
4945
*/
5046
public function __invoke($class, $method, ...$args)
5147
{
@@ -66,11 +62,6 @@ public function __invoke($class, $method, ...$args)
6662

6763
/**
6864
* Execute the static Stripe call.
69-
*
70-
* @param $class
71-
* @param $method
72-
* @param array $args
73-
* @return mixed
7465
*/
7566
protected function execute($class, $method, array $args)
7667
{

src/Config.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright 2023 Cloud Creativity Limited
45
*
@@ -28,7 +29,6 @@
2829

2930
class Config
3031
{
31-
3232
/**
3333
* Get the Stripe API Key.
3434
*
@@ -65,13 +65,13 @@ public static function clientId()
6565
/**
6666
* Get the Connect account model.
6767
*
68-
* @return StripeAccount|mixed
68+
* @return mixed|StripeAccount
6969
*/
7070
public static function connectModel()
7171
{
7272
$class = self::fqn('connect.model');
7373

74-
return new $class;
74+
return new $class();
7575
}
7676

7777
/**
@@ -83,7 +83,7 @@ public static function connectOwner()
8383
{
8484
$class = self::fqn('connect.owner');
8585

86-
return new $class;
86+
return new $class();
8787
}
8888

8989
/**
@@ -118,13 +118,13 @@ public static function connectErrorView()
118118
}
119119

120120
/**
121-
* @return StripeEvent|mixed
121+
* @return mixed|StripeEvent
122122
*/
123123
public static function webhookModel()
124124
{
125125
$class = self::fqn('webhooks.model');
126126

127-
return new $class;
127+
return new $class();
128128
}
129129

130130
/**
@@ -139,7 +139,7 @@ public static function webhookSigningSecrect($name)
139139
throw new RuntimeException("Webhook signing secret does not exist: {$name}");
140140
}
141141

142-
if (!is_string($secret)|| empty($secret)) {
142+
if (!is_string($secret) || empty($secret)) {
143143
throw new RuntimeException("Invalid webhook signing secret: {$name}");
144144
}
145145

@@ -168,7 +168,7 @@ public static function webhookQueue($type, $connect = false)
168168
$path = sprintf(
169169
'webhooks.%s.%s',
170170
$connect ? 'connect' : 'account',
171-
str_replace('.', '_', $type)
171+
str_replace('.', '_', $type),
172172
);
173173

174174
return array_replace([
@@ -242,7 +242,6 @@ public static function logExclude()
242242
/**
243243
* @param string $key
244244
* @param mixed|null $default
245-
* @return mixed
246245
*/
247246
private static function get($key, $default = null)
248247
{
@@ -265,7 +264,6 @@ private static function fqn($key)
265264
}
266265

267266
/**
268-
* @param $key
269267
* @return bool
270268
*/
271269
private static function has($key)

0 commit comments

Comments
 (0)