diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b65bee6..df14ea2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] steps: - name: Check out code into the workspace uses: actions/checkout@v2 diff --git a/composer.json b/composer.json index e7ec39e..73e129e 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "php": ">=7.2.0", "ext-json": "*", "psr/http-client": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.0 || ^2.0", "php-http/httplug": "^1.0 || ^2.0", "nyholm/psr7": "^1.4", "riverline/multipart-parser": "^2.0" @@ -76,7 +76,8 @@ }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "php-http/discovery": true } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4f22194..a6863b6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,11 +5,6 @@ parameters: count: 1 path: src/Client.php - - - message: "#^Method Pock\\\\Comparator\\\\ComparatorLocator\\:\\:get\\(\\) should return Pock\\\\Comparator\\\\ComparatorInterface but returns object\\.$#" - count: 1 - path: src/Comparator/ComparatorLocator.php - - message: "#^Static property Pock\\\\Comparator\\\\ComparatorLocator\\:\\:\\$comparators \\(array\\\\) does not accept array\\\\.$#" count: 1 @@ -20,21 +15,11 @@ parameters: count: 3 path: src/Comparator/ComparatorLocator.php - - - message: "#^Parameter \\#1 \\$object_or_class of function method_exists expects object\\|string, mixed given\\.$#" - count: 1 - path: src/Creator/AbstractJmsSerializerCreator.php - - message: "#^Parameter \\#2 \\$encoders of class Symfony\\\\Component\\\\Serializer\\\\Serializer constructor expects array\\, array\\ given\\.$#" count: 1 path: src/Creator/AbstractSymfonySerializerCreator.php - - - message: "#^Method Pock\\\\Factory\\\\CallbackReplyFactory\\:\\:createReply\\(\\) should return Psr\\\\Http\\\\Message\\\\ResponseInterface but returns mixed\\.$#" - count: 1 - path: src/Factory/CallbackReplyFactory.php - - message: "#^Unsafe access to private property Pock\\\\Factory\\\\JsonSerializerFactory\\:\\:\\$mainSerializer through static\\:\\:\\.$#" count: 2 @@ -46,9 +31,9 @@ parameters: path: src/Factory/XmlSerializerFactory.php - - message: "#^Method Pock\\\\Matchers\\\\CallbackRequestMatcher\\:\\:matches\\(\\) should return bool but returns mixed\\.$#" + message: "#^Parameter \\#4 \\$flags of function preg_match expects TFlags of 0\\|256\\|512\\|768, int given\\.$#" count: 1 - path: src/Matchers/CallbackRequestMatcher.php + path: src/Matchers/AbstractRegExpMatcher.php - message: "#^Unsafe call to private method Pock\\\\Matchers\\\\ExactHeadersMatcher\\:\\:headerValuesEqual\\(\\) through static\\:\\:\\.$#" @@ -66,9 +51,9 @@ parameters: path: src/Matchers/JsonBodyMatcher.php - - message: "#^Method Pock\\\\Matchers\\\\MultipartFormDataMatcher\\:\\:matches\\(\\) should return bool but returns mixed\\.$#" + message: "#^Method Pock\\\\Matchers\\\\QueryMatcher\\:\\:parseQuery\\(\\) should return array\\ but returns array\\\\.$#" count: 1 - path: src/Matchers/MultipartFormDataMatcher.php + path: src/Matchers/QueryMatcher.php - message: "#^Method Pock\\\\Matchers\\\\XmlBodyMatcher\\:\\:sortXmlTags\\(\\) should return string but returns string\\|null\\.$#" @@ -129,4 +114,3 @@ parameters: message: "#^Parameter \\#3 \\$depth of function json_encode expects int\\<1, max\\>, int given\\.$#" count: 1 path: src/PockResponseBuilder.php - diff --git a/src/Creator/AbstractJmsSerializerCreator.php b/src/Creator/AbstractJmsSerializerCreator.php index 084e37d..7786f69 100644 --- a/src/Creator/AbstractJmsSerializerCreator.php +++ b/src/Creator/AbstractJmsSerializerCreator.php @@ -36,7 +36,7 @@ abstract class AbstractJmsSerializerCreator implements SerializerCreatorInterfac $builder = call_user_func([self::BUILDER_CLASS, 'create']); if (null !== $builder && method_exists($builder, 'build')) { - return new JmsSerializerAdapter($builder->build(), static::getFormat()); // @phpstan-ignore-line + return new JmsSerializerAdapter($builder->build(), static::getFormat()); } } catch (Throwable $throwable) { return null; diff --git a/src/Matchers/BodyMatcher.php b/src/Matchers/BodyMatcher.php index eb14a9c..b1a6ae0 100644 --- a/src/Matchers/BodyMatcher.php +++ b/src/Matchers/BodyMatcher.php @@ -79,5 +79,7 @@ class BodyMatcher implements RequestMatcherInterface if (is_resource($contents)) { return static::readAllResource($contents); } + + return ''; } }