Просмотр исходного кода

fix: update `TokensTest` to shrink PHPStan's baseline (#8112)

Kuba Werłos 8 месяцев назад
Родитель
Сommit
b724cc2a85
2 измененных файлов с 4 добавлено и 12 удалено
  1. 0 12
      dev-tools/phpstan/baseline.php
  2. 4 0
      tests/Tokenizer/TokensTest.php

+ 0 - 12
dev-tools/phpstan/baseline.php

@@ -3529,18 +3529,6 @@ $ignoreErrors[] = [
 	'count' => 2,
 	'path' => __DIR__ . '/../../tests/Tokenizer/TokensTest.php',
 ];
-$ignoreErrors[] = [
-	// identifier: offsetAccess.notFound
-	'message' => '#^Offset 310 might not exist on array\\<int, array\\<int\\<0, max\\>, PhpCsFixer\\\\Tokenizer\\\\Token\\>\\>\\.$#',
-	'count' => 2,
-	'path' => __DIR__ . '/../../tests/Tokenizer/TokensTest.php',
-];
-$ignoreErrors[] = [
-	// identifier: offsetAccess.notFound
-	'message' => '#^Offset 333 might not exist on array\\<int, array\\<int\\<0, max\\>, PhpCsFixer\\\\Tokenizer\\\\Token\\>\\>\\.$#',
-	'count' => 2,
-	'path' => __DIR__ . '/../../tests/Tokenizer/TokensTest.php',
-];
 $ignoreErrors[] = [
 	// identifier: offsetAccess.notFound
 	'message' => '#^Offset int might not exist on array\\<int, PhpCsFixer\\\\Tokenizer\\\\Token\\>\\.$#',

+ 4 - 0
tests/Tokenizer/TokensTest.php

@@ -527,12 +527,16 @@ final class TokensTest extends TestCase
 
         // test offset and limits of the search
         $found = $tokens->findGivenKind([T_CLASS, T_FUNCTION], 10);
+        self::assertArrayHasKey(T_CLASS, $found);
         self::assertCount(0, $found[T_CLASS]);
+        self::assertArrayHasKey(T_FUNCTION, $found);
         self::assertCount(1, $found[T_FUNCTION]);
         self::assertArrayHasKey(26, $found[T_FUNCTION]);
 
         $found = $tokens->findGivenKind([T_CLASS, T_FUNCTION], 2, 10);
+        self::assertArrayHasKey(T_CLASS, $found);
         self::assertCount(0, $found[T_CLASS]);
+        self::assertArrayHasKey(T_FUNCTION, $found);
         self::assertCount(1, $found[T_FUNCTION]);
         self::assertArrayHasKey(9, $found[T_FUNCTION]);
     }