Skip to content

test: fix codeigniter.unknownServiceMethod errors #9532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
21 changes: 12 additions & 9 deletions tests/system/CommonSingleServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function testSingleServiceWithNoParamsSupplied(string $service): void
{
Services::injectMock('security', new MockSecurity(new SecurityConfig()));

$service1 = single_service($service);
$service2 = single_service($service);
$service1 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod
$service2 = single_service($service); // @phpstan-ignore codeigniter.unknownServiceMethod

assert($service1 !== null);

Expand All @@ -62,8 +62,8 @@ public function testSingleServiceWithAtLeastOneParamSupplied(string $service): v

$params[] = $method->getNumberOfParameters() === 1 ? true : $method->getParameters()[0]->getDefaultValue();

$service1 = single_service($service, ...$params);
$service2 = single_service($service, ...$params);
$service1 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod
$service2 = single_service($service, ...$params); // @phpstan-ignore codeigniter.unknownServiceMethod

assert($service1 !== null);

Expand Down Expand Up @@ -91,13 +91,16 @@ public function testSingleServiceWithAllParamsSupplied(): void

public function testSingleServiceWithGibberishGiven(): void
{
$this->assertNull(single_service('foo'));
$this->assertNull(single_service('bar'));
$this->assertNull(single_service('baz'));
$this->assertNull(single_service('caches'));
$this->assertNull(single_service('timers'));
$this->assertNull(single_service('foo')); // @phpstan-ignore codeigniter.unknownServiceMethod
$this->assertNull(single_service('bar')); // @phpstan-ignore codeigniter.unknownServiceMethod
$this->assertNull(single_service('baz')); // @phpstan-ignore codeigniter.unknownServiceMethod
$this->assertNull(single_service('caches')); // @phpstan-ignore codeigniter.unknownServiceMethod
$this->assertNull(single_service('timers')); // @phpstan-ignore codeigniter.unknownServiceMethod
}

/**
* @return iterable<string, array{string}>
*/
public static function provideServiceNames(): iterable
{
static $services = [];
Expand Down
33 changes: 0 additions & 33 deletions utils/phpstan-baseline/codeigniter.unknownServiceMethod.neon

This file was deleted.

3 changes: 1 addition & 2 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 3383 errors
# total 3373 errors
includes:
- argument.type.neon
- assign.propertyType.neon
Expand All @@ -7,7 +7,6 @@ includes:
- codeigniter.modelArgumentType.neon
- codeigniter.superglobalAccess.neon
- codeigniter.superglobalAccessAssign.neon
- codeigniter.unknownServiceMethod.neon
- deadCode.unreachable.neon
- empty.notAllowed.neon
- method.alreadyNarrowedType.neon
Expand Down
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1619 errors
# total 1618 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -6477,11 +6477,6 @@ parameters:
count: 1
path: ../../tests/system/CommonHelperTest.php

-
message: '#^Method CodeIgniter\\CommonSingleServiceTest\:\:provideServiceNames\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
path: ../../tests/system/CommonSingleServiceTest.php

-
message: '#^Method CodeIgniter\\Config\\DotEnvTest\:\:provideLoadsVars\(\) return type has no value type specified in iterable type iterable\.$#'
count: 1
Expand Down
Loading