Skip to content

Commit

Permalink
Merge branch '7.7' into 7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Aug 27, 2023
2 parents 01531d1 + 085b026 commit 2055ef6
Show file tree
Hide file tree
Showing 19 changed files with 231 additions and 124 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,13 @@
Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.


## 7.7.1 - 2023-08-27

### Changed

- Remove the need for `AllowDynamicProperties` in `CurlMultiHandler`


## 7.7.0 - 2023-05-21

### Added
Expand Down
20 changes: 5 additions & 15 deletions phpstan-baseline.neon
Expand Up @@ -40,11 +40,6 @@ parameters:
count: 1
path: src/Exception/RequestException.php

-
message: "#^Binary operation \"\\+\" between array\\{errno\\: int, error\\: string, appconnect_time\\: float\\} and \\(array\\{url\\: string, content_type\\: string\\|null, http_code\\: int, header_size\\: int, request_size\\: int, filetime\\: int, ssl_verify_result\\: int, redirect_count\\: int, \\.\\.\\.\\}\\|false\\) results in an error\\.$#"
count: 1
path: src/Handler/CurlFactory.php

-
message: "#^Cannot access offset 'version' on array\\|false\\.$#"
count: 1
Expand Down Expand Up @@ -165,6 +160,11 @@ parameters:
count: 1
path: src/Handler/StreamHandler.php

-
message: "#^Variable \\$options in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
path: src/Handler/StreamHandler.php

-
message: "#^Result of && is always false\\.$#"
count: 1
Expand All @@ -180,16 +180,6 @@ parameters:
count: 1
path: src/Utils.php

-
message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#"
count: 1
path: src/Utils.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 1
path: src/Utils.php

-
message: "#^Parameter \\#3 \\$depth of function json_decode expects int\\<1, max\\>, int given\\.$#"
count: 1
Expand Down
238 changes: 179 additions & 59 deletions psalm-baseline.xml
@@ -1,20 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<file src="src/Client.php">
<PossiblyUndefinedVariable occurrences="1">
<PossiblyUndefinedVariable>
<code>$options</code>
</PossiblyUndefinedVariable>
<UndefinedInterfaceMethod occurrences="1">
<UndefinedInterfaceMethod>
<code>getBoundary</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Cookie/CookieJar.php">
<PossiblyFalseOperand occurrences="1">
<InvalidReturnStatement>
<code><![CDATA[new \ArrayIterator(\array_values($this->cookies))]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[\ArrayIterator<int, SetCookie>]]></code>
</InvalidReturnType>
<PossiblyFalseOperand>
<code>$result</code>
</PossiblyFalseOperand>
</file>
<file src="src/Cookie/SetCookie.php">
<RedundantCast occurrences="9">
<RedundantCast>
<code>(bool) $discard</code>
<code>(bool) $httpOnly</code>
<code>(bool) $secure</code>
Expand All @@ -25,7 +31,7 @@
<code>(string) $timestamp</code>
<code>(string) $value</code>
</RedundantCast>
<TooManyArguments occurrences="9">
<UndefinedFunction>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
Expand All @@ -35,120 +41,234 @@
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int, string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
</TooManyArguments>
</UndefinedFunction>
</file>
<file src="src/Handler/CurlFactory.php">
<FalseOperand occurrences="1">
<FalseOperand>
<code>$timeoutRequiresNoSignal</code>
</FalseOperand>
<InvalidOperand occurrences="1">
<code>$options['connect_timeout'] &lt; 1</code>
<InvalidOperand>
<code><![CDATA[$options['connect_timeout'] < 1]]></code>
</InvalidOperand>
<PossiblyFalseOperand occurrences="1">
<PossiblyFalseOperand>
<code>$timeoutRequiresNoSignal</code>
</PossiblyFalseOperand>
<PossiblyInvalidArgument occurrences="14">
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<PossiblyInvalidArgument>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
<code>$handle</code>
<code>$resource</code>
<code>$resource</code>
<code>$resource</code>
<code>$resource</code>
<code>$resource</code>
<code>$resource</code>
<code>$sslKey</code>
<code>$handle</code>
</PossiblyInvalidArgument>
<PossiblyInvalidCast occurrences="1">
<PossiblyInvalidCast>
<code>$sslKey</code>
</PossiblyInvalidCast>
<UndefinedDocblockClass occurrences="2">
<UndefinedDocblockClass>
<code>private $handles = [];</code>
<code>resource[]|\CurlHandle[]</code>
</UndefinedDocblockClass>
</file>
<file src="src/Handler/CurlHandler.php">
<PossiblyInvalidArgument occurrences="2">
<code>$easy-&gt;handle</code>
<code>$easy-&gt;handle</code>
<PossiblyInvalidArgument>
<code><![CDATA[$easy->handle]]></code>
<code><![CDATA[$easy->handle]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Handler/CurlMultiHandler.php">
<ArgumentTypeCoercion occurrences="1">
<code>$this-&gt;timeToNext()</code>
<ArgumentTypeCoercion>
<code><![CDATA[$this->timeToNext()]]></code>
</ArgumentTypeCoercion>
<PossiblyInvalidArgument occurrences="8">
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<code>$this-&gt;_mh</code>
<InvalidCast>
<code><![CDATA[$easy->handle]]></code>
</InvalidCast>
<PossiblyInvalidArgument>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
<code><![CDATA[$this->_mh]]></code>
</PossiblyInvalidArgument>
<RedundantPropertyInitializationCheck occurrences="1">
<code>isset($this-&gt;_mh)</code>
<RedundantPropertyInitializationCheck>
<code><![CDATA[isset($this->_mh)]]></code>
</RedundantPropertyInitializationCheck>
<TooManyArguments occurrences="1">
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
</TooManyArguments>
<UndefinedDocblockClass occurrences="2">
<TypeDoesNotContainType>
<code>false === $multiHandle</code>
</TypeDoesNotContainType>
<UndefinedDocblockClass>
<code>resource|\CurlMultiHandle</code>
<code>resource|\CurlMultiHandle</code>
</UndefinedDocblockClass>
<UndefinedFunction>
<code>trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__)</code>
</UndefinedFunction>
</file>
<file src="src/Handler/EasyHandle.php">
<UndefinedDocblockClass occurrences="1">
<InvalidReturnType>
<code>void</code>
</InvalidReturnType>
<UndefinedDocblockClass>
<code>resource|\CurlHandle</code>
</UndefinedDocblockClass>
</file>
<file src="src/Handler/MockHandler.php">
<ArgumentTypeCoercion occurrences="1">
<ArgumentTypeCoercion>
<code>(int) $options['delay'] * 1000</code>
</ArgumentTypeCoercion>
</file>
<file src="src/Handler/StreamHandler.php">
<ImplicitToStringCast occurrences="1">
<ImplicitToStringCast>
<code>$uri</code>
</ImplicitToStringCast>
<RedundantCondition occurrences="1">
<RedundantCondition>
<code>empty($options)</code>
</RedundantCondition>
</file>
<file src="src/HandlerStack.php">
<PropertyTypeCoercion occurrences="4">
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
</PropertyTypeCoercion>
</file>
<file src="src/MessageFormatter.php">
<InvalidScalarArgument occurrences="1"/>
<InvalidArgument>
<code><![CDATA[function (array $matches) use ($request, $response, $error, &$cache) {
if (isset($cache[$matches[1]])) {
return $cache[$matches[1]];
}
$result = '';
switch ($matches[1]) {
case 'request':
$result = Psr7\Message::toString($request);
break;
case 'response':
$result = $response ? Psr7\Message::toString($response) : '';
break;
case 'req_headers':
$result = \trim($request->getMethod()
.' '.$request->getRequestTarget())
.' HTTP/'.$request->getProtocolVersion()."\r\n"
.$this->headers($request);
break;
case 'res_headers':
$result = $response ?
\sprintf(
'HTTP/%s %d %s',
$response->getProtocolVersion(),
$response->getStatusCode(),
$response->getReasonPhrase()
)."\r\n".$this->headers($response)
: 'NULL';
break;
case 'req_body':
$result = $request->getBody()->__toString();
break;
case 'res_body':
if (!$response instanceof ResponseInterface) {
$result = 'NULL';
break;
}
$body = $response->getBody();
if (!$body->isSeekable()) {
$result = 'RESPONSE_NOT_LOGGEABLE';
break;
}
$result = $response->getBody()->__toString();
break;
case 'ts':
case 'date_iso_8601':
$result = \gmdate('c');
break;
case 'date_common_log':
$result = \date('d/M/Y:H:i:s O');
break;
case 'method':
$result = $request->getMethod();
break;
case 'version':
$result = $request->getProtocolVersion();
break;
case 'uri':
case 'url':
$result = $request->getUri()->__toString();
break;
case 'target':
$result = $request->getRequestTarget();
break;
case 'req_version':
$result = $request->getProtocolVersion();
break;
case 'res_version':
$result = $response
? $response->getProtocolVersion()
: 'NULL';
break;
case 'host':
$result = $request->getHeaderLine('Host');
break;
case 'hostname':
$result = \gethostname();
break;
case 'code':
$result = $response ? $response->getStatusCode() : 'NULL';
break;
case 'phrase':
$result = $response ? $response->getReasonPhrase() : 'NULL';
break;
case 'error':
$result = $error ? $error->getMessage() : 'NULL';
break;
default:
// handle prefixed dynamic headers
if (\strpos($matches[1], 'req_header_') === 0) {
$result = $request->getHeaderLine(\substr($matches[1], 11));
} elseif (\strpos($matches[1], 'res_header_') === 0) {
$result = $response
? $response->getHeaderLine(\substr($matches[1], 11))
: 'NULL';
}
}
$cache[$matches[1]] = $result;
return $result;
}]]></code>
</InvalidArgument>
</file>
<file src="src/Middleware.php">
<InvalidArgument occurrences="1">
<InvalidArgument>
<code>$request</code>
</InvalidArgument>
</file>
<file src="src/RedirectMiddleware.php">
<ImplicitToStringCast occurrences="1">
<ImplicitToStringCast>
<code>$location</code>
</ImplicitToStringCast>
</file>
<file src="src/RetryMiddleware.php">
<TooManyArguments occurrences="1">
<code>($this-&gt;delay)(++$options['retries'], $response, $request)</code>
<TooManyArguments>
<code><![CDATA[($this->delay)(++$options['retries'], $response, $request)]]></code>
</TooManyArguments>
</file>
<file src="src/Utils.php">
<ForbiddenCode occurrences="1">
<ArgumentTypeCoercion>
<code>$depth</code>
<code>$depth</code>
</ArgumentTypeCoercion>
<ForbiddenCode>
<code>\var_dump($input)</code>
</ForbiddenCode>
<PossiblyInvalidCast>
<code>$_SERVER[$name]</code>
</PossiblyInvalidCast>
</file>
</files>
2 changes: 1 addition & 1 deletion src/Client.php
Expand Up @@ -202,7 +202,7 @@ public function request(string $method, $uri = '', array $options = []): Respons
*
* @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
*/
public function getConfig(?string $option = null)
public function getConfig(string $option = null)
{
return $option === null
? $this->config
Expand Down
2 changes: 1 addition & 1 deletion src/ClientInterface.php
Expand Up @@ -80,5 +80,5 @@ public function requestAsync(string $method, $uri, array $options = []): Promise
*
* @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
*/
public function getConfig(?string $option = null);
public function getConfig(string $option = null);
}

0 comments on commit 2055ef6

Please sign in to comment.