From 123a59fdf8a6144b46e32595596e8d8e551cbae0 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Thu, 17 Feb 2022 13:50:36 +0300 Subject: [PATCH] php 8.1 support (#138) * fix #136 php 8.1 support * update test matrix & phpstan * fix for the phpstan error that should work * lock serializer version to prevent unexpected updates --- .github/workflows/ci.yml | 2 +- .github/workflows/code_quality.yml | 2 +- composer.json | 5 +- phpstan-baseline.neon | 442 ++++++++++++++++++ phpstan.neon | 3 + .../Serializer/Annotation/ReadOnly.php | 19 - src/Component/Serializer/Parser/JMSParser.php | 4 - 7 files changed, 450 insertions(+), 27 deletions(-) create mode 100644 phpstan-baseline.neon delete mode 100644 src/Component/Serializer/Annotation/ReadOnly.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3a6d9a..012a3d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.3', '7.4', '8.0'] + php-version: ['7.3', '7.4', '8.0', '8.1'] steps: - name: Check out code into the workspace uses: actions/checkout@v2 diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 8fed489..24c1595 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -37,6 +37,6 @@ jobs: - name: Check out code into the workspace uses: actions/checkout@v2 - name: Run PHPStan - uses: docker://oskarstark/phpstan-ga:0.12.88 + uses: docker://oskarstark/phpstan-ga:1.0.1 with: args: analyse src -c phpstan.neon --memory-limit=1G --no-progress diff --git a/composer.json b/composer.json index c819015..76bd3cc 100644 --- a/composer.json +++ b/composer.json @@ -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.0.*", "php-http/httplug": "^2.2", "civicrm/composer-compile-plugin": "^0.15.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": "^0.12.74", + "phpstan/phpstan": "1.0.1", "vlucas/phpdotenv": "^5.3", "phpunit/phpunit": "^9.5", "php-http/curl-client": "^2.2", @@ -69,6 +69,7 @@ "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", "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", "lint": [ "@phpcs", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..44909bc --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,442 @@ +parameters: + ignoreErrors: + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Builder\\\\ClientBuilder\\:\\:buildHandlersChain\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Builder/ClientBuilder.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Builder\\\\FilesystemCacheBuilder\\:\\:getCacheDirPath\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Builder/FilesystemCacheBuilder.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Client\\:\\:getBaseUrl\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Client.php + + - + message: "#^Cannot access offset 'compile\\-mode' on mixed\\.$#" + count: 2 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Cannot access offset 'compile\\-whitelist' on mixed\\.$#" + count: 2 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#" + count: 3 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:PACKAGE_NAME through static\\:\\:\\.$#" + count: 5 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:activatePrompt\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:deactivatePrompt\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Command/CompilerPromptCommand.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ComposerLocator\\:\\:getBaseDirectory\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Component/ComposerLocator.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ComposerLocator\\:\\:getPackageComposerJson\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/ComposerLocator.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$fileNameAccessor \\(callable\\) on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: src/Component/FilesIteratorChecksumGenerator.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$hashFunc \\(callable\\) on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: src/Component/FilesIteratorChecksumGenerator.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$keyTransformer \\(callable\\) on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: src/Component/FilesIteratorChecksumGenerator.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\FormEncoder\\:\\:processPostSerialize\\(\\) should return array but returns mixed\\.$#" + count: 1 + path: src/Component/FormData/FormEncoder.php + + - + message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#" + count: 1 + path: src/Component/FormData/FormEncoder.php + + - + message: "#^Parameter \\#1 \\$object of method ReflectionMethod\\:\\:invokeArgs\\(\\) expects object\\|null, mixed given\\.$#" + count: 1 + path: src/Component/FormData/FormEncoder.php + + - + message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|object, class\\-string\\|false given\\.$#" + 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 + path: src/Component/FormData/Strategy/Encode/EntityStrategy.php + + - + message: "#^Parameter \\#1 \\$object of method ReflectionProperty\\:\\:getValue\\(\\) expects object\\|null, mixed given\\.$#" + count: 1 + path: src/Component/FormData/Strategy/Encode/EntityStrategy.php + + - + message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|object, class\\-string\\|false given\\.$#" + count: 1 + path: src/Component/FormData/Strategy/Encode/EntityStrategy.php + + - + 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\\.$#" + count: 1 + path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php + + - + message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\Encode\\\\TypedArrayStrategy\\:\\:\\$innerTypesMatcher through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/Encode/TypedArrayStrategy.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\Encode\\\\TypedArrayStrategy\\:\\:getInnerTypes\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/Encode/TypedArrayStrategy.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:TYPED_MATCHER through static\\:\\:\\.$#" + count: 2 + path: src/Component/FormData/Strategy/StrategyFactory.php + + - + message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:\\$simpleTypes through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/StrategyFactory.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:getArrayInnerTypes\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/StrategyFactory.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:getDateTimeFormat\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/StrategyFactory.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:isDateTime\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/FormData/Strategy/StrategyFactory.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:IGNORED_NAMESPACES through static\\:\\:\\.$#" + count: 1 + path: src/Component/ModelsGenerator.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:createDir\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/ModelsGenerator.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:isNamespaceIgnored\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/ModelsGenerator.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:\\$parent type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Component/PhpFilesIterator.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:NAMESPACE_MATCHER through static\\:\\:\\.$#" + count: 1 + path: src/Component/PhpFilesIterator.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:fromArray\\(\\) should return array\\\\|object but returns mixed\\.$#" + count: 1 + path: src/Component/Serializer/ArraySupportDecorator.php + + - + message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:decodeArray\\(\\) expects array, mixed given\\.$#" + count: 1 + path: src/Component/Serializer/ArraySupportDecorator.php + + - + message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:encodeArray\\(\\) expects array, mixed given\\.$#" + count: 1 + path: src/Component/Serializer/ArraySupportDecorator.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:getArrayValueType\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Component/Serializer/ArraySupportDecorator.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:isArrayType\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Component/Serializer/ArraySupportDecorator.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\DeserializerGenerator\\:\\:FILENAME_PREFIX through static\\:\\:\\.$#" + count: 1 + path: src/Component/Serializer/Generator/DeserializerGenerator.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: src/Component/Serializer/Generator/SerializerGenerator.php + + - + message: "#^Cannot call method getClassName\\(\\) on mixed\\.$#" + count: 1 + path: src/Component/Serializer/Generator/SerializerGenerator.php + + - + message: "#^Cannot call method getGroups\\(\\) on mixed\\.$#" + count: 3 + path: src/Component/Serializer/Generator/SerializerGenerator.php + + - + message: "#^Cannot call method getVersions\\(\\) on mixed\\.$#" + count: 1 + path: src/Component/Serializer/Generator/SerializerGenerator.php + + - + message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\SerializerGenerator\\:\\:FILENAME_PREFIX through static\\:\\:\\.$#" + count: 1 + path: src/Component/Serializer/Generator/SerializerGenerator.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ModelsChecksumGenerator\\:\\:getStoredChecksums\\(\\) should return array\\ but returns mixed\\.$#" + count: 1 + path: src/Component/Serializer/ModelsChecksumGenerator.php + + - + message: "#^Parameter \\#1 \\$iterator of class RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator constructor expects Iterator\\, 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: "#^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 \\#1 \\$object of function get_class expects object, mixed given\\.$#" + count: 2 + path: src/Component/Serializer/Parser/JMSParser.php + + - + message: "#^Parameter \\#2 \\$string2 of function strncmp expects string, class\\-string\\|false given\\.$#" + count: 1 + path: src/Component/Serializer/Parser/JMSParser.php + + - + message: "#^Parameter \\#3 \\$annotation of static method Liip\\\\MetadataParser\\\\Exception\\\\ParseException\\:\\:unsupportedPropertyAnnotation\\(\\) expects string, class\\-string\\|false given\\.$#" + 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 + path: src/Component/Serializer/Parser/JMSTypeParser.php + + - + message: "#^Parameter \\#1 \\$className of static method Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypeDateTime\\:\\:fromDateTimeClass\\(\\) expects string, mixed given\\.$#" + 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 + path: src/Component/Serializer/Parser/JMSTypeParser.php + + - + message: "#^Parameter \\#1 \\$typeName of static method Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypeDateTime\\:\\:isTypeDateTime\\(\\) expects string, mixed given\\.$#" + count: 2 + path: src/Component/Serializer/Parser/JMSTypeParser.php + + - + message: "#^Parameter \\#1 \\$typeName of static method Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypePrimitive\\:\\:isTypePrimitive\\(\\) expects string, mixed given\\.$#" + count: 1 + path: src/Component/Serializer/Parser/JMSTypeParser.php + + - + 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 + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Transformer\\\\DateTimeTransformer\\:\\:createFromFormat\\(\\) through static\\:\\:\\.$#" + count: 3 + path: src/Component/Transformer/DateTimeTransformer.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 + path: src/Factory/ApiExceptionFactory.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Model\\\\Response\\\\ErrorResponse\\:\\:\\$errors \\(array\\\\) on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: src/Factory/ApiExceptionFactory.php + + - + message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Handler\\\\Request\\\\PsrRequestHandler\\:\\:\\$methodsWithBody through static\\:\\:\\.$#" + 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 + path: src/Handler/Request/RequestDataHandler.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Request\\\\RequestDataHandler\\:\\:throwEncodeException\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Handler/Request/RequestDataHandler.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBody\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns mixed\\.$#" + count: 1 + path: src/Handler/Response/AbstractResponseHandler.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBody\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns object\\.$#" + count: 1 + path: src/Handler/Response/AbstractResponseHandler.php + + - + message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBodyArray\\(\\) should return array\\ but returns mixed\\.$#" + count: 1 + path: src/Handler/Response/AbstractResponseHandler.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:throwUnmarshalError\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Handler/Response/AbstractResponseHandler.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AccountNotFoundHandler\\:\\:isContentType\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Handler/Response/AccountNotFoundHandler.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\FilesDownloadResponseHandler\\:\\:fileNameFromDisposition\\(\\) through static\\:\\:\\.$#" + count: 1 + path: src/Handler/Response/FilesDownloadResponseHandler.php + + - + message: "#^Property RetailCrm\\\\Api\\\\Model\\\\ResponseData\\:\\:\\$responseArray \\(array\\\\) on left side of \\?\\? is not nullable\\.$#" + count: 1 + path: src/Handler/Response/UnmarshalResponseHandler.php + + - + message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Model\\\\Entity\\\\Delivery\\\\TimeInterval\\:\\:createTime\\(\\) through static\\:\\:\\.$#" + count: 2 + path: src/Model/Entity/Delivery/TimeInterval.php + + - + message: "#^Method RetailCrm\\\\Api\\\\ResourceGroup\\\\AbstractApiResourceGroup\\:\\:sendRequest\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns object\\.$#" + 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 + diff --git a/phpstan.neon b/phpstan.neon index 1494f51..d0feec5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ +includes: + - phpstan-baseline.neon # TODO: This should be removed eventually. + parameters: level: max paths: diff --git a/src/Component/Serializer/Annotation/ReadOnly.php b/src/Component/Serializer/Annotation/ReadOnly.php deleted file mode 100644 index ae84b9a..0000000 --- a/src/Component/Serializer/Annotation/ReadOnly.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @internal - */ -final class ReadOnly -{ - /** - * @var bool - */ - public $readOnly = true; -} diff --git a/src/Component/Serializer/Parser/JMSParser.php b/src/Component/Serializer/Parser/JMSParser.php index 5756f39..9034218 100644 --- a/src/Component/Serializer/Parser/JMSParser.php +++ b/src/Component/Serializer/Parser/JMSParser.php @@ -17,7 +17,6 @@ use RetailCrm\Api\Component\Serializer\Annotation\Exclude; use RetailCrm\Api\Component\Serializer\Annotation\ExclusionPolicy; use RetailCrm\Api\Component\Serializer\Annotation\Groups; use RetailCrm\Api\Component\Serializer\Annotation\PostDeserialize; -use RetailCrm\Api\Component\Serializer\Annotation\ReadOnly; use RetailCrm\Api\Component\Serializer\Annotation\SerializedName; use RetailCrm\Api\Component\Serializer\Annotation\Since; use RetailCrm\Api\Component\Serializer\Annotation\Type; @@ -330,9 +329,6 @@ class JMSParser implements ModelParserInterface case $annotation instanceof Until: $property->setVersionRange($property->getVersionRange()->withUntil($annotation->version)); break; - case $annotation instanceof ReadOnly: - $property->setReadOnly(true); - break; case $annotation instanceof SerializedName: // we handle this separately case $annotation instanceof VirtualProperty: