Skip to content

Commit 4211c2a

Browse files
committed
Add support for L9, drop Laravel 8 & PHP 8.0 and lower, cleanup
1 parent dc65de8 commit 4211c2a

File tree

10 files changed

+122
-149
lines changed

10 files changed

+122
-149
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,22 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
os: [ubuntu-latest, windows-latest]
12-
php: [7.4]
13-
laravel: [8.*, 5.8.*, 6.*, 7.*]
11+
os: [ubuntu-latest]
12+
php: [8.1]
13+
laravel: [9.*]
1414
dependency-version: [prefer-lowest, prefer-stable]
1515
include:
16-
- laravel: 8.*
17-
testbench: 6.*
18-
- laravel: 7.*
19-
testbench: 5.*
20-
- laravel: 6.*
21-
testbench: 4.*
22-
- laravel: 5.8.*
23-
testbench: 3.8.*
16+
- laravel: 9.*
17+
testbench: 7.*
2418

2519
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
2620

2721
steps:
2822
- name: Checkout code
29-
uses: actions/checkout@v2
23+
uses: actions/checkout@v1
3024

3125
- name: Cache dependencies
32-
uses: actions/cache@v2
26+
uses: actions/cache@v1
3327
with:
3428
path: ~/.composer/cache/files
3529
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -38,12 +32,13 @@ jobs:
3832
uses: shivammathur/setup-php@v2
3933
with:
4034
php-version: ${{ matrix.php }}
41-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
35+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
4236
coverage: none
4337

4438
- name: Install dependencies
4539
run: |
4640
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4741
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
42+
4843
- name: Execute tests
4944
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build
33
composer.phar
44
composer.lock
55
.phpunit.result.cache
6+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = Finder::create()
7+
->in([
8+
__DIR__ . '/src',
9+
__DIR__ . '/tests',
10+
])
11+
->notPath('bootstrap/*')
12+
->notPath('storage/*')
13+
->notPath('resources/view/mail/*')
14+
->name('*.php')
15+
->notName('*.blade.php')
16+
->ignoreDotFiles(true)
17+
->ignoreVCS(true)
18+
;
19+
20+
return (new Config())
21+
->setRules([
22+
'@PSR2' => true,
23+
'array_syntax' => ['syntax' => 'short'],
24+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
25+
'no_unused_imports' => true,
26+
'not_operator_with_successor_space' => true,
27+
'trailing_comma_in_multiline' => true,
28+
'phpdoc_scalar' => true,
29+
'unary_operator_spaces' => true,
30+
'binary_operator_spaces' => true,
31+
'blank_line_before_statement' => [
32+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
33+
],
34+
'phpdoc_single_line_var_spacing' => true,
35+
'phpdoc_var_without_name' => true,
36+
'method_argument_space' => [
37+
'on_multiline' => 'ensure_fully_multiline',
38+
'keep_multiple_spaces_after_comma' => true,
39+
],
40+
'single_trait_insert_per_statement' => true,
41+
])
42+
->setFinder($finder);

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to `CMSMS` will be documented in this file
44

5+
## [3.0.0] - 2020-09-09
6+
#### Changed
7+
- General cleanup of package. Added return types.
8+
- Added support for Laravel 9.0
9+
- Added support for PHP 8.1
10+
- Dropped support for Laravel 8 and below.
11+
- Dropped support for PHP 8.0 and below.
12+
513
## [2.2.0] - 2020-09-09
614
#### Changed
715
- Added support for Laravel 8.0

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.2",
15+
"php": "^8.1",
1616
"ext-simplexml": "*",
17-
"guzzlehttp/guzzle": "^6.2|^7.0",
18-
"illuminate/notifications": "~5.8 || ~6.0 || ^7.0 || ^8.0",
19-
"illuminate/support": "~5.8 || ~6.0 || ^7.0 || ^8.0",
20-
"orchestra/testbench": "~3.8.0 || ^4.0 || ^5.0 || ^6.0"
17+
"guzzlehttp/guzzle": "^7.1",
18+
"illuminate/notifications": "^9.0",
19+
"illuminate/support": "^9.0"
2120
},
2221
"require-dev": {
23-
"mockery/mockery": "~1.3.1",
24-
"phpunit/phpunit": "~8.0"
22+
"mockery/mockery": "^1.5",
23+
"phpunit/phpunit": "^9.5",
24+
"orchestra/testbench": "^7.0"
2525
},
2626
"config": {
2727
"sort-packages": true

phpunit.xml.dist

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="CmsmsChannel Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="CmsmsChannel Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
2213
</phpunit>

src/CmsmsChannel.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,12 @@
88

99
class CmsmsChannel
1010
{
11-
/** @var CmsmsClient */
12-
protected $client;
13-
14-
/**
15-
* @param CmsmsClient $client
16-
*/
17-
public function __construct(CmsmsClient $client)
11+
public function __construct(
12+
protected CmsmsClient $client,
13+
)
1814
{
19-
$this->client = $client;
2015
}
2116

22-
/**
23-
* Send the given notification.
24-
*
25-
* @param mixed $notifiable
26-
* @param \Illuminate\Notifications\Notification $notification
27-
*
28-
* @throws \NotificationChannels\Cmsms\Exceptions\CouldNotSendNotification
29-
*/
3017
public function send($notifiable, Notification $notification)
3118
{
3219
if (!$recipient = $notifiable->routeNotificationFor('Cmsms')) {

src/CmsmsClient.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,14 @@ class CmsmsClient
1313
{
1414
const GATEWAY_URL = 'https://sgw01.cm.nl/gateway.ashx';
1515

16-
/** @var GuzzleClient */
17-
protected $client;
18-
19-
/** @var string */
20-
protected $productToken;
21-
22-
/**
23-
* @param GuzzleClient $client
24-
* @param string $productToken
25-
*/
26-
public function __construct(GuzzleClient $client, string $productToken)
27-
{
16+
public function __construct(
17+
protected GuzzleClient $client,
18+
protected string $productToken,
19+
) {
2820
$this->client = $client;
2921
$this->productToken = $productToken;
3022
}
3123

32-
/**
33-
* @param CmsmsMessage $message
34-
* @param string $recipient
35-
*
36-
* @throws CouldNotSendNotification
37-
*/
3824
public function send(CmsmsMessage $message, string $recipient)
3925
{
4026
if (is_null(Arr::get($message->toXmlArray(), 'FROM'))) {
@@ -56,12 +42,6 @@ public function send(CmsmsMessage $message, string $recipient)
5642
}
5743
}
5844

59-
/**
60-
* @param CmsmsMessage $message
61-
* @param string $recipient
62-
*
63-
* @return string
64-
*/
6545
public function buildMessageXml(CmsmsMessage $message, string $recipient): string
6646
{
6747
$xml = new SimpleXMLElement('<MESSAGES/>');

0 commit comments

Comments
 (0)