More specific phpstan ignore rules.
This commit is contained in:
parent
6efd02465f
commit
42adbe5da8
8 changed files with 35 additions and 35 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.2504.11235
|
0.2504.21040
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Dependencies.php
|
// Dependencies.php
|
||||||
// Created: 2025-01-18
|
// Created: 2025-01-18
|
||||||
// Updated: 2025-03-22
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
namespace Index;
|
namespace Index;
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ class Dependencies {
|
||||||
if(!array_key_exists($class, $this->objects))
|
if(!array_key_exists($class, $this->objects))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
$object = XArray::first($this->objects[$class], $predicate); // @phpstan-ignore-line: IDC
|
$object = XArray::first($this->objects[$class], $predicate); // @phpstan-ignore argument.type
|
||||||
if($object === null || !is_a($object, $class))
|
if($object === null || !is_a($object, $class))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ class Dependencies {
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
if($predicate === null)
|
if($predicate === null)
|
||||||
return $this->objects[$class]; // @phpstan-ignore-line: trust me
|
return $this->objects[$class]; // @phpstan-ignore return.type
|
||||||
|
|
||||||
return XArray::where($this->objects[$class], $predicate); // @phpstan-ignore-line: this is fine
|
return XArray::where($this->objects[$class], $predicate); // @phpstan-ignore argument.type, return.type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// HttpRequest.php
|
// HttpRequest.php
|
||||||
// Created: 2022-02-08
|
// Created: 2022-02-08
|
||||||
// Updated: 2025-03-20
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
namespace Index\Http;
|
namespace Index\Http;
|
||||||
|
|
||||||
|
@ -360,16 +360,15 @@ class HttpRequest extends HttpMessage implements ServerRequestInterface, HttpPar
|
||||||
|
|
||||||
return new HttpRequest(
|
return new HttpRequest(
|
||||||
$request->getProtocolVersion(),
|
$request->getProtocolVersion(),
|
||||||
// @phpstan-ignore-next-line: interface erroneously defines as string[][] instead of array<string, string[]>
|
$request->getHeaders(), // @phpstan-ignore argument.type
|
||||||
$request->getHeaders(),
|
|
||||||
$request->getBody(),
|
$request->getBody(),
|
||||||
[],
|
[],
|
||||||
$request->getMethod(),
|
$request->getMethod(),
|
||||||
HttpUri::castUri($request->getUri()),
|
HttpUri::castUri($request->getUri()),
|
||||||
$queryParams,
|
$queryParams,
|
||||||
$cookieParams,
|
$cookieParams,
|
||||||
$request->getParsedBody(), // @phpstan-ignore-line: dont care
|
$request->getParsedBody(), // @phpstan-ignore argument.type
|
||||||
$request->getUploadedFiles(), // @phpstan-ignore-line: dont care
|
$request->getUploadedFiles(), // @phpstan-ignore argument.type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// XArray.php
|
// XArray.php
|
||||||
// Created: 2022-02-02
|
// Created: 2022-02-02
|
||||||
// Updated: 2025-01-21
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
namespace Index;
|
namespace Index;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ use InvalidArgumentException;
|
||||||
use Countable;
|
use Countable;
|
||||||
use Iterator;
|
use Iterator;
|
||||||
use IteratorAggregate;
|
use IteratorAggregate;
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides various helper methods for collections.
|
* Provides various helper methods for collections.
|
||||||
|
@ -480,7 +481,7 @@ final class XArray {
|
||||||
if($iterable instanceof Iterator)
|
if($iterable instanceof Iterator)
|
||||||
return $iterable;
|
return $iterable;
|
||||||
if($iterable instanceof IteratorAggregate)
|
if($iterable instanceof IteratorAggregate)
|
||||||
return $iterable->getIterator(); // @phpstan-ignore-line
|
return self::extractIterator($iterable->getIterator()); // @phpstan-ignore return.type
|
||||||
if(is_array($iterable))
|
if(is_array($iterable))
|
||||||
return new ArrayIterator($iterable);
|
return new ArrayIterator($iterable);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// BencodeSerialisableTest.php
|
// BencodeSerialisableTest.php
|
||||||
// Created: 2024-09-29
|
// Created: 2024-09-29
|
||||||
// Updated: 2025-01-18
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ final class BencodeSerialisableTest extends TestCase {
|
||||||
#[BencodeProperty(omitIfNull: false)]
|
#[BencodeProperty(omitIfNull: false)]
|
||||||
public mixed $nullValPresent = null;
|
public mixed $nullValPresent = null;
|
||||||
|
|
||||||
|
/** @var array<?scalar> */
|
||||||
#[BencodeProperty]
|
#[BencodeProperty]
|
||||||
/** @var scalar[] */
|
public array $scalarVals = [null, 0, 1234, 12.34, 'str', true, false];
|
||||||
public array $scalarVals = [null, 0, 1234, 12.34, 'str', true, false]; // @phpstan-ignore-line: idgi??
|
|
||||||
|
|
||||||
#[BencodeProperty('stringVal_method')]
|
#[BencodeProperty('stringVal_method')]
|
||||||
public function getStringVal(): string {
|
public function getStringVal(): string {
|
||||||
|
@ -112,8 +112,8 @@ final class BencodeSerialisableTest extends TestCase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[BencodeProperty] // @phpstan-ignore-line: idgi??
|
/** @return array<?scalar> */
|
||||||
/** @return scalar[] */
|
#[BencodeProperty]
|
||||||
public function getScalarVals(): array {
|
public function getScalarVals(): array {
|
||||||
return [null, 0, 1234, 12.34, 'str', true, false];
|
return [null, 0, 1234, 12.34, 'str', true, false];
|
||||||
}
|
}
|
||||||
|
@ -156,11 +156,11 @@ final class BencodeSerialisableTest extends TestCase {
|
||||||
use BencodeSerializableCommon;
|
use BencodeSerializableCommon;
|
||||||
|
|
||||||
#[BencodeProperty('test1')]
|
#[BencodeProperty('test1')]
|
||||||
#[BencodeProperty('test2')] // @phpstan-ignore-line: this is meant to test the dupe exception
|
#[BencodeProperty('test2')] // @phpstan-ignore attribute.nonRepeatable
|
||||||
public string $stringVal = 'string value';
|
public string $stringVal = 'string value';
|
||||||
|
|
||||||
#[BencodeProperty('test3')]
|
#[BencodeProperty('test3')]
|
||||||
#[BencodeProperty('test4')] // @phpstan-ignore-line: this is meant to test the dupe exception
|
#[BencodeProperty('test4')] // @phpstan-ignore attribute.nonRepeatable
|
||||||
public function getIntVal(): int {
|
public function getIntVal(): int {
|
||||||
return 1234;
|
return 1234;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// BencodeTest.php
|
// BencodeTest.php
|
||||||
// Created: 2023-07-21
|
// Created: 2023-07-21
|
||||||
// Updated: 2024-12-02
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ final class BencodeTest extends TestCase {
|
||||||
|
|
||||||
$this->assertIsObject($decoded);
|
$this->assertIsObject($decoded);
|
||||||
$this->assertObjectHasProperty('announce', $decoded);
|
$this->assertObjectHasProperty('announce', $decoded);
|
||||||
$this->assertEquals('https://tracker.flashii.net/announce.php/meow', $decoded->announce); // @phpstan-ignore-line: checked above
|
$this->assertEquals('https://tracker.flashii.net/announce.php/meow', $decoded->announce); // @phpstan-ignore property.notFound
|
||||||
$this->assertObjectHasProperty('creation date', $decoded);
|
$this->assertObjectHasProperty('creation date', $decoded);
|
||||||
$this->assertEquals(1689973664, $decoded->{'creation date'}); // @phpstan-ignore-line: checked above
|
$this->assertEquals(1689973664, $decoded->{'creation date'}); // @phpstan-ignore property.notFound
|
||||||
$this->assertObjectHasProperty('comment', $decoded);
|
$this->assertObjectHasProperty('comment', $decoded);
|
||||||
$this->assertEquals('this is the comments field', $decoded->comment); // @phpstan-ignore-line: checked above
|
$this->assertEquals('this is the comments field', $decoded->comment); // @phpstan-ignore property.notFound
|
||||||
$this->assertObjectHasProperty('info', $decoded);
|
$this->assertObjectHasProperty('info', $decoded);
|
||||||
$this->assertIsObject($decoded->info); // @phpstan-ignore-line: checked above
|
$this->assertIsObject($decoded->info); // @phpstan-ignore property.notFound
|
||||||
$this->assertObjectHasProperty('private', $decoded->info);
|
$this->assertObjectHasProperty('private', $decoded->info);
|
||||||
$this->assertEquals(1, $decoded->info->private); // @phpstan-ignore-line: checked above
|
$this->assertEquals(1, $decoded->info->private); // @phpstan-ignore property.notFound
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncode(): void {
|
public function testEncode(): void {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// DbConfigTest.php
|
// DbConfigTest.php
|
||||||
// Created: 2023-10-20
|
// Created: 2023-10-20
|
||||||
// Updated: 2025-01-18
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ use Index\Db\{DbBackends,DbConnection};
|
||||||
#[CoversClass(GetValueInfoCommon::class)]
|
#[CoversClass(GetValueInfoCommon::class)]
|
||||||
#[CoversClass(GetValuesCommon::class)]
|
#[CoversClass(GetValuesCommon::class)]
|
||||||
final class DbConfigTest extends TestCase {
|
final class DbConfigTest extends TestCase {
|
||||||
private DbConnection $dbConn; // @phpstan-ignore-line: defined by PHPunit in setUp()
|
private DbConnection $dbConn; // @phpstan-ignore property.uninitialized
|
||||||
private DbConfig $config; // @phpstan-ignore-line: defined by PHPunit in setUp()
|
private DbConfig $config; // @phpstan-ignore property.uninitialized
|
||||||
|
|
||||||
private const VALUES = [
|
private const VALUES = [
|
||||||
'private.allow_password_reset' => 'b:1;',
|
'private.allow_password_reset' => 'b:1;',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// JsonSerializableTest.php
|
// JsonSerializableTest.php
|
||||||
// Created: 2024-09-29
|
// Created: 2024-09-29
|
||||||
// Updated: 2025-01-18
|
// Updated: 2025-04-02
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@ final class JsonSerializableTest extends TestCase {
|
||||||
#[JsonProperty(omitIfNull: false)]
|
#[JsonProperty(omitIfNull: false)]
|
||||||
public mixed $nullValPresent = null;
|
public mixed $nullValPresent = null;
|
||||||
|
|
||||||
|
/** @var array<?scalar> */
|
||||||
#[JsonProperty]
|
#[JsonProperty]
|
||||||
/** @var scalar[] */
|
public array $scalarVals = [null, 0, 1234, 12.34, 'str', true, false];
|
||||||
public array $scalarVals = [null, 0, 1234, 12.34, 'str', true, false]; // @phpstan-ignore-line: idgi??
|
|
||||||
|
|
||||||
#[JsonProperty('stringVal_method')]
|
#[JsonProperty('stringVal_method')]
|
||||||
public function getStringVal(): string {
|
public function getStringVal(): string {
|
||||||
|
@ -110,8 +110,8 @@ final class JsonSerializableTest extends TestCase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[JsonProperty] // @phpstan-ignore-line: idgi??
|
/** @return array<?scalar> */
|
||||||
/** @return scalar[] */
|
#[JsonProperty]
|
||||||
public function getScalarVals(): array {
|
public function getScalarVals(): array {
|
||||||
return [null, 0, 1234, 12.34, 'str', true, false];
|
return [null, 0, 1234, 12.34, 'str', true, false];
|
||||||
}
|
}
|
||||||
|
@ -154,11 +154,11 @@ final class JsonSerializableTest extends TestCase {
|
||||||
use JsonSerializableCommon;
|
use JsonSerializableCommon;
|
||||||
|
|
||||||
#[JsonProperty('test1')]
|
#[JsonProperty('test1')]
|
||||||
#[JsonProperty('test2')] // @phpstan-ignore-line: this is meant to test the dupe exception
|
#[JsonProperty('test2')] // @phpstan-ignore attribute.nonRepeatable
|
||||||
public string $stringVal = 'string value';
|
public string $stringVal = 'string value';
|
||||||
|
|
||||||
#[JsonProperty('test3')]
|
#[JsonProperty('test3')]
|
||||||
#[JsonProperty('test4')] // @phpstan-ignore-line: this is meant to test the dupe exception
|
#[JsonProperty('test4')] // @phpstan-ignore attribute.nonRepeatable
|
||||||
public function getIntVal(): int {
|
public function getIntVal(): int {
|
||||||
return 1234;
|
return 1234;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue