From 94c65f64b24d90ab9ca2ca82f40368fa0a1d61dd Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 23 Sep 2024 15:16:34 +0200 Subject: [PATCH] Update static ci job (#432) * update static ci * update baselines * fix * test h2push better --- .github/workflows/ci.yml | 4 +- .github/workflows/static.yml | 64 ++-- .gitignore | 2 +- .php-cs-fixer.dist.php | 21 ++ .php_cs | 21 -- .scrutinizer.yml | 9 - lib/Browser.php | 8 +- lib/Client/AbstractClient.php | 2 +- lib/Client/AbstractCurl.php | 78 ++--- lib/Client/MultiCurl.php | 34 +- lib/Message/HeaderConverter.php | 4 +- lib/Message/ResponseBuilder.php | 2 +- lib/Middleware/BasicAuthMiddleware.php | 2 +- lib/Middleware/BearerAuthMiddleware.php | 2 +- lib/Middleware/ContentTypeMiddleware.php | 8 +- lib/Middleware/Cookie/Cookie.php | 10 +- lib/Middleware/Cookie/CookieJar.php | 2 +- lib/Middleware/DigestAuthMiddleware.php | 32 +- lib/Middleware/History/Journal.php | 2 +- lib/Middleware/LoggerMiddleware.php | 7 +- lib/Middleware/WsseAuthMiddleware.php | 2 +- phpstan-baseline.neon | 304 +++++++++--------- phpstan.neon.dist | 3 +- psalm.baseline | 230 ------------- psalm.baseline.xml | 301 +++++++++++++++++ psalm.xml | 2 +- tests/Integration/BuzzIntegrationTest.php | 4 +- .../Httplug/CurlIntegrationTest.php | 2 + .../Httplug/MultiCurlIntegrationTest.php | 2 + .../Middleware/ContentTypeMiddlewareTest.php | 14 +- .../Middleware/DigestAuthListenerTest.php | 2 +- .../Unit/Middleware/LoggerMiddlewareTest.php | 3 - 32 files changed, 638 insertions(+), 545 deletions(-) create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .php_cs delete mode 100644 .scrutinizer.yml delete mode 100644 psalm.baseline create mode 100644 psalm.baseline.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ba4d7b6..c920d3c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@2.1.0 with: - php-version: 7.4 + php-version: 8.2 tools: flex - name: Checkout code @@ -122,7 +122,7 @@ jobs: - name: Run tests run: | - docker run --rm --net buzz-bridge -v "$PWD":/usr/src/myapp -w /usr/src/myapp -e BUZZ_TEST_SERVER=http://test-server/index.php php:7.4-cli php vendor/bin/phpunit + docker run --rm --net buzz-bridge -v "$PWD":/usr/src/myapp -w /usr/src/myapp -e BUZZ_TEST_SERVER=http://test-server/index.php php:8.2-cli php vendor/bin/phpunit lowest: name: Lowest deps diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 70145885..b94fd509 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,7 +1,6 @@ +on: [ pull_request ] name: Static analysis -on: [push, pull_request] - jobs: phpstan: name: PHPStan @@ -9,39 +8,60 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + extensions: apcu, redis + coverage: none + tools: phpstan:1.12, cs2pr - name: Download dependencies - run: | - composer update --no-interaction --prefer-dist --optimize-autoloader + uses: ramsey/composer-install@v2 - name: PHPStan - uses: docker://oskarstark/phpstan-ga - with: - entrypoint: /composer/vendor/bin/phpstan - args: analyze --no-progress + run: phpstan analyze --no-progress --error-format=checkstyle | cs2pr - php-cs-fixer: - name: PHP-CS-Fixer + psalm: + name: Psalm runs-on: ubuntu-latest - steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: --dry-run --diff-format udiff + php-version: 8.3 + extensions: apcu, redis + coverage: none + tools: vimeo/psalm:5.26 - psalm: - name: Psalm + - name: Download dependencies + uses: ramsey/composer-install@v2 + + - name: Psalm + run: psalm --no-progress --output-format=github + + php-cs-fixer: + name: PHP-CS-Fixer runs-on: ubuntu-latest + steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Psalm - uses: docker://vimeo/psalm-github-actions + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: --no-progress --show-info=false --stats + php-version: 8.3 + coverage: none + tools: php-cs-fixer:3.64, cs2pr + + - name: Display PHP-CS-Fixer version + run: sleep 1 && php-cs-fixer --version + + - name: PHP-CS-Fixer + run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr diff --git a/.gitignore b/.gitignore index b4220d63..4775f053 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.php_cs.cache +.php-cs-fixer.cache bin composer.lock composer.phar diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..53479f99 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,21 @@ +in(__DIR__ . '/lib') + ->in(__DIR__ . '/tests') + ->exclude('vendor') + ->name('*.php'); + +return (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => array('syntax' => 'short'), + 'protected_to_private' => false, + 'declare_strict_types' => true, + 'no_superfluous_phpdoc_tags' => true, + 'nullable_type_declaration_for_default_null_value' => false, + 'modernize_strpos' => false, + ]) + ->setFinder($finder); diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 90313737..00000000 --- a/.php_cs +++ /dev/null @@ -1,21 +0,0 @@ -setRules(array( - '@Symfony' => true, - '@Symfony:risky' => true, - 'array_syntax' => array('syntax' => 'short'), - 'protected_to_private' => false, - 'declare_strict_types' => true, - 'no_superfluous_phpdoc_tags' => true, - )) - ->setRiskyAllowed(true) - ->setCacheFile((getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__).'/.php_cs.cache') - ->setUsingCache(true) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__) - ->exclude('vendor') - ->name('*.php') - ) -; \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index d92b5c69..00000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,9 +0,0 @@ -filter: - excluded_paths: [vendor/*, tests/*, lib/Middleware/DigestAuthMiddleware.php] - -checks: - php: - code_rating: true - duplication: true -tools: - external_code_coverage: true diff --git a/lib/Browser.php b/lib/Browser.php index 84785212..006e875c 100644 --- a/lib/Browser.php +++ b/lib/Browser.php @@ -39,7 +39,7 @@ class Browser implements BuzzClientInterface public function __construct(BuzzClientInterface $client, $requestFactory) { if (!$requestFactory instanceof RequestFactoryInterface && !$requestFactory instanceof RequestFactory) { - throw new InvalidArgumentException(sprintf('Second argument of %s must be an instance of %s or %s.', __CLASS__, RequestFactoryInterface::class, RequestFactory::class)); + throw new InvalidArgumentException(\sprintf('Second argument of %s must be an instance of %s or %s.', __CLASS__, RequestFactoryInterface::class, RequestFactory::class)); } $this->client = $client; @@ -222,9 +222,9 @@ private function prepareMultipart(string $name, string $content, string $boundar $fileHeaders = []; // Set a default content-disposition header - $fileHeaders['Content-Disposition'] = sprintf('form-data; name="%s"', $name); + $fileHeaders['Content-Disposition'] = \sprintf('form-data; name="%s"', $name); if (isset($data['filename'])) { - $fileHeaders['Content-Disposition'] .= sprintf('; filename="%s"', $data['filename']); + $fileHeaders['Content-Disposition'] .= \sprintf('; filename="%s"', $data['filename']); } // Set a default content-length header @@ -239,7 +239,7 @@ private function prepareMultipart(string $name, string $content, string $boundar // Add start $output .= "--$boundary\r\n"; foreach ($fileHeaders as $key => $value) { - $output .= sprintf("%s: %s\r\n", $key, $value); + $output .= \sprintf("%s: %s\r\n", $key, $value); } $output .= "\r\n"; $output .= $content; diff --git a/lib/Client/AbstractClient.php b/lib/Client/AbstractClient.php index e63abb9a..a190c689 100644 --- a/lib/Client/AbstractClient.php +++ b/lib/Client/AbstractClient.php @@ -33,7 +33,7 @@ abstract class AbstractClient public function __construct($responseFactory, array $options = []) { if (!$responseFactory instanceof ResponseFactoryInterface && !$responseFactory instanceof ResponseFactory) { - throw new InvalidArgumentException(sprintf('First argument of %s must be an instance of %s or %s.', __CLASS__, ResponseFactoryInterface::class, ResponseFactory::class)); + throw new InvalidArgumentException(\sprintf('First argument of %s must be an instance of %s or %s.', __CLASS__, ResponseFactoryInterface::class, ResponseFactory::class)); } $this->options = new ParameterBag(); diff --git a/lib/Client/AbstractCurl.php b/lib/Client/AbstractCurl.php index a0213e19..be6293d2 100644 --- a/lib/Client/AbstractCurl.php +++ b/lib/Client/AbstractCurl.php @@ -64,10 +64,10 @@ protected function releaseHandle($curl): void // and are not cleaned up by curl_reset. Using curl_setopt_array // does not work for some reason, so removing each one // individually. - curl_setopt($curl, CURLOPT_HEADERFUNCTION, null); - curl_setopt($curl, CURLOPT_READFUNCTION, null); - curl_setopt($curl, CURLOPT_WRITEFUNCTION, null); - curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, null); + curl_setopt($curl, \CURLOPT_HEADERFUNCTION, null); + curl_setopt($curl, \CURLOPT_READFUNCTION, null); + curl_setopt($curl, \CURLOPT_WRITEFUNCTION, null); + curl_setopt($curl, \CURLOPT_PROGRESSFUNCTION, null); curl_reset($curl); if (!\in_array($curl, $this->handles)) { @@ -84,19 +84,19 @@ protected function releaseHandle($curl): void protected function prepare($curl, RequestInterface $request, ParameterBag $options): ResponseBuilder { if (\defined('CURLOPT_PROTOCOLS')) { - curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); - curl_setopt($curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + curl_setopt($curl, \CURLOPT_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS); + curl_setopt($curl, \CURLOPT_REDIR_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS); } - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, false); - curl_setopt($curl, CURLOPT_FAILONERROR, false); + curl_setopt($curl, \CURLOPT_HEADER, false); + curl_setopt($curl, \CURLOPT_RETURNTRANSFER, false); + curl_setopt($curl, \CURLOPT_FAILONERROR, false); $this->setOptionsFromParameterBag($curl, $options); $this->setOptionsFromRequest($curl, $request); $responseBuilder = new ResponseBuilder($this->responseFactory); - curl_setopt($curl, CURLOPT_HEADERFUNCTION, function ($ch, $data) use ($responseBuilder) { + curl_setopt($curl, \CURLOPT_HEADERFUNCTION, function ($ch, $data) use ($responseBuilder) { $str = trim($data); if ('' !== $str) { if (0 === strpos(strtolower($str), 'http/')) { @@ -109,7 +109,7 @@ protected function prepare($curl, RequestInterface $request, ParameterBag $optio return \strlen($data); }); - curl_setopt($curl, CURLOPT_WRITEFUNCTION, function ($ch, $data) use ($responseBuilder) { + curl_setopt($curl, \CURLOPT_WRITEFUNCTION, function ($ch, $data) use ($responseBuilder) { return $responseBuilder->writeBody($data); }); @@ -128,27 +128,27 @@ protected function prepare($curl, RequestInterface $request, ParameterBag $optio private function setOptionsFromRequest($curl, RequestInterface $request): void { $options = [ - CURLOPT_CUSTOMREQUEST => $request->getMethod(), - CURLOPT_URL => $request->getUri()->__toString(), - CURLOPT_HTTPHEADER => HeaderConverter::toBuzzHeaders($request->getHeaders()), + \CURLOPT_CUSTOMREQUEST => $request->getMethod(), + \CURLOPT_URL => $request->getUri()->__toString(), + \CURLOPT_HTTPHEADER => HeaderConverter::toBuzzHeaders($request->getHeaders()), ]; if (0 !== $version = $this->getProtocolVersion($request)) { - $options[CURLOPT_HTTP_VERSION] = $version; + $options[\CURLOPT_HTTP_VERSION] = $version; } if ($request->getUri()->getUserInfo()) { - $options[CURLOPT_USERPWD] = $request->getUri()->getUserInfo(); + $options[\CURLOPT_USERPWD] = $request->getUri()->getUserInfo(); } switch (strtoupper($request->getMethod())) { case 'HEAD': - $options[CURLOPT_NOBODY] = true; + $options[\CURLOPT_NOBODY] = true; break; case 'GET': - $options[CURLOPT_HTTPGET] = true; + $options[\CURLOPT_HTTPGET] = true; break; @@ -167,16 +167,16 @@ private function setOptionsFromRequest($curl, RequestInterface $request): void // Message has non empty body. if (null === $bodySize || $bodySize > 1024 * 1024) { // Avoid full loading large or unknown size body into memory - $options[CURLOPT_UPLOAD] = true; + $options[\CURLOPT_UPLOAD] = true; if (null !== $bodySize) { - $options[CURLOPT_INFILESIZE] = $bodySize; + $options[\CURLOPT_INFILESIZE] = $bodySize; } - $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + $options[\CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { return $body->read($length); }; } else { // Small body can be loaded into memory - $options[CURLOPT_POSTFIELDS] = (string) $body; + $options[\CURLOPT_POSTFIELDS] = (string) $body; } } } @@ -190,16 +190,16 @@ private function setOptionsFromRequest($curl, RequestInterface $request): void private function setOptionsFromParameterBag($curl, ParameterBag $options): void { if (null !== $proxy = $options->get('proxy')) { - curl_setopt($curl, CURLOPT_PROXY, $proxy); + curl_setopt($curl, \CURLOPT_PROXY, $proxy); } - $canFollow = !ini_get('safe_mode') && !ini_get('open_basedir') && $options->get('allow_redirects'); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, $canFollow); - curl_setopt($curl, CURLOPT_MAXREDIRS, $canFollow ? $options->get('max_redirects') : 0); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $options->get('verify') ? 1 : 0); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $options->get('verify') ? 2 : 0); + $canFollow = !\ini_get('safe_mode') && !\ini_get('open_basedir') && $options->get('allow_redirects'); + curl_setopt($curl, \CURLOPT_FOLLOWLOCATION, $canFollow); + curl_setopt($curl, \CURLOPT_MAXREDIRS, $canFollow ? $options->get('max_redirects') : 0); + curl_setopt($curl, \CURLOPT_SSL_VERIFYPEER, $options->get('verify') ? 1 : 0); + curl_setopt($curl, \CURLOPT_SSL_VERIFYHOST, $options->get('verify') ? 2 : 0); if (0 < $options->get('timeout')) { - curl_setopt($curl, CURLOPT_TIMEOUT, $options->get('timeout')); + curl_setopt($curl, \CURLOPT_TIMEOUT, $options->get('timeout')); } } @@ -213,16 +213,16 @@ private function setOptionsFromParameterBag($curl, ParameterBag $options): void protected function parseError(RequestInterface $request, int $errno, $curl): void { switch ($errno) { - case CURLE_OK: + case \CURLE_OK: // All OK, create a response object break; - case CURLE_COULDNT_RESOLVE_PROXY: - case CURLE_COULDNT_RESOLVE_HOST: - case CURLE_COULDNT_CONNECT: - case CURLE_OPERATION_TIMEOUTED: - case CURLE_SSL_CONNECT_ERROR: + case \CURLE_COULDNT_RESOLVE_PROXY: + case \CURLE_COULDNT_RESOLVE_HOST: + case \CURLE_COULDNT_CONNECT: + case \CURLE_OPERATION_TIMEOUTED: + case \CURLE_SSL_CONNECT_ERROR: throw new NetworkException($request, curl_error($curl), $errno); - case CURLE_ABORTED_BY_CALLBACK: + case \CURLE_ABORTED_BY_CALLBACK: throw new CallbackException($request, curl_error($curl), $errno); default: throw new RequestException($request, curl_error($curl), $errno); @@ -233,12 +233,12 @@ private function getProtocolVersion(RequestInterface $request): int { switch ($request->getProtocolVersion()) { case '1.0': - return CURL_HTTP_VERSION_1_0; + return \CURL_HTTP_VERSION_1_0; case '1.1': - return CURL_HTTP_VERSION_1_1; + return \CURL_HTTP_VERSION_1_1; case '2.0': if (\defined('CURL_HTTP_VERSION_2_0')) { - return CURL_HTTP_VERSION_2_0; + return \CURL_HTTP_VERSION_2_0; } throw new \UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support'); diff --git a/lib/Client/MultiCurl.php b/lib/Client/MultiCurl.php index 01785b55..fc25bd63 100644 --- a/lib/Client/MultiCurl.php +++ b/lib/Client/MultiCurl.php @@ -57,11 +57,11 @@ public function __construct($responseFactory, array $options = []) parent::__construct($responseFactory, $options); if ( - \PHP_VERSION_ID < 70215 || - \PHP_VERSION_ID === 70300 || - \PHP_VERSION_ID === 70301 || - \PHP_VERSION_ID >= 80000 || - !(CURL_VERSION_HTTP2 & curl_version()['features']) + \PHP_VERSION_ID < 70215 + || \PHP_VERSION_ID === 70300 + || \PHP_VERSION_ID === 70301 + || \PHP_VERSION_ID >= 80000 + || !(\CURL_VERSION_HTTP2 & curl_version()['features']) ) { // Dont use HTTP/2 push when it's unsupported or buggy, see https://bugs.php.net/76675 $this->serverPushSupported = false; @@ -126,7 +126,7 @@ protected function configureOptions(OptionsResolver $resolver): void $resolver->setAllowedTypes('callback', 'callable'); $resolver->setDefault('push_function_callback', function ($parent, $pushed, $headers) { - return CURL_PUSH_OK; + return \CURL_PUSH_OK; }); $resolver->setAllowedTypes('push_function_callback', ['callable', 'null']); @@ -175,11 +175,11 @@ public function proceed(): void do { // Start processing each handler in the stack $mrc = curl_multi_exec($this->curlm, $stillRunning); - } while (CURLM_CALL_MULTI_PERFORM === $mrc); + } while (\CURLM_CALL_MULTI_PERFORM === $mrc); while ($info = curl_multi_info_read($this->curlm)) { // handle any completed requests - if (CURLMSG_DONE !== $info['msg']) { + if (\CURLMSG_DONE !== $info['msg']) { continue; } @@ -233,7 +233,7 @@ private function addPushHandle($headers, $handle) if (0 === strpos($header, ':path:')) { $path = substr($header, 6); $url = (string) curl_getinfo($handle)['url']; - $url = str_replace((string) parse_url($url, PHP_URL_PATH), $path, $url); + $url = str_replace((string) parse_url($url, \PHP_URL_PATH), $path, $url); $this->pushResponseHandles[$url] = $handle; break; } @@ -256,7 +256,7 @@ private function handlePushedResponse($handle) $content = curl_multi_getcontent($handle); // Check if we got some headers, if not, we do not bother to store it. - if (0 !== $headerSize = curl_getinfo($handle, CURLINFO_HEADER_SIZE)) { + if (0 !== $headerSize = curl_getinfo($handle, \CURLINFO_HEADER_SIZE)) { $this->pushedResponses[$found] = ['content' => $content, 'headerSize' => $headerSize]; unset($this->pushResponseHandles[$found]); } @@ -297,24 +297,24 @@ private function initMultiCurlHandle(): void if ($this->serverPushSupported) { $userCallbacks = $this->pushFunctions; - curl_multi_setopt($this->curlm, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); + curl_multi_setopt($this->curlm, \CURLMOPT_PIPELINING, \CURLPIPE_MULTIPLEX); // We need to use $this->pushCb[] because of a bug in PHP curl_multi_setopt( $this->curlm, - CURLMOPT_PUSHFUNCTION, + \CURLMOPT_PUSHFUNCTION, $this->pushCb[] = function ($parent, $pushed, $headers) use ($userCallbacks) { // If any callback say no, then do not accept. foreach ($userCallbacks as $callback) { - if (CURL_PUSH_DENY === $callback($parent, $pushed, $headers)) { - return CURL_PUSH_DENY; + if (\CURL_PUSH_DENY === $callback($parent, $pushed, $headers)) { + return \CURL_PUSH_DENY; } } - curl_setopt($pushed, CURLOPT_RETURNTRANSFER, true); - curl_setopt($pushed, CURLOPT_HEADER, true); + curl_setopt($pushed, \CURLOPT_RETURNTRANSFER, true); + curl_setopt($pushed, \CURLOPT_HEADER, true); $this->addPushHandle($headers, $pushed); - return CURL_PUSH_OK; + return \CURL_PUSH_OK; } ); } diff --git a/lib/Message/HeaderConverter.php b/lib/Message/HeaderConverter.php index e8514c2f..a5c0d2cd 100644 --- a/lib/Message/HeaderConverter.php +++ b/lib/Message/HeaderConverter.php @@ -30,10 +30,10 @@ public static function toBuzzHeaders(array $headers): array foreach ($headers as $key => $values) { if (!\is_array($values)) { - $buzz[] = sprintf('%s: %s', $key, $values); + $buzz[] = \sprintf('%s: %s', $key, $values); } else { foreach ($values as $value) { - $buzz[] = sprintf('%s: %s', $key, $value); + $buzz[] = \sprintf('%s: %s', $key, $value); } } } diff --git a/lib/Message/ResponseBuilder.php b/lib/Message/ResponseBuilder.php index 49b9f008..1f4529dd 100644 --- a/lib/Message/ResponseBuilder.php +++ b/lib/Message/ResponseBuilder.php @@ -68,7 +68,7 @@ public function setStatus(string $input): void { $parts = explode(' ', $input, 3); if (\count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid HTTP status line', $input)); + throw new InvalidArgumentException(\sprintf('"%s" is not a valid HTTP status line', $input)); } $this->response = $this->response->withStatus((int) $parts[1], isset($parts[2]) ? $parts[2] : ''); diff --git a/lib/Middleware/BasicAuthMiddleware.php b/lib/Middleware/BasicAuthMiddleware.php index 3de788bc..93deceb9 100644 --- a/lib/Middleware/BasicAuthMiddleware.php +++ b/lib/Middleware/BasicAuthMiddleware.php @@ -20,7 +20,7 @@ public function __construct(string $username, string $password) public function handleRequest(RequestInterface $request, callable $next) { - $request = $request->withAddedHeader('Authorization', sprintf('Basic %s', base64_encode($this->username.':'.$this->password))); + $request = $request->withAddedHeader('Authorization', \sprintf('Basic %s', base64_encode($this->username.':'.$this->password))); return $next($request); } diff --git a/lib/Middleware/BearerAuthMiddleware.php b/lib/Middleware/BearerAuthMiddleware.php index e901319b..d4610c80 100644 --- a/lib/Middleware/BearerAuthMiddleware.php +++ b/lib/Middleware/BearerAuthMiddleware.php @@ -23,7 +23,7 @@ public function __construct(string $accessToken) public function handleRequest(RequestInterface $request, callable $next) { - $request = $request->withAddedHeader('Authorization', sprintf('Bearer %s', $this->accessToken)); + $request = $request->withAddedHeader('Authorization', \sprintf('Bearer %s', $this->accessToken)); return $next($request); } diff --git a/lib/Middleware/ContentTypeMiddleware.php b/lib/Middleware/ContentTypeMiddleware.php index 79db51d0..805d731f 100644 --- a/lib/Middleware/ContentTypeMiddleware.php +++ b/lib/Middleware/ContentTypeMiddleware.php @@ -31,9 +31,9 @@ class ContentTypeMiddleware implements MiddlewareInterface /** * @param array $config { * - * @var bool $skip_detection True skip detection if stream size is bigger than $size_limit - * @var int $size_limit size stream limit for which the detection as to be skipped. - * } + * @var bool $skip_detection True skip detection if stream size is bigger than $size_limit + * @var int $size_limit size stream limit for which the detection as to be skipped. + * } */ public function __construct(array $config = []) { @@ -91,7 +91,7 @@ private function isJson(StreamInterface $stream): bool $stream->rewind(); json_decode($stream->getContents()); - return JSON_ERROR_NONE === json_last_error(); + return \JSON_ERROR_NONE === json_last_error(); } private function isXml(StreamInterface $stream): bool diff --git a/lib/Middleware/Cookie/Cookie.php b/lib/Middleware/Cookie/Cookie.php index 04c90444..b413f847 100644 --- a/lib/Middleware/Cookie/Cookie.php +++ b/lib/Middleware/Cookie/Cookie.php @@ -8,15 +8,15 @@ class Cookie { - const ATTR_DOMAIN = 'domain'; + public const ATTR_DOMAIN = 'domain'; - const ATTR_PATH = 'path'; + public const ATTR_PATH = 'path'; - const ATTR_SECURE = 'secure'; + public const ATTR_SECURE = 'secure'; - const ATTR_MAX_AGE = 'max-age'; + public const ATTR_MAX_AGE = 'max-age'; - const ATTR_EXPIRES = 'expires'; + public const ATTR_EXPIRES = 'expires'; protected $name; diff --git a/lib/Middleware/Cookie/CookieJar.php b/lib/Middleware/Cookie/CookieJar.php index c0ca23be..41e006f8 100644 --- a/lib/Middleware/Cookie/CookieJar.php +++ b/lib/Middleware/Cookie/CookieJar.php @@ -94,7 +94,7 @@ public function clearExpiredCookies(): void */ private function getHash(Cookie $cookie): string { - return sha1(sprintf( + return sha1(\sprintf( '%s|%s|%s', $cookie->getName(), $cookie->getAttribute(Cookie::ATTR_DOMAIN), diff --git a/lib/Middleware/DigestAuthMiddleware.php b/lib/Middleware/DigestAuthMiddleware.php index dfcb7787..b84c28c4 100644 --- a/lib/Middleware/DigestAuthMiddleware.php +++ b/lib/Middleware/DigestAuthMiddleware.php @@ -43,20 +43,20 @@ class DigestAuthMiddleware implements MiddlewareInterface * OPTION_QOP_AUTH_INT - Always use auth-int (if available) * OPTION_QOP_AUTH - Always use auth (even if auth-int available). */ - const OPTION_QOP_AUTH_INT = 1; + public const OPTION_QOP_AUTH_INT = 1; - const OPTION_QOP_AUTH = 2; + public const OPTION_QOP_AUTH = 2; /** * Ignore server request to downgrade authentication from Digest to Basic. * Breaks RFC compatibility, but ensures passwords are never sent using base64 which is trivial for an attacker to decode. */ - const OPTION_IGNORE_DOWNGRADE_REQUEST = 4; + public const OPTION_IGNORE_DOWNGRADE_REQUEST = 4; /** * Discard Client Nonce on each request. */ - const OPTION_DISCARD_CLIENT_NONCE = 8; + public const OPTION_DISCARD_CLIENT_NONCE = 8; private $options; @@ -142,17 +142,17 @@ public function setOptions($options): void if ($options & self::OPTION_QOP_AUTH) { throw new \InvalidArgumentException('DigestAuthMiddleware: Only one value of OPTION_QOP_AUTH_INT or OPTION_QOP_AUTH may be set.'); } - $this->options = $this->options | self::OPTION_QOP_AUTH_INT; + $this->options |= self::OPTION_QOP_AUTH_INT; } elseif ($options & self::OPTION_QOP_AUTH) { - $this->options = $this->options | self::OPTION_QOP_AUTH; + $this->options |= self::OPTION_QOP_AUTH; } if ($options & self::OPTION_IGNORE_DOWNGRADE_REQUEST) { - $this->options = $this->options | self::OPTION_IGNORE_DOWNGRADE_REQUEST; + $this->options |= self::OPTION_IGNORE_DOWNGRADE_REQUEST; } if ($options & self::OPTION_DISCARD_CLIENT_NONCE) { - $this->options = $this->options | self::OPTION_DISCARD_CLIENT_NONCE; + $this->options |= self::OPTION_DISCARD_CLIENT_NONCE; } } @@ -252,7 +252,7 @@ private function getHA1(): ?string $password = $this->getPassword(); $realm = $this->getRealm(); - if (($username) && ($password) && ($realm)) { + if ($username && $password && $realm) { $algorithm = $this->getAlgorithm(); if ('MD5' === $algorithm) { @@ -262,7 +262,7 @@ private function getHA1(): ?string } elseif ('MD5-sess' === $algorithm) { $nonce = $this->getNonce(); $cnonce = $this->getClientNonce(); - if (($nonce) && ($cnonce)) { + if ($nonce && $cnonce) { $A1 = $this->hash("{$username}:{$realm}:{$password}").":{$nonce}:{$cnonce}"; return $this->hash($A1); @@ -283,7 +283,7 @@ private function getHA2(): ?string $method = $this->getMethod(); $uri = $this->getUri(); - if (($method) && ($uri)) { + if ($method && $uri) { $qop = $this->getQOP(); if (null === $qop || 'auth' === $qop) { @@ -315,7 +315,7 @@ private function getHeader(): ?string $realm = $this->getRealm(); $nonce = $this->getNonce(); $response = $this->getResponse(); - if (($username) && ($realm) && ($nonce) && ($response)) { + if ($username && $realm && $nonce && $response) { $uri = $this->getUri(); $opaque = $this->getOpaque(); $qop = $this->getQOP(); @@ -360,7 +360,7 @@ private function getHeader(): ?string if ('Basic' == $this->getAuthenticationMethod()) { $username = $this->getUsername(); $password = $this->getPassword(); - if (($username) && ($password)) { + if ($username && $password) { $header = 'Basic '.base64_encode("{$username}:{$password}"); return $header; @@ -442,7 +442,7 @@ private function getResponse(): ?string $nonce = $this->getNonce(); $HA2 = $this->getHA2(); - if (null !== $HA1 && ($nonce) && null !== $HA2) { + if (null !== $HA1 && $nonce && null !== $HA2) { $qop = $this->getQOP(); if (empty($qop)) { @@ -453,7 +453,7 @@ private function getResponse(): ?string $cnonce = $this->getClientNonce(); $nc = $this->getNonceCount(); - if (($cnonce) && ($nc)) { + if ($cnonce && $nc) { $response = $this->hash("{$HA1}:{$nonce}:{$nc}:{$cnonce}:{$qop}:{$HA2}"); return $response; @@ -489,6 +489,7 @@ private function getQOP(): ?string } } } + // Server has not specified any value for Quality of Protection so return null return null; } @@ -541,7 +542,6 @@ private function parseAuthenticationInfoHeader(string $authenticationInfo): void foreach ($nameValuePairs as $name => $value) { switch ($name) { case 'message-qop': - break; case 'nextnonce': // This function needs to only set the Nonce once the rspauth has been verified. diff --git a/lib/Middleware/History/Journal.php b/lib/Middleware/History/Journal.php index 0ce406ff..f18fec11 100644 --- a/lib/Middleware/History/Journal.php +++ b/lib/Middleware/History/Journal.php @@ -32,7 +32,7 @@ public function record(RequestInterface $request, ResponseInterface $response, f public function addEntry(Entry $entry): void { - array_push($this->entries, $entry); + $this->entries[] = $entry; $this->entries = \array_slice($this->entries, $this->getLimit() * -1); end($this->entries); } diff --git a/lib/Middleware/LoggerMiddleware.php b/lib/Middleware/LoggerMiddleware.php index 94ce14bc..b4f8f520 100644 --- a/lib/Middleware/LoggerMiddleware.php +++ b/lib/Middleware/LoggerMiddleware.php @@ -20,9 +20,8 @@ class LoggerMiddleware implements MiddlewareInterface private $startTime; /** - * @param LoggerInterface $logger - * @param string $level - * @param string|null $prefix + * @param string $level + * @param string|null $prefix */ public function __construct(LoggerInterface $logger = null, $level = 'info', $prefix = null) { @@ -41,7 +40,7 @@ public function handleRequest(RequestInterface $request, callable $next) public function handleResponse(RequestInterface $request, ResponseInterface $response, callable $next) { $seconds = microtime(true) - $this->startTime; - $this->logger->log($this->level, sprintf('%sSent "%s %s" in %dms', $this->prefix, $request->getMethod(), $request->getUri(), round($seconds * 1000))); + $this->logger->log($this->level, \sprintf('%sSent "%s %s" in %dms', $this->prefix, $request->getMethod(), $request->getUri(), round($seconds * 1000))); return $next($request, $response); } diff --git a/lib/Middleware/WsseAuthMiddleware.php b/lib/Middleware/WsseAuthMiddleware.php index ea5849e6..34d75518 100644 --- a/lib/Middleware/WsseAuthMiddleware.php +++ b/lib/Middleware/WsseAuthMiddleware.php @@ -24,7 +24,7 @@ public function handleRequest(RequestInterface $request, callable $next) $created = date('c'); $digest = base64_encode(sha1(base64_decode($nonce).$created.$this->password, true)); - $wsse = sprintf( + $wsse = \sprintf( 'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"', $this->username, $digest, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 31058bf8..54431588 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,47 +1,47 @@ parameters: ignoreErrors: - - message: "#^Method Buzz\\\\Browser\\:\\:get\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:post\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:delete\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:head\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:get\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:patch\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:head\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:put\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:patch\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:delete\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:post\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:request\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:prepareMultipart\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:submitForm\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:put\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:submitForm\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:request\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php @@ -51,22 +51,22 @@ parameters: path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:prepareMultipart\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:submitForm\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Method Buzz\\\\Browser\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Browser\\:\\:submitForm\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Browser.php - - message: "#^Property Buzz\\\\Client\\\\AbstractClient\\:\\:\\$options type has no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/AbstractClient.php - - message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:doValidateOptions\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/AbstractClient.php @@ -76,37 +76,37 @@ parameters: path: lib/Client/AbstractClient.php - - message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:validateOptions\\(\\) return type has no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Parameter \\#1 \\$handle of function curl_close expects CurlHandle, resource given\\.$#" count: 1 - path: lib/Client/AbstractClient.php + path: lib/Client/AbstractCurl.php - - message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:doValidateOptions\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: lib/Client/AbstractClient.php + message: "#^Parameter \\#1 \\$handle of function curl_error expects CurlHandle, resource given\\.$#" + count: 3 + path: lib/Client/AbstractCurl.php - - message: "#^Method Buzz\\\\Client\\\\AbstractClient\\:\\:doValidateOptions\\(\\) return type has no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Parameter \\#1 \\$handle of function curl_reset expects CurlHandle, resource given\\.$#" count: 1 - path: lib/Client/AbstractClient.php + path: lib/Client/AbstractCurl.php - - message: "#^Property Buzz\\\\Client\\\\AbstractCurl\\:\\:\\$handles has no typehint specified\\.$#" - count: 1 + message: "#^Parameter \\#1 \\$handle of function curl_setopt expects CurlHandle, resource given\\.$#" + count: 17 path: lib/Client/AbstractCurl.php - - message: "#^Property Buzz\\\\Client\\\\AbstractCurl\\:\\:\\$maxHandles has no typehint specified\\.$#" - count: 1 + message: "#^Parameter \\#1 \\$handle of function curl_setopt_array expects CurlHandle, resource given\\.$#" + count: 2 path: lib/Client/AbstractCurl.php - - message: "#^Method Buzz\\\\Client\\\\AbstractCurl\\:\\:prepare\\(\\) has parameter \\$options with no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Property Buzz\\\\Client\\\\AbstractCurl\\:\\:\\$handles has no type specified\\.$#" count: 1 path: lib/Client/AbstractCurl.php - - message: "#^Method Buzz\\\\Client\\\\AbstractCurl\\:\\:setOptionsFromParameterBag\\(\\) has parameter \\$options with no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Property Buzz\\\\Client\\\\AbstractCurl\\:\\:\\$maxHandles has no type specified\\.$#" count: 1 path: lib/Client/AbstractCurl.php @@ -126,19 +126,19 @@ parameters: path: lib/Client/Curl.php - - message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:sendRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Parameter \\#1 \\$handle of function curl_errno expects CurlHandle, resource given\\.$#" count: 1 - path: lib/Client/FileGetContents.php + path: lib/Client/Curl.php - - message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:getStreamContextArray\\(\\) has parameter \\$options with no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Parameter \\#1 \\$handle of function curl_exec expects CurlHandle, resource given\\.$#" count: 1 - path: lib/Client/FileGetContents.php + path: lib/Client/Curl.php - - message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:getStreamContextArray\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Parameter \\#1 \\$handle of function curl_getinfo expects CurlHandle, resource given\\.$#" count: 1 - path: lib/Client/FileGetContents.php + path: lib/Client/Curl.php - message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:filterHeaders\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" @@ -151,117 +151,127 @@ parameters: path: lib/Client/FileGetContents.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$queue has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:getStreamContextArray\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: lib/Client/FileGetContents.php + + - + message: "#^Method Buzz\\\\Client\\\\FileGetContents\\:\\:sendRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + count: 1 + path: lib/Client/FileGetContents.php + + - + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$curlm has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has no return type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushedResponses type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has parameter \\$handle with no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushResponseHandles type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has parameter \\$headers with no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushFunctions type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addToQueue\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushCb type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:getPushedResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:getPushedResponse\\(\\) has parameter \\$url with no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:sendAsyncRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:handlePushedResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:sendRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:handlePushedResponse\\(\\) has parameter \\$handle with no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:hasPushResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has parameter \\$handle with no typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:hasPushResponse\\(\\) has parameter \\$url with no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addPushHandle\\(\\) has parameter \\$headers with no typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:sendAsyncRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:handlePushedResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:sendRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:handlePushedResponse\\(\\) has parameter \\$handle with no typehint specified\\.$#" + message: "#^Parameter \\#2 \\$handle of function curl_multi_add_handle expects CurlHandle, resource given\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:hasPushResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$curlm has no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:hasPushResponse\\(\\) has parameter \\$url with no typehint specified\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushCb is never read, only written\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:getPushedResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushCb type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:getPushedResponse\\(\\) has parameter \\$url with no typehint specified\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushFunctions type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addToQueue\\(\\) has parameter \\$options with no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushResponseHandles type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Method Buzz\\\\Client\\\\MultiCurl\\:\\:addToQueue\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$pushedResponses type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^PHPDoc tag @var for variable \\$options has no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Property Buzz\\\\Client\\\\MultiCurl\\:\\:\\$queue has no type specified\\.$#" count: 1 path: lib/Client/MultiCurl.php - - message: "#^Class Buzz\\\\Configuration\\\\ParameterBag implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + message: "#^Strict comparison using \\=\\=\\= between false and CurlMultiHandle will always evaluate to false\\.$#" count: 1 - path: lib/Configuration/ParameterBag.php + path: lib/Client/MultiCurl.php - - message: "#^Property Buzz\\\\Configuration\\\\ParameterBag\\:\\:\\$parameters has no typehint specified\\.$#" + message: "#^Class Buzz\\\\Configuration\\\\ParameterBag implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" count: 1 path: lib/Configuration/ParameterBag.php @@ -271,67 +281,67 @@ parameters: path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:all\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:add\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:keys\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:all\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:add\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:get\\(\\) has no return type specified\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:add\\(\\) return type has no value type specified in iterable type Buzz\\\\Configuration\\\\ParameterBag\\.$#" + message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^PHPDoc tag @var for variable \\$newParameters has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:keys\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:get\\(\\) has no return typehint specified\\.$#" + message: "#^PHPDoc tag @var for variable \\$newParameters has no value type specified in iterable type array\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Method Buzz\\\\Configuration\\\\ParameterBag\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#" + message: "#^Property Buzz\\\\Configuration\\\\ParameterBag\\:\\:\\$parameters has no type specified\\.$#" count: 1 path: lib/Configuration/ParameterBag.php - - message: "#^Property Buzz\\\\Exception\\\\CallbackException\\:\\:\\$request has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Exception\\\\CallbackException\\:\\:\\$request has no type specified\\.$#" count: 1 path: lib/Exception/CallbackException.php - - message: "#^Property Buzz\\\\Message\\\\FormRequestBuilder\\:\\:\\$data type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:__construct\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/FormRequestBuilder.php - - message: "#^Property Buzz\\\\Message\\\\FormRequestBuilder\\:\\:\\$files type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:__construct\\(\\) has parameter \\$files with no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/FormRequestBuilder.php - - message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:__construct\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:build\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/FormRequestBuilder.php - - message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:__construct\\(\\) has parameter \\$files with no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Message\\\\FormRequestBuilder\\:\\:\\$data type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/FormRequestBuilder.php - - message: "#^Method Buzz\\\\Message\\\\FormRequestBuilder\\:\\:build\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Message\\\\FormRequestBuilder\\:\\:\\$files type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/FormRequestBuilder.php @@ -356,82 +366,82 @@ parameters: path: lib/Message/HeaderConverter.php - - message: "#^Property Buzz\\\\Message\\\\ResponseBuilder\\:\\:\\$responseFactory has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:filterHeaders\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/ResponseBuilder.php - - message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:filterHeaders\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:filterHeaders\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/ResponseBuilder.php - - message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:filterHeaders\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:parseHttpHeaders\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" count: 1 path: lib/Message/ResponseBuilder.php - - message: "#^Method Buzz\\\\Message\\\\ResponseBuilder\\:\\:parseHttpHeaders\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Message\\\\ResponseBuilder\\:\\:\\$responseFactory has no type specified\\.$#" count: 1 path: lib/Message/ResponseBuilder.php - - message: "#^Property Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:\\$username has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/BasicAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:\\$password has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/BasicAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:\\$password has no type specified\\.$#" count: 1 path: lib/Middleware/BasicAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\BasicAuthMiddleware\\:\\:\\$username has no type specified\\.$#" count: 1 path: lib/Middleware/BasicAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:\\$accessToken has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/BearerAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/BearerAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\BearerAuthMiddleware\\:\\:\\$accessToken has no type specified\\.$#" count: 1 path: lib/Middleware/BearerAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:\\$callable has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/CallbackMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/CallbackMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\CallbackMiddleware\\:\\:\\$callable has no type specified\\.$#" count: 1 path: lib/Middleware/CallbackMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\ContentLengthMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\ContentLengthMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/ContentLengthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\ContentLengthMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\ContentLengthMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/ContentLengthMiddleware.php @@ -441,42 +451,47 @@ parameters: path: lib/Middleware/ContentTypeMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\ContentTypeMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\ContentTypeMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" + count: 1 + path: lib/Middleware/ContentTypeMiddleware.php + + - + message: "#^Method Buzz\\\\Middleware\\\\ContentTypeMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/ContentTypeMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\ContentTypeMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^PHPDoc tag @var above a method has no effect\\.$#" count: 1 path: lib/Middleware/ContentTypeMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$name has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:getAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php - - message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$value has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:setAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php - - message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$attributes has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$attributes has no type specified\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php - - message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$createdAt has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$createdAt has no type specified\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php - - message: "#^Method Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:setAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$name has no type specified\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php - - message: "#^Method Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:getAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\Cookie\\\\Cookie\\:\\:\\$value has no type specified\\.$#" count: 1 path: lib/Middleware/Cookie/Cookie.php @@ -486,147 +501,147 @@ parameters: path: lib/Middleware/Cookie/CookieJar.php - - message: "#^Property Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:\\$cookieJar has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/CookieMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:setCookies\\(\\) has parameter \\$cookies with no value type specified in iterable type array\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/CookieMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:setCookies\\(\\) has parameter \\$cookies with no value type specified in iterable type array\\.$#" count: 1 path: lib/Middleware/CookieMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\CookieMiddleware\\:\\:\\$cookieJar has no type specified\\.$#" count: 1 path: lib/Middleware/CookieMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$username has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:getAlgorithm\\(\\) never returns null so it can be removed from the return type\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$password has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:getDomain\\(\\) is unused\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$realm has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:getEntityBody\\(\\) never returns null so it can be removed from the return type\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$algorithm has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$authenticationMethod has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$clientNonce has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:parseNameValuePairs\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$domain has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:setQOP\\(\\) has parameter \\$qop with no value type specified in iterable type array\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$entityBody has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$algorithm has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$method has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$authenticationMethod has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$nonce has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$clientNonce has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$nonceCount has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$domain has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$opaque has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$entityBody has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$uri has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$method has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$options has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$nonce has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$nonceCount has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$opaque has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Parameter \\#1 \\$string of function strlen expects string, float\\|int\\|string given\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$options has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:getEntityBody\\(\\) never returns null so it can be removed from the return typehint\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$password has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:parseNameValuePairs\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$realm has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:setQOP\\(\\) has parameter \\$qop with no value type specified in iterable type array\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$uri has no type specified\\.$#" count: 1 path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$request has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\DigestAuthMiddleware\\:\\:\\$username has no type specified\\.$#" count: 1 - path: lib/Middleware/History/Entry.php + path: lib/Middleware/DigestAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$response has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$duration has no type specified\\.$#" count: 1 path: lib/Middleware/History/Entry.php - - message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$duration has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$request has no type specified\\.$#" count: 1 path: lib/Middleware/History/Entry.php - - message: "#^Class Buzz\\\\Middleware\\\\History\\\\Journal implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" + message: "#^Property Buzz\\\\Middleware\\\\History\\\\Entry\\:\\:\\$response has no type specified\\.$#" count: 1 - path: lib/Middleware/History/Journal.php + path: lib/Middleware/History/Entry.php - - message: "#^Property Buzz\\\\Middleware\\\\History\\\\Journal\\:\\:\\$limit has no typehint specified\\.$#" + message: "#^Class Buzz\\\\Middleware\\\\History\\\\Journal implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#" count: 1 path: lib/Middleware/History/Journal.php @@ -636,92 +651,87 @@ parameters: path: lib/Middleware/History/Journal.php - - message: "#^Property Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:\\$journal has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\History\\\\Journal\\:\\:\\$limit has no type specified\\.$#" count: 1 - path: lib/Middleware/HistoryMiddleware.php - - - - message: "#^Property Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:\\$startTime has no typehint specified\\.$#" - count: 1 - path: lib/Middleware/HistoryMiddleware.php + path: lib/Middleware/History/Journal.php - - message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:__construct\\(\\) has parameter \\$journal with no value type specified in iterable type Buzz\\\\Middleware\\\\History\\\\Journal\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/HistoryMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:getJournal\\(\\) return type has no value type specified in iterable type Buzz\\\\Middleware\\\\History\\\\Journal\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/HistoryMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:\\$journal has no type specified\\.$#" count: 1 path: lib/Middleware/HistoryMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\HistoryMiddleware\\:\\:\\$startTime has no type specified\\.$#" count: 1 path: lib/Middleware/HistoryMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$logger has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$level has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$prefix has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$level has no type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$startTime has no typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$logger has no type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$prefix has no type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\LoggerMiddleware\\:\\:\\$startTime has no type specified\\.$#" count: 1 path: lib/Middleware/LoggerMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\MiddlewareInterface\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\MiddlewareInterface\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/MiddlewareInterface.php - - message: "#^Method Buzz\\\\Middleware\\\\MiddlewareInterface\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\MiddlewareInterface\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/MiddlewareInterface.php - - message: "#^Property Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:\\$username has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:handleRequest\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/WsseAuthMiddleware.php - - message: "#^Property Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:\\$password has no typehint specified\\.$#" + message: "#^Method Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:handleResponse\\(\\) has no return type specified\\.$#" count: 1 path: lib/Middleware/WsseAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:handleRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:\\$password has no type specified\\.$#" count: 1 path: lib/Middleware/WsseAuthMiddleware.php - - message: "#^Method Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:handleResponse\\(\\) has no return typehint specified\\.$#" + message: "#^Property Buzz\\\\Middleware\\\\WsseAuthMiddleware\\:\\:\\$username has no type specified\\.$#" count: 1 path: lib/Middleware/WsseAuthMiddleware.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 57b89f9e..40ceb51e 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,7 +2,8 @@ includes: - phpstan-baseline.neon parameters: - level: 7 + level: 6 + reportUnmatchedIgnoredErrors: false paths: - lib diff --git a/psalm.baseline b/psalm.baseline deleted file mode 100644 index b9abaec4..00000000 --- a/psalm.baseline +++ /dev/null @@ -1,230 +0,0 @@ - - - - - !$requestFactory instanceof RequestFactoryInterface && !$requestFactory instanceof RequestFactory - - - function (RequestInterface $request, ResponseInterface $response) use ($m, $responseChainNext) { - function (RequestInterface $request) use ($requestChainLast, $responseChainNext) { - function (RequestInterface $request) use ($m, $requestChainNext) { - - - $lastRequest - $lastResponse - - - - - !$responseFactory instanceof ResponseFactoryInterface && !$responseFactory instanceof ResponseFactory - - - $e->getCode() - - - $e->getCode() - - - null !== $this->optionsResolver - - - - - $ch - $data - $ch - $data - $ch - $fd - $length - - - function ($ch, $fd, $length) use ($body) { - - - $handles - $maxHandles - - - null !== $bodySize - - - - - $error['message'] - - - $error['message'] - - - - - $parent - $pushed - $headers - $parent - $pushed - $headers - - - $responseFactory - $headers - $handle - $handle - $url - $url - - - $queue - $curlm - - - addPushHandle - handlePushedResponse - hasPushResponse - getPushedResponse - - - - - get - - - - - $request - - - - - !$responseFactory instanceof HTTPlugResponseFactory && !$responseFactory instanceof PsrResponseFactory - - - $responseFactory - - - - - handleRequest - handleResponse - - - - - $accessToken - - - handleRequest - handleResponse - - - - - $callable - - - handleRequest - handleResponse - - - - - handleRequest - handleResponse - - - - - handleRequest - handleResponse - - - - - $name - $value - $attributes - $createdAt - - - - - $cookie->getAttribute(Cookie::ATTR_DOMAIN) - $cookie->getAttribute(Cookie::ATTR_PATH) - - - - - $cookieJar - - - handleRequest - handleResponse - - - - - string - - - $username - $password - $realm - $algorithm - $authenticationMethod - $clientNonce - $domain - $entityBody - $method - $nonce - $nonceCount - $opaque - $uri - $options - - - handleRequest - handleResponse - - - $this->hash("{$username}:{$realm}:{$password}") - $nc - - - - - $startTime - - - handleRequest - handleResponse - - - - - $request->getUri() - - - $logger - $level - $prefix - $startTime - - - handleRequest - handleResponse - - - - - handleRequest - handleResponse - - - - - handleRequest - handleResponse - - - diff --git a/psalm.baseline.xml b/psalm.baseline.xml new file mode 100644 index 00000000..e6a63ee6 --- /dev/null +++ b/psalm.baseline.xml @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + getCode()]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + curlm]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getAttribute(static::ATTR_DOMAIN)]]> + + + + + + + getAttribute(Cookie::ATTR_DOMAIN)]]> + getAttribute(Cookie::ATTR_PATH)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/psalm.xml b/psalm.xml index 08f975ab..78a4464f 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,7 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - errorBaseline="psalm.baseline" + errorBaseline="psalm.baseline.xml" > diff --git a/tests/Integration/BuzzIntegrationTest.php b/tests/Integration/BuzzIntegrationTest.php index 902732b5..730a8113 100644 --- a/tests/Integration/BuzzIntegrationTest.php +++ b/tests/Integration/BuzzIntegrationTest.php @@ -200,8 +200,8 @@ public function testMaxFileSize(BuzzClientInterface $client, bool $async) } $curlOptions = [ - CURLOPT_NOPROGRESS => false, - CURLOPT_PROGRESSFUNCTION => function ($curl, $downloadSize, $downloaded) { + \CURLOPT_NOPROGRESS => false, + \CURLOPT_PROGRESSFUNCTION => function ($curl, $downloadSize, $downloaded) { return 1; }, ]; diff --git a/tests/Integration/Httplug/CurlIntegrationTest.php b/tests/Integration/Httplug/CurlIntegrationTest.php index 5ee7fdbc..64906cc0 100644 --- a/tests/Integration/Httplug/CurlIntegrationTest.php +++ b/tests/Integration/Httplug/CurlIntegrationTest.php @@ -17,6 +17,7 @@ protected function createHttpAdapter(): ClientInterface /** * @dataProvider requestProvider + * * @group integration */ public function testSendRequest($method, $uri, array $headers, $body) @@ -32,6 +33,7 @@ public function testSendRequest($method, $uri, array $headers, $body) /** * @dataProvider requestWithOutcomeProvider + * * @group integration */ public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, array $headers, $body) diff --git a/tests/Integration/Httplug/MultiCurlIntegrationTest.php b/tests/Integration/Httplug/MultiCurlIntegrationTest.php index ecdfa407..7eac7015 100644 --- a/tests/Integration/Httplug/MultiCurlIntegrationTest.php +++ b/tests/Integration/Httplug/MultiCurlIntegrationTest.php @@ -17,6 +17,7 @@ protected function createHttpAdapter(): ClientInterface /** * @dataProvider requestProvider + * * @group integration */ public function testSendRequest($method, $uri, array $headers, $body) @@ -32,6 +33,7 @@ public function testSendRequest($method, $uri, array $headers, $body) /** * @dataProvider requestWithOutcomeProvider + * * @group integration */ public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, array $headers, $body) diff --git a/tests/Unit/Middleware/ContentTypeMiddlewareTest.php b/tests/Unit/Middleware/ContentTypeMiddlewareTest.php index 6d60c8ee..48fc64ab 100644 --- a/tests/Unit/Middleware/ContentTypeMiddlewareTest.php +++ b/tests/Unit/Middleware/ContentTypeMiddlewareTest.php @@ -15,9 +15,9 @@ public function testMiddleware() { // XML $request = new Request('GET', - 'http://foo.com', - [], - ' + 'http://foo.com', + [], + ' Lorem Ipsum @@ -34,11 +34,11 @@ public function testMiddleware() $this->assertEquals('application/xml', $updatedRequest->getHeaderLine('Content-Type')); - //JSON + // JSON $request = new Request('GET', - 'http://foo.com', - [], - '{ + 'http://foo.com', + [], + '{ "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", diff --git a/tests/Unit/Middleware/DigestAuthListenerTest.php b/tests/Unit/Middleware/DigestAuthListenerTest.php index ee769532..ca6063c8 100644 --- a/tests/Unit/Middleware/DigestAuthListenerTest.php +++ b/tests/Unit/Middleware/DigestAuthListenerTest.php @@ -21,7 +21,7 @@ public function testDigestAuthHeader() 'WWW-Authenticate' => 'Digest realm="test", nonce="5PvRe0oZBQA=874ad6aea3519069f30dfc704e594dde6e01b2a6", algorithm=MD5, domain="/auth-digest/", qop="auth"', 'Content-Length' => '401', 'Content-Type' => 'text/html; charset=iso-8859-1', - ], " + ], " 401 Authorization Required diff --git a/tests/Unit/Middleware/LoggerMiddlewareTest.php b/tests/Unit/Middleware/LoggerMiddlewareTest.php index 1fe253ec..e22b8bc3 100644 --- a/tests/Unit/Middleware/LoggerMiddlewareTest.php +++ b/tests/Unit/Middleware/LoggerMiddlewareTest.php @@ -46,9 +46,6 @@ class CallbackLogger implements LoggerInterface private $callback; - /** - * @param $callback - */ public function __construct(callable $callback) { $this->callback = $callback;