Skip to content

Commit

Permalink
chore: fix PHPStan complaints.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcchavezs committed May 11, 2020
1 parent 32c6315 commit 3850bd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions phpstan.neon
@@ -1,4 +1,6 @@
parameters:
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
autoload_files:
- vendor/autoload.php
checkMissingIterableValueType: false
Expand All @@ -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
8 changes: 4 additions & 4 deletions src/Zipkin/Reporters/Http.php
Expand Up @@ -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)
)
);
}
Expand Down

0 comments on commit 3850bd1

Please sign in to comment.