Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: 8.2
ini-values: session.save_handler=redis, session.save_path="tcp://127.0.0.1:6379"
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql
coverage: pcov
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: 8.2
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql

- name: Install dependencies
Expand All @@ -171,4 +171,7 @@ jobs:
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --using-cache=no --show-progress=dots --diff $(git diff -- '*.php' --name-only --diff-filter=ACMRTUXB "HEAD~..HEAD")

- name: Run PHPSTAN tests
run: composer phpstan
run: composer phpstan

- name: Run Rector tests
run: vendor/bin/rector process --dry-run
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Using the Mautic API Library

## Requirements
* PHP 8.0 or newer
* PHP 8.2 or newer

## Installing the API Library
You can install the API Library with the following command:
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"require": {
"php": ">=8.0",
"php": ">=8.2",
"ext-json": "*",
"psr/log": "~1.0 || ~2.0 || ~3.0",
"psr/http-client": "^1.0",
Expand All @@ -24,17 +24,18 @@
},
"require-dev": {
"kint-php/kint": "^4.1",
"friendsofphp/php-cs-fixer": "^3.73",
"friendsofphp/php-cs-fixer": "^3.93",
"phpunit/phpunit": "~9.5.0",
"guzzlehttp/guzzle": "^7.5",
"phpstan/phpstan": "^1.11"
"phpstan/phpstan": "^2.1",
"rector/rector": "^2.3"
},
"suggest": {
"guzzlehttp/guzzle": "A popular HTTP client that implements psr/http-client-implementation."
},
"scripts": {
"test": "vendor/bin/phpunit",
"phpstan": "vendor/bin/phpstan analyse"
"phpstan": "php -d memory_limit=1G vendor/bin/phpstan analyse"
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 1 addition & 1 deletion lib/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function __construct(AuthInterface $auth, $baseUrl = '')
public function getLogger()
{
// If a logger hasn't been set, use NullLogger
if (!($this->logger instanceof LoggerInterface)) {
if (!$this->logger instanceof LoggerInterface) {
$this->logger = new NullLogger();
}

Expand Down
3 changes: 1 addition & 2 deletions lib/Auth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,8 @@ protected function authorize(array $scope = [], $scope_separator = ',', $attach
if (!$this->_do_not_redirect) {
header('Location: '.$authUrl);
exit;
} else {
throw new AuthorizationRequiredException($authUrl);
}
throw new AuthorizationRequiredException($authUrl);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/lib',
__DIR__ . '/tests',
])
// uncomment to reach your current PHP version
// ->withPhpSets()
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0);
2 changes: 1 addition & 1 deletion tests/Api/CampaignsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function testAddAndRemove()

public function testBatchEndpoints()
{
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action) {
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action): void {
switch ($action) {
case 'create':
foreach ($batch as &$item) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/ContactsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function assertEventResponse($response, $expectedEvents = null)
$this->assertTrue(isset($response['filters']));

if ($expectedEvents) {
foreach ($expectedEvents as $key => $eventName) {
foreach ($expectedEvents as $eventName) {
$actual = 'oops Missing';
foreach ($response['events'] as $event) {
if ($eventName == $event['event']) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/FormsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testFieldAndActionDeleteViaPut()

public function testBatchEndpoints()
{
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action) {
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action): void {
switch ($action) {
case 'create':
foreach ($batch as &$item) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/PointTriggersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testGetEventTypes()

public function testBatchEndpoints()
{
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action) {
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action): void {
switch ($action) {
case 'create':
foreach ($batch as &$item) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/SegmentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function testAddAndRemove()

public function testBatchEndpoints()
{
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action) {
$this->standardTestBatchEndpoints(null, function ($response, &$batch, $action): void {
switch ($action) {
// Add extra values to the batch after create, as the API returns them in the response.
// This is probably related to https://github.com/mautic/mautic/pull/8649
Expand Down