Skip to content

Commit ac2a438

Browse files
Merge branch '11.4' into 11.5
2 parents 4cd4298 + c08158d commit ac2a438

File tree

12 files changed

+41
-21
lines changed

12 files changed

+41
-21
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
@@ -195,7 +195,7 @@ final public static function assertArrayNotHasKey(int|string $key, array|ArrayAc
195195
}
196196

197197
/**
198-
* @phpstan-assert list $array
198+
* @phpstan-assert list<mixed> $array
199199
*
200200
* @throws ExpectationFailedException
201201
*/
@@ -1198,7 +1198,7 @@ final public static function assertNotInstanceOf(string $expected, mixed $actual
11981198
* @throws Exception
11991199
* @throws ExpectationFailedException
12001200
*
1201-
* @phpstan-assert array $actual
1201+
* @phpstan-assert array<mixed> $actual
12021202
*/
12031203
final public static function assertIsArray(mixed $actual, string $message = ''): void
12041204
{
@@ -1385,7 +1385,7 @@ final public static function assertIsCallable(mixed $actual, string $message = '
13851385
* @throws Exception
13861386
* @throws ExpectationFailedException
13871387
*
1388-
* @phpstan-assert iterable $actual
1388+
* @phpstan-assert iterable<mixed> $actual
13891389
*/
13901390
final public static function assertIsIterable(mixed $actual, string $message = ''): void
13911391
{
@@ -1402,7 +1402,7 @@ final public static function assertIsIterable(mixed $actual, string $message = '
14021402
* @throws Exception
14031403
* @throws ExpectationFailedException
14041404
*
1405-
* @phpstan-assert !array $actual
1405+
* @phpstan-assert !array<mixed> $actual
14061406
*/
14071407
final public static function assertIsNotArray(mixed $actual, string $message = ''): void
14081408
{
@@ -1589,7 +1589,7 @@ final public static function assertIsNotCallable(mixed $actual, string $message
15891589
* @throws Exception
15901590
* @throws ExpectationFailedException
15911591
*
1592-
* @phpstan-assert !iterable $actual
1592+
* @phpstan-assert !iterable<mixed> $actual
15931593
*/
15941594
final public static function assertIsNotIterable(mixed $actual, string $message = ''): void
15951595
{

src/Framework/Assert/Functions.php

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

194194
if (!function_exists('PHPUnit\Framework\assertIsList')) {
195195
/**
196-
* @phpstan-assert list $array
196+
* @phpstan-assert list<mixed> $array
197197
*
198198
* @throws ExpectationFailedException
199199
*
@@ -1379,7 +1379,7 @@ function assertNotInstanceOf(string $expected, mixed $actual, string $message =
13791379
* @throws Exception
13801380
* @throws ExpectationFailedException
13811381
*
1382-
* @phpstan-assert array $actual
1382+
* @phpstan-assert array<mixed> $actual
13831383
*
13841384
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
13851385
*
@@ -1588,7 +1588,7 @@ function assertIsCallable(mixed $actual, string $message = ''): void
15881588
* @throws Exception
15891589
* @throws ExpectationFailedException
15901590
*
1591-
* @phpstan-assert iterable $actual
1591+
* @phpstan-assert iterable<mixed> $actual
15921592
*
15931593
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
15941594
*
@@ -1607,7 +1607,7 @@ function assertIsIterable(mixed $actual, string $message = ''): void
16071607
* @throws Exception
16081608
* @throws ExpectationFailedException
16091609
*
1610-
* @phpstan-assert !array $actual
1610+
* @phpstan-assert !array<mixed> $actual
16111611
*
16121612
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
16131613
*
@@ -1816,7 +1816,7 @@ function assertIsNotCallable(mixed $actual, string $message = ''): void
18161816
* @throws Exception
18171817
* @throws ExpectationFailedException
18181818
*
1819-
* @phpstan-assert !iterable $actual
1819+
* @phpstan-assert !iterable<mixed> $actual
18201820
*
18211821
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
18221822
*

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
@@ -128,7 +128,6 @@ final class IsType extends Constraint
128128
*/
129129
public function __construct(string $type)
130130
{
131-
/** @phpstan-ignore isset.offset */
132131
if (!isset(self::KNOWN_TYPES[$type])) {
133132
throw new UnknownTypeException($type);
134133
}

src/Framework/MockObject/Generator/Generator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ public function generateClassFromWsdl(string $wsdlFile, string $className, array
473473

474474
try {
475475
$client = new SoapClient($wsdlFile, $options);
476-
$_methods = array_unique($client->__getFunctions());
476+
$_methods = array_unique($client->__getFunctions() ?? []);
477477

478478
unset($client);
479479
} catch (SoapFault $e) {
@@ -781,7 +781,7 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject,
781781

782782
if (is_array($explicitMethods)) {
783783
foreach ($explicitMethods as $methodName) {
784-
if ($class !== null && $class->hasMethod($methodName)) {
784+
if ($class->hasMethod($methodName)) {
785785
$method = $class->getMethod($methodName);
786786

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

src/Framework/MockObject/Generator/MockMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ public function generateCode(): string
226226
'arguments_call' => $this->argumentsForCall,
227227
'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '',
228228
'return_type' => $this->returnType->asString(),
229-
'arguments_count' => $argumentsCount,
229+
'arguments_count' => (string) $argumentsCount,
230230
'class_name' => $this->className,
231231
'method_name' => $this->methodName,
232232
'modifier' => $this->modifier,
233233
'reference' => $this->reference,
234234
'clone_arguments' => $this->cloneArguments ? 'true' : 'false',
235-
'deprecation' => $deprecation,
235+
'deprecation' => $deprecation ?? '',
236236
'return_result' => $returnResult,
237237
],
238238
);

0 commit comments

Comments
 (0)