Skip to content

Commit

Permalink
Merge pull request #918 from mailgun/DE-1297-mailgun-sdk-php-mailgun-…
Browse files Browse the repository at this point in the history
…not-work-with-php-version-8-3

Check compatibility with php 8.3
  • Loading branch information
oleksandr-mykhailenko authored Aug 10, 2024
2 parents fc8819b + 05d3a06 commit e0293c9
Show file tree
Hide file tree
Showing 26 changed files with 299 additions and 151 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
php:
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']

runs-on: 'Ubuntu-20.04'
runs-on: 'ubuntu-latest'

steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -31,16 +31,16 @@ jobs:

lowest:
name: Lowest deps
runs-on: ubuntu-20.04
runs-on: 'ubuntu-latest'
steps:
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: 7.3
php-version: 7.4
coverage: pcov

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download dependencies
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable --prefer-lowest
Expand Down
168 changes: 83 additions & 85 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,86 @@ on: [ pull_request ]
name: Static analysis

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: phpstan:0.12.92, cs2pr

- name: Download dependencies
uses: ramsey/composer-install@v1

- name: PHPStan
run: phpstan analyze --no-progress --error-format=checkstyle | cs2pr

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: php-cs-fixer:3.9.5, cs2pr

- name: PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

psalm:
name: Psalm
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: vimeo/psalm:4.8.1

- name: Download dependencies
uses: ramsey/composer-install@v1

- name: Psalm
run: psalm --no-progress --output-format=github


roave-bc-check:
name: Roave BC Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

composer-normalize:
name: Composer Normalize
runs-on: ubuntu-20.04

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: composer-normalize

- name: Checkout code
uses: actions/checkout@v2

- name: Normalize
run: composer-normalize --dry-run
phpstan:
name: PHPStan
runs-on: 'ubuntu-latest'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: phpstan:0.12.92, cs2pr

- name: Download dependencies
uses: ramsey/composer-install@v1

- name: PHPStan
run: phpstan analyze --no-progress --error-format=checkstyle | cs2pr

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: 'ubuntu-latest'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: php-cs-fixer:3.9.5, cs2pr

- name: PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

psalm:
name: Psalm
runs-on: 'ubuntu-latest'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: vimeo/psalm:4.8.1

- name: Download dependencies
uses: ramsey/composer-install@v1

- name: Psalm
run: psalm --no-progress --output-format=github

roave-bc-check:
name: Roave BC Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

composer-normalize:
name: Composer Normalize
runs-on: ubuntu-20.04
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
tools: composer-normalize

- name: Checkout code
uses: actions/checkout@v4

- name: Normalize
run: composer-normalize --dry-run
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## 4.3.0
- End of support php 7.3
- Updated properties and added types to the classes properties
- Update code style
- Add missed field into IndexResponse for Webhooks
- Fixed template search filters
- Fixed tags API endpoints
- Added new API endpoints

## 4.2.0
- Added basic templates functionality

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ curl -sS https://getcomposer.org/installer | php
```

## Required minimum php version
- minimum php version 7.3
- minimum php version 7.4

The Mailgun API Client is not hard coupled to Guzzle, Buzz or any other library that sends
HTTP messages. Instead, it uses the [PSR-18](https://www.php-fig.org/psr/psr-18/) client abstraction.
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"php-http/client-common": "^2.2.1",
"php-http/discovery": "^1.19",
"php-http/multipart-stream-builder": "^1.1.2",
"psr/http-client": "^1.0",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.43",
"nyholm/nsa": "^1.2.1",
"nyholm/psr7": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^9.3",
"squizlabs/php_codesniffer": "^3.7",
"symfony/http-client": "^5.4 || ^6.3",
Expand All @@ -28,6 +30,7 @@
"nyholm/psr7": "PSR-7 message implementation",
"symfony/http-client": "HTTP client"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"Mailgun\\": "src/"
Expand All @@ -40,6 +43,7 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"php-http/discovery": true
}
},
Expand All @@ -49,6 +53,8 @@
}
},
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"test": "vendor/bin/phpunit"
}
}
1 change: 0 additions & 1 deletion src/Api/Suppression/Bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Mailgun\Api\HttpApi;
use Mailgun\Api\Pagination;
use Mailgun\Assert;
use Mailgun\Exception\InvalidArgumentException;
use Mailgun\Model\Suppression\Bounce\CreateResponse;
use Mailgun\Model\Suppression\Bounce\DeleteResponse;
use Mailgun\Model\Suppression\Bounce\IndexResponse;
Expand Down
8 changes: 4 additions & 4 deletions src/Mailgun.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mailgun
/**
* @var string|null
*/
private $apiKey;
private ?string $apiKey;

/**
* @var ClientInterface|PluginClient
Expand All @@ -55,19 +55,19 @@ class Mailgun
/**
* @var Hydrator
*/
private $hydrator;
private Hydrator $hydrator;

/**
* @var RequestBuilder
*/
private $requestBuilder;
private RequestBuilder $requestBuilder;

/**
* This is a object that holds the last response from the API.
*
* @var History
*/
private $responseHistory;
private History $responseHistory;

/**
* @param HttpClientConfigurator $configurator
Expand Down
10 changes: 5 additions & 5 deletions src/Message/BatchMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ class BatchMessage extends MessageBuilder
/**
* @var array
*/
private $batchRecipientAttributes = [];
private array $batchRecipientAttributes = [];

/**
* @var bool
*/
private $autoSend;
private bool $autoSend;

/**
* @var array
*/
private $messageIds = [];
private array $messageIds = [];

/**
* @var string
*/
private $domain;
private string $domain;

/**
* @var Message
*/
private $api;
private Message $api;

/**
* @param Message $messageApi
Expand Down
6 changes: 3 additions & 3 deletions src/Message/MessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ class MessageBuilder
/**
* @var array
*/
protected $message = [];
protected array $message = [];

/**
* @var array
*/
protected $variables = [];
protected array $variables = [];

/**
* @var array
*/
protected $counters = [
protected array $counters = [
'recipients' => [
'to' => 0,
'cc' => 0,
Expand Down
Loading

0 comments on commit e0293c9

Please sign in to comment.