Skip to content

Commit 5088d47

Browse files
Merge branch '11.5'
2 parents 03c1666 + ac2a438 commit 5088d47

File tree

12 files changed

+39
-19
lines changed

12 files changed

+39
-19
lines changed

phpstan.neon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,19 @@ parameters:
22
level: 6
33
paths:
44
- src
5+
6+
treatPhpDocTypesAsCertain: false
7+
8+
ignoreErrors:
9+
# ignore errors caused by defensive programming
10+
- '#Call to function assert\(\) with true will always evaluate to true.#'
11+
- '#Instanceof between .* and .* will always evaluate to true.#'
12+
- '#Strict comparison using !== between .*non-empty-string.* and .* will always evaluate to true.#'
13+
- '#Strict comparison using !== between .*non-falsy-string.* and .* will always evaluate to true.#'
14+
- identifier: argument.named
15+
16+
excludePaths:
17+
- src/Framework/MockObject/Runtime/Api # exclude partial traits, which are only used in runtime generated code
18+
19+
includes:
20+
- phar://phpstan.phar/conf/bleedingEdge.neon

src/Framework/Assert.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ final public static function assertArrayNotHasKey(int|string $key, array|ArrayAc
194194
}
195195

196196
/**
197-
* @phpstan-assert list $array
197+
* @phpstan-assert list<mixed> $array
198198
*
199199
* @throws ExpectationFailedException
200200
*/
@@ -1197,7 +1197,7 @@ final public static function assertNotInstanceOf(string $expected, mixed $actual
11971197
* @throws Exception
11981198
* @throws ExpectationFailedException
11991199
*
1200-
* @phpstan-assert array $actual
1200+
* @phpstan-assert array<mixed> $actual
12011201
*/
12021202
final public static function assertIsArray(mixed $actual, string $message = ''): void
12031203
{
@@ -1384,7 +1384,7 @@ final public static function assertIsCallable(mixed $actual, string $message = '
13841384
* @throws Exception
13851385
* @throws ExpectationFailedException
13861386
*
1387-
* @phpstan-assert iterable $actual
1387+
* @phpstan-assert iterable<mixed> $actual
13881388
*/
13891389
final public static function assertIsIterable(mixed $actual, string $message = ''): void
13901390
{
@@ -1401,7 +1401,7 @@ final public static function assertIsIterable(mixed $actual, string $message = '
14011401
* @throws Exception
14021402
* @throws ExpectationFailedException
14031403
*
1404-
* @phpstan-assert !array $actual
1404+
* @phpstan-assert !array<mixed> $actual
14051405
*/
14061406
final public static function assertIsNotArray(mixed $actual, string $message = ''): void
14071407
{
@@ -1588,7 +1588,7 @@ final public static function assertIsNotCallable(mixed $actual, string $message
15881588
* @throws Exception
15891589
* @throws ExpectationFailedException
15901590
*
1591-
* @phpstan-assert !iterable $actual
1591+
* @phpstan-assert !iterable<mixed> $actual
15921592
*/
15931593
final public static function assertIsNotIterable(mixed $actual, string $message = ''): void
15941594
{

src/Framework/Assert/Functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function assertArrayNotHasKey(int|string $key, array|ArrayAccess $array, string
187187

188188
if (!function_exists('PHPUnit\Framework\assertIsList')) {
189189
/**
190-
* @phpstan-assert list $array
190+
* @phpstan-assert list<mixed> $array
191191
*
192192
* @throws ExpectationFailedException
193193
*
@@ -1373,7 +1373,7 @@ function assertNotInstanceOf(string $expected, mixed $actual, string $message =
13731373
* @throws Exception
13741374
* @throws ExpectationFailedException
13751375
*
1376-
* @phpstan-assert array $actual
1376+
* @phpstan-assert array<mixed> $actual
13771377
*
13781378
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
13791379
*
@@ -1582,7 +1582,7 @@ function assertIsCallable(mixed $actual, string $message = ''): void
15821582
* @throws Exception
15831583
* @throws ExpectationFailedException
15841584
*
1585-
* @phpstan-assert iterable $actual
1585+
* @phpstan-assert iterable<mixed> $actual
15861586
*
15871587
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
15881588
*
@@ -1601,7 +1601,7 @@ function assertIsIterable(mixed $actual, string $message = ''): void
16011601
* @throws Exception
16021602
* @throws ExpectationFailedException
16031603
*
1604-
* @phpstan-assert !array $actual
1604+
* @phpstan-assert !array<mixed> $actual
16051605
*
16061606
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
16071607
*
@@ -1810,7 +1810,7 @@ function assertIsNotCallable(mixed $actual, string $message = ''): void
18101810
* @throws Exception
18111811
* @throws ExpectationFailedException
18121812
*
1813-
* @phpstan-assert !iterable $actual
1813+
* @phpstan-assert !iterable<mixed> $actual
18141814
*
18151815
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
18161816
*

src/Framework/Constraint/Equality/IsEqual.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(mixed $value)
4242
*
4343
* @throws ExpectationFailedException
4444
*/
45-
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
45+
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
4646
{
4747
// If $this->value and $other are identical, they are also equal.
4848
// This is the most common path and will allow us to skip

src/Framework/Constraint/Equality/IsEqualCanonicalizing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(mixed $value)
4242
*
4343
* @throws ExpectationFailedException
4444
*/
45-
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
45+
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
4646
{
4747
// If $this->value and $other are identical, they are also equal.
4848
// This is the most common path and will allow us to skip

src/Framework/Constraint/Equality/IsEqualIgnoringCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(mixed $value)
4242
*
4343
* @throws ExpectationFailedException
4444
*/
45-
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
45+
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
4646
{
4747
// If $this->value and $other are identical, they are also equal.
4848
// This is the most common path and will allow us to skip

src/Framework/Constraint/Equality/IsEqualWithDelta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(mixed $value, float $delta)
4242
*
4343
* @throws ExpectationFailedException
4444
*/
45-
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): ?bool
45+
public function evaluate(mixed $other, string $description = '', bool $returnResult = false): bool
4646
{
4747
// If $this->value and $other are identical, they are also equal.
4848
// This is the most common path and will allow us to skip

src/Framework/Constraint/Type/IsType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ final class IsType extends Constraint
7777
*/
7878
public function __construct(string $type)
7979
{
80-
/** @phpstan-ignore isset.offset */
8180
if (!isset(self::KNOWN_TYPES[$type])) {
8281
throw new UnknownTypeException($type);
8382
}

src/Framework/MockObject/Generator/DoubledMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function generateCode(): string
214214
'arguments_call' => $this->argumentsForCall,
215215
'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '',
216216
'return_type' => $this->returnType->asString(),
217-
'arguments_count' => $argumentsCount,
217+
'arguments_count' => (string) $argumentsCount,
218218
'class_name' => $this->className,
219219
'method_name' => $this->methodName,
220220
'modifier' => $this->modifier,

src/Framework/MockObject/Generator/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject,
451451

452452
if (is_array($explicitMethods)) {
453453
foreach ($explicitMethods as $methodName) {
454-
if ($class !== null && $class->hasMethod($methodName)) {
454+
if ($class->hasMethod($methodName)) {
455455
$method = $class->getMethod($methodName);
456456

457457
if ($this->canMethodBeDoubled($method)) {

0 commit comments

Comments
 (0)