Skip to content

Commit e7b94fc

Browse files
committed
removed useless type juggling
1 parent 012ce3d commit e7b94fc

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/Framework/Assert.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,7 @@ public static function noError(callable $function): void
390390
public static function match(string $pattern, $actual, string $description = null): void
391391
{
392392
self::$counter++;
393-
if (!is_string($pattern)) {
394-
throw new \Exception('Pattern must be a string.');
395-
396-
} elseif (!is_scalar($actual)) {
393+
if (!is_scalar($actual)) {
397394
self::fail(self::describe('%1 should match %2', $description), $actual, $pattern);
398395

399396
} elseif (!self::isMatching($pattern, $actual)) {
@@ -458,8 +455,8 @@ public static function with($obj, \Closure $closure)
458455
*/
459456
public static function isMatching(string $pattern, $actual, bool $strict = false): bool
460457
{
461-
if (!is_string($pattern) || !is_scalar($actual)) {
462-
throw new \Exception('Value and pattern must be strings.');
458+
if (!is_scalar($actual)) {
459+
throw new \Exception('Value must be strings.');
463460
}
464461

465462
$old = ini_set('pcre.backtrack_limit', '10000000');

src/Runner/Job.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function isRunning(): bool
169169
foreach (explode("\r\n", $headers) as $header) {
170170
$pos = strpos($header, ':');
171171
if ($pos !== false) {
172-
$this->headers[trim(substr($header, 0, $pos))] = (string) trim(substr($header, $pos + 1));
172+
$this->headers[trim(substr($header, 0, $pos))] = trim(substr($header, $pos + 1));
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)