Ignore the "result unused" error in tests from the PHPStan config

This commit is contained in:
Ben Ramsey
2025-06-24 20:23:23 -05:00
committed by Ben Ramsey
parent 088b87356d
commit 4ca249e960
20 changed files with 7 additions and 32 deletions
+7
View File
@@ -11,3 +11,10 @@ parameters:
analyse:
- ./tests/ExpectedBehaviorTest.php
- ./tests/static-analysis/stubs.php
ignoreErrors:
-
identifier: method.resultUnused
path: tests/*
-
identifier: staticMethod.resultUnused
path: tests/*
-1
View File
@@ -58,7 +58,6 @@ class FallbackBuilderTest extends TestCase
'Could not find a suitable builder for the provided codec and fields'
);
/** @phpstan-ignore method.resultUnused */
$fallbackBuilder->build($codec, $bytes);
}
-1
View File
@@ -56,7 +56,6 @@ class GuidStringCodecTest extends TestCase
->method('getFields')
->willReturn($this->fields);
$codec = new GuidStringCodec($this->builder);
/** @phpstan-ignore method.resultUnused */
$codec->encode($this->uuid);
}
-3
View File
@@ -77,7 +77,6 @@ class OrderedTimeCodecTest extends TestCase
->method('getFields')
->willReturn($this->fields);
$codec = new OrderedTimeCodec($this->builder);
/** @phpstan-ignore method.resultUnused */
$codec->encode($this->uuid);
}
@@ -166,7 +165,6 @@ class OrderedTimeCodecTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Expected version 1 (time-based) UUID');
/** @phpstan-ignore method.resultUnused */
$codec->encodeBinary($uuid);
}
@@ -187,7 +185,6 @@ class OrderedTimeCodecTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Expected version 1 (time-based) UUID');
/** @phpstan-ignore method.resultUnused */
$codec->encodeBinary($uuid);
}
-2
View File
@@ -60,7 +60,6 @@ class StringCodecTest extends TestCase
->method('getFields')
->willReturn($this->fields);
$codec = new StringCodec($this->builder);
/** @phpstan-ignore method.resultUnused */
$codec->encode($this->uuid);
}
@@ -136,7 +135,6 @@ class StringCodecTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('$bytes string should contain 16 characters.');
/** @phpstan-ignore method.resultUnused */
$codec->decodeBytes($bytes);
}
@@ -17,7 +17,6 @@ class BigNumberConverterTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('"." is not a valid character in base 16');
/** @phpstan-ignore method.resultUnused */
$converter->fromHex('123.34');
}
@@ -31,7 +30,6 @@ class BigNumberConverterTest extends TestCase
. '0-9 and, optionally, a sign (+ or -)'
);
/** @phpstan-ignore method.resultUnused */
$converter->toHex('123.34');
}
@@ -56,7 +56,6 @@ class BigNumberTimeConverterTest extends TestCase
. '0-9 and, optionally, a sign (+ or -)'
);
/** @phpstan-ignore method.resultUnused */
$converter->calculateTime('12.34', '5678');
}
@@ -70,7 +69,6 @@ class BigNumberTimeConverterTest extends TestCase
. '0-9 and, optionally, a sign (+ or -)'
);
/** @phpstan-ignore method.resultUnused */
$converter->calculateTime('1234', '56.78');
}
}
@@ -52,7 +52,6 @@ class PhpTimeConverterTest extends TestCase
. '0-9 and, optionally, a sign (+ or -)'
);
/** @phpstan-ignore method.resultUnused */
$converter->calculateTime('12.34', '5678');
}
@@ -67,7 +66,6 @@ class PhpTimeConverterTest extends TestCase
. '0-9 and, optionally, a sign (+ or -)'
);
/** @phpstan-ignore method.resultUnused */
$converter->calculateTime('1234', '56.78');
}
@@ -75,7 +75,6 @@ class TimestampFirstCombCodecTest extends TestCase
'node' => '0800200c9a66',
]))
);
/** @phpstan-ignore method.resultUnused */
$this->codec->decode('0800200c-9a66-11e1-9b21-ff6f8cb0c57d');
}
@@ -78,7 +78,6 @@ class TimestampLastCombCodecTest extends TestCase
'node' => 'ff6f8cb0c57d',
]))
);
/** @phpstan-ignore method.resultUnused */
$this->codec->decode('0800200c-9a66-11e1-9b21-ff6f8cb0c57d');
}
@@ -79,7 +79,6 @@ class DefaultNameGeneratorTest extends TestCase
'Unable to hash namespace and name with algorithm \'aBadAlgorithm\''
);
/** @phpstan-ignore method.resultUnused */
$generator->generate($namespace, 'a test name', 'aBadAlgorithm');
}
}
@@ -99,7 +99,6 @@ class PeclUuidNameGeneratorTest extends TestCase
'Unable to hash namespace and name with algorithm \'aBadAlgorithm\''
);
/** @phpstan-ignore method.resultUnused */
$generator->generate($namespace, 'a test name', 'aBadAlgorithm');
}
}
-1
View File
@@ -28,7 +28,6 @@ class GuidBuilderTest extends TestCase
$this->expectException(UnableToBuildUuidException::class);
$this->expectExceptionMessage('exception thrown');
/** @phpstan-ignore method.resultUnused */
$builder->build($codec, 'foobar');
}
}
-1
View File
@@ -98,7 +98,6 @@ class BrickMathCalculatorTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('"o" is not a valid character in base 16');
/** @phpstan-ignore method.resultUnused */
$calculator->fromBase('foobar', 16);
}
-1
View File
@@ -28,7 +28,6 @@ class UuidBuilderTest extends TestCase
$this->expectException(UnableToBuildUuidException::class);
$this->expectExceptionMessage('exception thrown');
/** @phpstan-ignore method.resultUnused */
$builder->build($codec, 'foobar');
}
}
-2
View File
@@ -140,7 +140,6 @@ class UuidBuilderTest extends TestCase
'The byte string must be 16 bytes long; received 15 bytes'
);
/** @phpstan-ignore method.resultUnused */
$builder->build($codec, $bytes);
}
@@ -164,7 +163,6 @@ class UuidBuilderTest extends TestCase
'The UUID version in the given fields is not supported by this UUID builder'
);
/** @phpstan-ignore method.resultUnused */
$builder->build($codec, 'foobar');
}
}
-1
View File
@@ -38,7 +38,6 @@ final class GuidConversionBench
public function benchStringConversionOfGuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->uuid->toString();
}
}
@@ -34,7 +34,6 @@ final class NonLazyUuidConversionBench
public function benchStringConversionOfUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->uuid->toString();
}
}
-2
View File
@@ -73,7 +73,6 @@ final class UuidGenerationBench
public function benchUuid3Generation(): void
{
/** @phpstan-ignore staticMethod.resultUnused */
Uuid::uuid3($this->namespace, 'name');
}
@@ -84,7 +83,6 @@ final class UuidGenerationBench
public function benchUuid5Generation(): void
{
/** @phpstan-ignore staticMethod.resultUnused */
Uuid::uuid5($this->namespace, 'name');
}
@@ -208,19 +208,16 @@ final class UuidStringConversionBench
public function benchStringConversionOfTinyUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->tinyUuid->toString();
}
public function benchStringConversionOfHugeUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->hugeUuid->toString();
}
public function benchStringConversionOfUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->uuid->toString();
}
@@ -233,19 +230,16 @@ final class UuidStringConversionBench
public function benchBytesConversionOfTinyUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->tinyUuid->getBytes();
}
public function benchBytesConversionOfHugeUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->hugeUuid->getBytes();
}
public function benchBytesConversionOfUuid(): void
{
/** @phpstan-ignore method.resultUnused */
$this->uuid->getBytes();
}