Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/Map/BaseMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
public function sort(): MapInterface
{
foreach (array_keys(static::$map) as $k) {
// @phpstan-ignore assign.propertyType
ksort(static::$map[$k]);

Check failure on line 78 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept non-empty-array<string, array<string, array<string, array<int<0, max>, string>>>>.
foreach (static::$map[$k] as &$sub) {
ksort($sub);
}
Expand Down Expand Up @@ -166,12 +165,10 @@
protected function addMapSubEntry(string $entry, string $entryKey, string $subEntry, string $value): MapInterface
{
if (!isset(static::$map[$entry][$entryKey][$subEntry])) {
// @phpstan-ignore assign.propertyType
static::$map[$entry][$entryKey][$subEntry] = [$value];

Check failure on line 168 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept non-empty-array<string, array<string, array<string, array<int<0, max>, string>>>>.
} else {
if (array_search($value, static::$map[$entry][$entryKey][$subEntry]) === false) {
// @phpstan-ignore assign.propertyType
static::$map[$entry][$entryKey][$subEntry][] = $value;

Check failure on line 171 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept non-empty-array<string, array<string, array<string, array<int<0, max>, string>>>>.
}
}
return $this;
Expand Down Expand Up @@ -206,27 +203,23 @@
}

// Remove the map sub entry key.
// @phpstan-ignore assign.propertyType
unset(static::$map[$entry][$entryKey][$subEntry][$k]);

Check failure on line 206 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept array<string, array<string, array<string, array<int<0, max>, string>>>>.

// Remove the sub entry if no more values.
if (empty(static::$map[$entry][$entryKey][$subEntry])) {
// @phpstan-ignore assign.propertyType
unset(static::$map[$entry][$entryKey][$subEntry]);

Check failure on line 210 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept array<string, array<string, array<string, array<int<0, max>, string>>>>.
} else {
// Resequence the remaining values.
$tmp = [];
foreach (static::$map[$entry][$entryKey][$subEntry] as $v) {
$tmp[] = $v;
}
// @phpstan-ignore assign.propertyType
static::$map[$entry][$entryKey][$subEntry] = $tmp;

Check failure on line 217 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept non-empty-array<string, array<string, array<string, array<int<0, max>, string>>>>.
}

// Remove the entry if no more values.
if (empty(static::$map[$entry][$entryKey])) {
// @phpstan-ignore assign.propertyType
unset(static::$map[$entry][$entryKey]);

Check failure on line 222 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept array<string, array<string, array<string, array<int<0, max>, string>>>>.
}

return true;
Expand Down Expand Up @@ -269,8 +262,7 @@
}
$tmp[] = $v;
}
// @phpstan-ignore assign.propertyType
static::$map[$entry][$entryKey][$subEntry] = $tmp;

Check failure on line 265 in src/Map/BaseMap.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Static property FileEye\MimeMap\Map\BaseMap<TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>>::$map (TMap of array<string, array<string, array<string, array<int<0, max>, string>>>>) does not accept non-empty-array<string, array<string, array<string, array<int<0, max>, string>>>>.

return $this;
}
Expand Down
1 change: 0 additions & 1 deletion tests/src/MapHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
MapHandler::setDefaultMapClass(EmptyMap::class);
$this->assertInstanceOf(EmptyMap::class, MapHandler::map());
MapHandler::setDefaultMapClass(DefaultMap::class);
// @phpstan-ignore method.impossibleType
$this->assertInstanceOf(DefaultMap::class, MapHandler::map());

Check failure on line 31 in tests/src/MapHandlerTest.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Call to method PHPUnit\Framework\Assert::assertInstanceOf() with 'FileEye\\MimeMap\\Map\\DefaultMap' and FileEye\MimeMap\Map\EmptyMap will always evaluate to false.
}

public function testMap(): void
Expand Down
5 changes: 0 additions & 5 deletions tests/src/MapUpdaterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
'txt' => ['t' => ['text/plain']],
],
];
// @phpstan-ignore method.impossibleType
$this->assertSame($expected, $this->newMap->getMapArray());

Check failure on line 52 in tests/src/MapUpdaterTest.php

View workflow job for this annotation

GitHub Actions / Code quality checks (8.1)

Call to method PHPUnit\Framework\Assert::assertSame() with array{t: array{'image/jpeg': array{e: array{'jpeg', 'jpg', 'jpe'}}, 'text/plain': array{e: array{'txt'}}}, e: array{jpe: array{t: array{'image/jpeg'}}, jpeg: array{t: array{'image/jpeg'}}, jpg: array{t: array{'image/jpeg'}}, txt: array{t: array{'text/plain'}}}} and array{t: array<'a'|'desc'|'e', array<string, array<int<0, max>, string>>>, e: array{t?: array<string, array<int<0, max>, string>>}, a: array{t?: array<string, array<int<0, max>, string>>}} will always evaluate to false.
$this->assertSame(['image/jpeg', 'text/plain'], $this->newMap->listTypes());
$this->assertSame(['jpe', 'jpeg', 'jpg', 'txt'], $this->newMap->listExtensions());
$this->assertSame([], $this->newMap->listAliases());
Expand Down Expand Up @@ -111,7 +110,6 @@
'image/pdf' => ['t' => ['application/pdf']],
],
];
// @phpstan-ignore method.impossibleType
$this->assertSame($expected, $this->newMap->getMapArray());
$this->assertSame(['application/pdf', 'application/x-atari-2600-rom', 'application/x-pdf', 'text/plain'], $this->newMap->listTypes());
$this->assertSame(['a26', 'asc', 'pdf', 'txt'], $this->newMap->listExtensions());
Expand All @@ -121,7 +119,6 @@
public function testLoadMapFromFreedesktopFileZeroLines(): void
{
$this->updater->loadMapFromFreedesktopFile(dirname(__FILE__) . '/../fixtures/zero.freedesktop.xml');
// @phpstan-ignore method.impossibleType
$this->assertSame([], $this->newMap->getMapArray());
}

Expand Down Expand Up @@ -149,7 +146,6 @@
{
$this->fileSystem->copy(__DIR__ . '/../fixtures/MiniMap.php.test', __DIR__ . '/../fixtures/MiniMap.php');
include_once(__DIR__ . '/../fixtures/MiniMap.php');
// @phpstan-ignore class.notFound, argument.type
MapHandler::setDefaultMapClass(MiniMap::class);
$map_a = MapHandler::map();
$this->assertStringContainsString('fixtures/MiniMap.php', $map_a->getFileName());
Expand All @@ -171,7 +167,6 @@
{
$this->fileSystem->copy(__DIR__ . '/../fixtures/MiniMap.php.test', __DIR__ . '/../fixtures/MiniMap.php');
include_once(__DIR__ . '/../fixtures/MiniMap.php');
// @phpstan-ignore class.notFound, argument.type
MapHandler::setDefaultMapClass(MiniMap::class);
$map_a = MapHandler::map();
$this->assertStringContainsString('fixtures/MiniMap.php', $map_a->getFileName());
Expand Down