Skip to content

Commit 9c55568

Browse files
authored
Switch to Laravel Pint Action for Code Styling (#151)
1 parent 6a6b692 commit 9c55568

File tree

9 files changed

+28
-48
lines changed

9 files changed

+28
-48
lines changed

.github/workflows/code-style.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ name: Code Style
33
on: [push]
44

55
jobs:
6-
php-cs-fixer:
6+
phplint:
77
if: "!contains(github.event.head_commit.message, 'skip ci')"
8-
8+
99
runs-on: ubuntu-latest
10-
10+
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
14+
15+
- name: "Laravel Pint"
16+
uses: aglipanci/[email protected]
1417
with:
15-
ref: ${{ github.head_ref }}
16-
17-
- name: Run PHP CS Fixer
18-
uses: docker://oskarstark/php-cs-fixer-ga
19-
20-
- name: Commit changes
18+
preset: laravel
19+
20+
- name: Commit changes to GitHub
2121
uses: stefanzweifel/git-auto-commit-action@v4
2222
with:
23-
commit_message: Apply PHP CS Fixer changes
23+
commit_message: "PHP Style Change (Laravel Pint in CI)"
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.php-cs-fixer.dist.php

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

src/Exceptions/CouldNotSendNotification.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CouldNotSendNotification extends Exception
1717
*/
1818
public static function telegramRespondedWithAnError(ClientException $exception): self
1919
{
20-
if (!$exception->hasResponse()) {
20+
if (! $exception->hasResponse()) {
2121
return new static('Telegram responded with an error but no response body found');
2222
}
2323

@@ -43,7 +43,6 @@ public static function telegramBotTokenNotProvided(string $message): self
4343
* Thrown when we're unable to communicate with Telegram.
4444
*
4545
* @param $message
46-
*
4746
* @return static
4847
*/
4948
public static function couldNotCommunicateWithTelegram($message): self

src/TelegramChannel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(Dispatcher $dispatcher)
2828
/**
2929
* Send the given notification.
3030
*
31-
* @param mixed $notifiable
31+
* @param mixed $notifiable
3232
*
3333
* @throws CouldNotSendNotification
3434
*/
@@ -44,7 +44,7 @@ public function send($notifiable, Notification $notification): ?array
4444
$to = $notifiable->routeNotificationFor('telegram', $notification)
4545
?? $notifiable->routeNotificationFor(self::class, $notification);
4646

47-
if (!$to) {
47+
if (! $to) {
4848
return null;
4949
}
5050

src/TelegramFile.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ public function content(string $content): self
4444
*
4545
* Generic method to attach files of any type based on API.
4646
*
47-
* @param resource|StreamInterface|string $file
48-
*
47+
* @param resource|StreamInterface|string $file
4948
* @return $this
5049
*/
5150
public function file($file, string $type, string $filename = null): self
5251
{
5352
$this->type = $type;
5453

55-
if (is_string($file) && !$this->isReadableFile($file)) {
54+
if (is_string($file) && ! $this->isReadableFile($file)) {
5655
$this->payload[$type] = $file;
5756

5857
return $this;

src/TelegramLocation.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class TelegramLocation extends TelegramBase implements TelegramSender
1313
/**
1414
* Telegram Location constructor.
1515
*
16-
* @param null|float|string $latitude
17-
* @param null|float|string $longitude
16+
* @param null|float|string $latitude
17+
* @param null|float|string $longitude
1818
*/
1919
public function __construct($latitude = null, $longitude = null)
2020
{
@@ -24,9 +24,8 @@ public function __construct($latitude = null, $longitude = null)
2424
}
2525

2626
/**
27-
* @param null|float|string $latitude
28-
* @param null|float|string $longitude
29-
*
27+
* @param null|float|string $latitude
28+
* @param null|float|string $longitude
3029
* @return static
3130
*/
3231
public static function create($latitude = null, $longitude = null): self
@@ -37,8 +36,7 @@ public static function create($latitude = null, $longitude = null): self
3736
/**
3837
* Location's latitude.
3938
*
40-
* @param float|string $latitude
41-
*
39+
* @param float|string $latitude
4240
* @return $this
4341
*/
4442
public function latitude($latitude): self
@@ -51,8 +49,7 @@ public function latitude($latitude): self
5149
/**
5250
* Location's latitude.
5351
*
54-
* @param float|string $longitude
55-
*
52+
* @param float|string $longitude
5653
* @return $this
5754
*/
5855
public function longitude($longitude): self

src/Traits/HasSharedLogic.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ trait HasSharedLogic
2727
/**
2828
* Recipient's Chat ID.
2929
*
30-
* @param int|string $chatId
31-
*
30+
* @param int|string $chatId
3231
* @return $this
3332
*/
3433
public function to($chatId): self
@@ -121,7 +120,7 @@ public function options(array $options): self
121120
*/
122121
public function toNotGiven(): bool
123122
{
124-
return !isset($this->payload['chat_id']);
123+
return ! isset($this->payload['chat_id']);
125124
}
126125

127126
/**

tests/TelegramChannelTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public function itCanSendAMessage(): void
6262
'parse_mode' => 'Markdown',
6363
'chat_id' => 12345,
6464
])
65-
->andReturns(new Response(200, [], json_encode($expectedResponse)))
66-
;
65+
->andReturns(new Response(200, [], json_encode($expectedResponse)));
6766

6867
$actualResponse = $this->channel->send(new TestNotifiable(), new TestNotification());
6968

@@ -83,8 +82,7 @@ public function notificationFailedEvent(): void
8382

8483
$this->telegram
8584
->shouldReceive('sendMessage')
86-
->andThrow($exception_class, $exception_message)
87-
;
85+
->andThrow($exception_class, $exception_message);
8886

8987
$this->dispatcher
9088
->expects($this->once())
@@ -96,8 +94,7 @@ public function notificationFailedEvent(): void
9694
'telegram',
9795
[]
9896
)
99-
)
100-
;
97+
);
10198

10299
$this->channel->send($notifiable, $notification);
103100
}

tests/TelegramLocationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
class TelegramLocationTest extends TestCase
1616
{
1717
public const TEST_LONG = -77.0364;
18+
1819
public const TEST_LAT = 38.8951;
1920

2021
/** @test */

0 commit comments

Comments
 (0)