Skip to content

Commit

Permalink
Added more checks (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Jul 17, 2021
1 parent 1482295 commit a3a2077
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Expand Up @@ -114,3 +114,8 @@ parameters:
message: "#^Result of && is always false\\.$#"
count: 1
path: src/Cookie/SetCookie.php

-
message: "#^Result of && is always false\\.$#"
count: 1
path: src/HandlerStack.php
4 changes: 4 additions & 0 deletions src/Handler/CurlMultiHandler.php
Expand Up @@ -205,6 +205,10 @@ private function addRequest(array $entry): void
*/
private function cancel($id): bool
{
if (!is_int($id)) {
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__);
}

// Cannot cancel if it has been processed.
if (!isset($this->handles[$id])) {
return false;
Expand Down
6 changes: 5 additions & 1 deletion src/HandlerStack.php
Expand Up @@ -180,6 +180,10 @@ public function after(string $findName, callable $middleware, string $withName =
*/
public function remove($remove): void
{
if (!is_string($remove) && !is_callable($remove)) {
trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__);
}

$this->cached = null;
$idx = \is_callable($remove) ? 0 : 1;
$this->stack = \array_values(\array_filter(
Expand Down Expand Up @@ -251,7 +255,7 @@ private function splice(string $findName, string $withName, callable $middleware
/**
* Provides a debug string for a given callable.
*
* @param callable $fn Function to write as a string.
* @param callable|string $fn Function to write as a string.
*/
private function debugCallable($fn): string
{
Expand Down

0 comments on commit a3a2077

Please sign in to comment.