1
0
mirror of synced 2024-11-21 21:06:07 +03:00

PHP 8.2 support

This commit is contained in:
curse89 2023-02-27 16:08:34 +03:00 committed by GitHub
parent f75a653a7d
commit 186b44b0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 80 deletions

View File

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1']
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- name: Check out code into the workspace
uses: actions/checkout@v2

View File

@ -37,6 +37,6 @@ jobs:
- name: Check out code into the workspace
uses: actions/checkout@v2
- name: Run PHPStan
uses: docker://oskarstark/phpstan-ga:1.0.1
uses: docker://oskarstark/phpstan-ga:1.8.0
with:
args: analyse src -c phpstan.neon --memory-limit=1G --no-progress

View File

@ -26,7 +26,7 @@
"php-http/message-factory": "^1.0",
"php-http/discovery": "^1.13",
"doctrine/annotations": "^1.13",
"liip/serializer": "2.0.*",
"liip/serializer": "2.2.*",
"php-http/httplug": "^2.2",
"civicrm/composer-compile-plugin": "^0.18.0",
"symfony/console": "^4.0|^5.0|^6.0",
@ -42,7 +42,7 @@
"phpmd/phpmd": "^2.10",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "1.0.1",
"phpstan/phpstan": "1.9.14",
"vlucas/phpdotenv": "^5.3",
"phpunit/phpunit": "^9.5",
"php-http/curl-client": "^2.2",
@ -67,7 +67,7 @@
"phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text",
"phpunit-ci": "@php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude=\"~vendor~\" ./vendor/bin/phpunit --teamcity -c phpunit.xml.dist",
"phpmd": "./vendor/bin/phpmd src text ./phpmd.xml",
"phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3-8.0 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.3-8.0 --warning-severity=0",
"phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3-8.2 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.3-8.2 --warning-severity=0",
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon src --memory-limit=-1",
"phpstan-dockerized-ci": "docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/phpstan-ga:1.0.1 analyse src -c phpstan.neon --memory-limit=1G --no-progress",
"lint:fix": "./vendor/bin/phpcbf src",
@ -114,7 +114,8 @@
"process-timeout": 600,
"allow-plugins": {
"civicrm/composer-compile-plugin": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true
}
}
}

View File

@ -95,11 +95,6 @@ parameters:
count: 1
path: src/Component/FormData/FormEncoder.php
-
message: "#^Parameter \\#2 \\$result of method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\FormEncoder\\:\\:processPostSerialize\\(\\) expects array, array given\\.$#"
count: 1
path: src/Component/FormData/FormEncoder.php
-
message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#"
count: 1
@ -117,16 +112,11 @@ parameters:
-
message: "#^Cannot cast mixed to float\\.$#"
count: 2
path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php
-
message: "#^Cannot cast mixed to int\\.$#"
count: 1
path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php
-
message: "#^Cannot cast mixed to string\\.$#"
message: "#^Cannot cast mixed to int\\.$#"
count: 1
path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php
@ -180,6 +170,11 @@ parameters:
count: 1
path: src/Component/ModelsGenerator.php
-
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:\\$parent \\(Iterator\\<int\\|string, array\\|string\\>\\) does not accept RegexIterator\\<mixed, mixed, Traversable\\<TKey, TValue\\>\\>\\.$#"
count: 1
path: src/Component/PhpFilesIterator.php
-
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:\\$parent type has no value type specified in iterable type array\\.$#"
count: 1
@ -196,12 +191,12 @@ parameters:
path: src/Component/Serializer/ArraySupportDecorator.php
-
message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:decodeArray\\(\\) expects array, mixed given\\.$#"
count: 1
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:getArrayValueType\\(\\) should return string but returns array\\<string\\>\\.$#"
count: 2
path: src/Component/Serializer/ArraySupportDecorator.php
-
message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:encodeArray\\(\\) expects array, mixed given\\.$#"
message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:decodeArray\\(\\) expects array, mixed given\\.$#"
count: 1
path: src/Component/Serializer/ArraySupportDecorator.php
@ -250,21 +245,41 @@ parameters:
count: 1
path: src/Component/Serializer/ModelsChecksumGenerator.php
-
message: "#^Parameter \\#1 \\$iterator of class RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator constructor expects Iterator\\<mixed, mixed\\>, RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator given\\.$#"
count: 1
path: src/Component/Serializer/ModelsChecksumGenerator.php
-
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ModelsChecksumGenerator\\:\\:getChecksumFileName\\(\\) through static\\:\\:\\.$#"
count: 4
path: src/Component/Serializer/ModelsChecksumGenerator.php
-
message: "#^Cannot cast mixed to float\\.$#"
count: 1
path: src/Component/Serializer/Parser/BaseJMSParser.php
-
message: "#^Cannot cast mixed to int\\.$#"
count: 1
path: src/Component/Serializer/Parser/BaseJMSParser.php
-
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\BaseJMSParser\\:\\:parse\\(\\) should return array but returns mixed\\.$#"
count: 1
path: src/Component/Serializer/Parser/BaseJMSParser.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 2
path: src/Component/Serializer/Parser/BaseJMSParser.php
-
message: "#^Class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSLexer extends generic class Doctrine\\\\Common\\\\Lexer\\\\AbstractLexer but does not specify its types\\: T, V$#"
count: 1
path: src/Component/Serializer/Parser/JMSLexer.php
-
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSLexer\\:\\:parse\\(\\) should return int\\|string\\|null but returns int\\|string\\|UnitEnum\\|null\\.$#"
count: 1
path: src/Component/Serializer/Parser/JMSLexer.php
-
message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#"
count: 2
@ -280,21 +295,6 @@ parameters:
count: 1
path: src/Component/Serializer/Parser/JMSParser.php
-
message: "#^Cannot access offset 0 on mixed\\.$#"
count: 2
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Cannot access offset 1 on mixed\\.$#"
count: 2
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Cannot access offset 2 on mixed\\.$#"
count: 1
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#1 \\$className of class Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypeClass constructor expects string, mixed given\\.$#"
count: 1
@ -305,16 +305,6 @@ parameters:
count: 2
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#1 \\$format of class Liip\\\\MetadataParser\\\\Metadata\\\\DateTimeOptions constructor expects string\\|null, mixed given\\.$#"
count: 1
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#1 \\$typeInfo of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSTypeParser\\:\\:parseType\\(\\) expects array, mixed given\\.$#"
count: 2
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#1 \\$typeName of class Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypePrimitive constructor expects string, mixed given\\.$#"
count: 1
@ -332,16 +322,6 @@ parameters:
-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 3
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#2 \\$zone of class Liip\\\\MetadataParser\\\\Metadata\\\\DateTimeOptions constructor expects string\\|null, mixed given\\.$#"
count: 1
path: src/Component/Serializer/Parser/JMSTypeParser.php
-
message: "#^Parameter \\#3 \\$deserializeFormat of class Liip\\\\MetadataParser\\\\Metadata\\\\DateTimeOptions constructor expects string\\|null, mixed given\\.$#"
count: 1
path: src/Component/Serializer/Parser/JMSTypeParser.php
@ -350,16 +330,21 @@ parameters:
count: 3
path: src/Component/Transformer/DateTimeTransformer.php
-
message: "#^Method RetailCrm\\\\Api\\\\Event\\\\AbstractRequestEvent\\:\\:getApiKey\\(\\) should return string but returns array\\|string\\.$#"
count: 1
path: src/Event/AbstractRequestEvent.php
-
message: "#^Property RetailCrm\\\\Api\\\\Event\\\\AbstractRequestEvent\\:\\:\\$apiKey \\(string\\) does not accept array\\|string\\.$#"
count: 1
path: src/Event/AbstractRequestEvent.php
-
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Exception\\\\ApiException\\:\\:getErrorMessage\\(\\) through static\\:\\:\\.$#"
count: 1
path: src/Exception/ApiException.php
-
message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: src/Exception/ClientException.php
-
message: "#^Property RetailCrm\\\\Api\\\\Model\\\\Response\\\\ErrorResponse\\:\\:\\$errorMsg \\(string\\) on left side of \\?\\? is not nullable\\.$#"
count: 2
@ -375,11 +360,6 @@ parameters:
count: 1
path: src/Handler/Request/PsrRequestHandler.php
-
message: "#^Parameter \\#2 \\$code of class RetailCrm\\\\Api\\\\Exception\\\\Client\\\\HandlerException constructor expects int, mixed given\\.$#"
count: 1
path: src/Handler/Request/RequestDataHandler.php
-
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Request\\\\RequestDataHandler\\:\\:queryShouldBeUsed\\(\\) through static\\:\\:\\.$#"
count: 1
@ -440,8 +420,3 @@ parameters:
count: 1
path: src/ResourceGroup/AbstractApiResourceGroup.php
-
message: "#^Parameter \\#2 \\$code of class RetailCrm\\\\Api\\\\Exception\\\\Client\\\\HttpClientException constructor expects int, mixed given\\.$#"
count: 1
path: src/ResourceGroup/AbstractApiResourceGroup.php

View File

@ -86,6 +86,7 @@ class PhpFilesIterator implements Iterator
*
* @return int|string
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->parent->key();

View File

@ -26,4 +26,12 @@ trait HistoryPageLimitTrait
* @Form\SerializedName("limit")
*/
public $limit;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("page")
*/
public $page;
}

View File

@ -36,7 +36,7 @@ class ClientBuilderTest extends TestCase
public function testNoData(): void
{
$this->expectException(BuilderException::class);
$this->expectDeprecationMessage('apiUrl must not be empty');
$this->expectExceptionMessage('apiUrl must not be empty');
(new ClientBuilder())->build();
}
@ -52,7 +52,7 @@ class ClientBuilderTest extends TestCase
public function testNoRequestTransformer(): void
{
$this->expectException(BuilderException::class);
$this->expectDeprecationMessage('Authenticator or RequestTransformer must be present');
$this->expectExceptionMessage('Authenticator or RequestTransformer must be present');
(new ClientBuilder())
->setApiUrl('https://test.retailcrm.pro')
->build();

View File

@ -135,8 +135,8 @@ EOF;
"success": true,
"loyaltyBonus": {
"amount": 100,
"activationDate": "${activationDateString}",
"expireDate": "${expireDateString}"
"activationDate": "{$activationDateString}",
"expireDate": "{$expireDateString}"
}
}
EOF;

View File

@ -185,11 +185,13 @@ abstract class AbstractApiResourceGroupTestCase extends TestCase
$result = [];
foreach ($arr as $index => $node) {
if (null === $node) {
continue;
}
$result[$index] = is_array($node) === true ? static::clearArray($node) : trim($node);
if (
'' === $result[$index] ||
null === $result[$index] ||
(is_array($result[$index]) && count($result[$index]) < 1)
) {
unset($result[$index]);