1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

fix code style remove debug code

This commit is contained in:
Sam Mousa 2022-06-22 15:05:24 +02:00
parent d13a428cb5
commit f8e548e811
No known key found for this signature in database
GPG Key ID: A18520F9B4301C9D

View File

@ -3,9 +3,8 @@
namespace Psalm\Tests\Internal\Codebase; namespace Psalm\Tests\Internal\Codebase;
use InvalidArgumentException; use InvalidArgumentException;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;
use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\SkippedTestError;
use Psalm\Codebase; use Psalm\Codebase;
use Psalm\Internal\Analyzer\ProjectAnalyzer; use Psalm\Internal\Analyzer\ProjectAnalyzer;
use Psalm\Internal\Codebase\InternalCallMapHandler; use Psalm\Internal\Codebase\InternalCallMapHandler;
@ -20,9 +19,8 @@ use Psalm\Type;
use ReflectionFunction; use ReflectionFunction;
use ReflectionParameter; use ReflectionParameter;
use ReflectionType; use ReflectionType;
use Throwable;
use function Amp\call; use function class_exists;
use function count; use function count;
use function explode; use function explode;
use function function_exists; use function function_exists;
@ -30,6 +28,7 @@ use function in_array;
use function json_encode; use function json_encode;
use function preg_match; use function preg_match;
use function print_r; use function print_r;
use function sort;
use function strncmp; use function strncmp;
use function strpos; use function strpos;
use function substr; use function substr;
@ -436,7 +435,6 @@ class InternalCallMapHandlerTest extends TestCase
); );
$callMap = InternalCallMapHandler::getCallMap(); $callMap = InternalCallMapHandler::getCallMap();
foreach ($callMap as $function => $entry) { foreach ($callMap as $function => $entry) {
if ($function !== 'hash_hmac_file') continue;
// Skip class methods // Skip class methods
if (strpos($function, '::') !== false || !function_exists($function)) { if (strpos($function, '::') !== false || !function_exists($function)) {
continue; continue;
@ -451,14 +449,12 @@ class InternalCallMapHandlerTest extends TestCase
} }
/** /**
* @return bool
*/ */
private function isIgnored(string $functionName) private function isIgnored(string $functionName): bool
{ {
/** @psalm-assert callable-string $functionName */ /** @psalm-assert callable-string $functionName */
if (in_array($functionName, self::$ignoredFunctions)) { if (in_array($functionName, self::$ignoredFunctions)) {
return true; return true;
} }
return false; return false;
} }
@ -484,12 +480,10 @@ class InternalCallMapHandlerTest extends TestCase
unset($callMapEntry[0]); unset($callMapEntry[0]);
/** @var array<string, string> $callMapEntry */ /** @var array<string, string> $callMapEntry */
$this->assertEntryIsCorrect($callMapEntry, $functionName); $this->assertEntryIsCorrect($callMapEntry, $functionName);
} catch (InvalidArgumentException $t) {
} catch(\InvalidArgumentException $t) {
// Silence this one for now. // Silence this one for now.
$this->markTestSkipped('IA'); $this->markTestSkipped('IA');
} catch(\PHPUnit\Framework\SkippedTestError $t) { } catch (SkippedTestError $t) {
die('this should not happen'); die('this should not happen');
} catch (ExpectationFailedException $e) { } catch (ExpectationFailedException $e) {
// This is good! // This is good!
@ -501,7 +495,6 @@ class InternalCallMapHandlerTest extends TestCase
) { ) {
die("Class mentioned in callmap does not exist: " . $matches[1]); die("Class mentioned in callmap does not exist: " . $matches[1]);
} }
} }
$this->markTestIncomplete("Remove function '{$functionName}' from your ignores"); $this->markTestIncomplete("Remove function '{$functionName}' from your ignores");
@ -617,7 +610,7 @@ class InternalCallMapHandlerTest extends TestCase
try { try {
$parsedType = Type::parseString($specified); $parsedType = Type::parseString($specified);
} catch(\Throwable $t) { } catch (Throwable $t) {
die("Failed to parse type: $specified -- $message"); die("Failed to parse type: $specified -- $message");
} }