From 3850bd138b04d588703c093ac6efe0996e2ae515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Tue, 12 May 2020 00:40:21 +0200 Subject: [PATCH] chore: fix PHPStan complaints. --- phpstan.neon | 10 ++++++++++ src/Zipkin/Reporters/Http.php | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 73cf00c3..6f040c79 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,6 @@ parameters: + checkGenericClassInNonGenericObjectType: false + treatPhpDocTypesAsCertain: false autoload_files: - vendor/autoload.php checkMissingIterableValueType: false @@ -11,3 +13,11 @@ parameters: # This is probably a mistake in the logic as $localEndpoint is always being overrided message: '#Parameter \#1 \$localEndpoint of class Zipkin\\DefaultTracing constructor expects Zipkin\\Endpoint, Zipkin\\Endpoint\|null given#' path: src/Zipkin/TracingBuilder.php + - + # This avoids false positive in quirky HTTP reporter constructor + message: '#Zipkin\\Reporters\\Http\:\:\_\_construct\(\)#' + path: src/Zipkin/Reporters/Http.php + - + # This avoids false positive in quirky HTTP reporter constructor + message: '#Strict comparison using \=\=\=#' + path: src/Zipkin/Reporters/Http.php \ No newline at end of file diff --git a/src/Zipkin/Reporters/Http.php b/src/Zipkin/Reporters/Http.php index 9c06e750..65f15112 100644 --- a/src/Zipkin/Reporters/Http.php +++ b/src/Zipkin/Reporters/Http.php @@ -69,19 +69,19 @@ public function __construct( if ($options === self::EMPTY_ARG) { // means no arguments because first argument wasn't nullable in v1 $parsedOptions = []; - } elseif (is_array($options) && (($requesterFactory instanceof ClientFactory) || $requesterFactory == null)) { + } elseif (\is_array($options) && (($requesterFactory instanceof ClientFactory) || $requesterFactory == null)) { // means the intention of the first argument is the `options` $parsedOptions = $options; - } elseif ($options instanceof ClientFactory && (is_array($requesterFactory) || $requesterFactory === null)) { + } elseif ($options instanceof ClientFactory && (\is_array($requesterFactory) || $requesterFactory === null)) { // means the intention of the first argument is the `ClientFactory` $parsedOptions = $requesterFactory ?? []; $requesterFactory = $options; } else { throw new TypeError( - sprintf( + \sprintf( 'Argument 1 passed to %s::__construct must be of type array, %s given', self::class, - $options === null ? 'null' : gettype($options) + $options === null ? 'null' : \gettype($options) ) ); }