Skip to content

Commit

Permalink
Removed unused code, removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Jul 17, 2023
1 parent a1873b2 commit 82db7dd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 25 deletions.
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,5 @@
InjectorInterface::TYPE_MODULE,
])</code>
</InvalidPropertyAssignmentValue>
<UnusedMethod>
<code>createDevelopmentWorkConfig</code>
</UnusedMethod>
</file>
</files>
1 change: 0 additions & 1 deletion src/Injector/AbstractInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Laminas\ComponentInstaller\Exception;

use function addslashes;
use function assert;
use function count;
use function file_get_contents;
use function file_put_contents;
Expand Down
1 change: 0 additions & 1 deletion src/Injector/ConfigAggregatorInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Laminas\ComponentInstaller\ConfigDiscovery\ConfigAggregator as ConfigAggregatorDiscovery;
use Laminas\ComponentInstaller\ConfigDiscovery\DiscoveryInterface;

use function assert;
use function preg_quote;
use function sprintf;

Expand Down
1 change: 0 additions & 1 deletion src/Injector/MezzioConfigInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Laminas\ComponentInstaller\ConfigDiscovery\DiscoveryInterface;
use Laminas\ComponentInstaller\ConfigDiscovery\MezzioConfig as MezzioConfigDiscovery;

use function assert;
use function preg_quote;
use function sprintf;

Expand Down
2 changes: 0 additions & 2 deletions test/ComponentInstallerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@
use function dirname;
use function file_get_contents;
use function implode;
use function is_string;
use function method_exists;
use function mkdir;
use function preg_match;
use function preg_quote;
use function sprintf;
use function strpos;

/**
* @psalm-type ComponentInstallerConfiguration array{component?:string,module?:string}
Expand Down
57 changes: 41 additions & 16 deletions test/ConfigDiscoveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,83 +180,107 @@ public function testGetAvailableConfigOptionsReturnsOptionsForEachSupportedPacka

/**
* @psalm-return array<array-key, array{
* seedMethod: string,
* seedMethod: callable(self): void,
* type: InjectorInterface::TYPE_*,
* expected: class-string<InjectorInterface>,
* chain: bool
* }>
*/
public function configFileSubset(): array
public static function configFileSubset(): array
{
return [
[
'seedMethod' => 'createApplicationConfig',
'seedMethod' => static function (self $test): void {
$test->createApplicationConfig();
},
'type' => InjectorInterface::TYPE_COMPONENT,
'expected' => Injector\ApplicationConfigInjector::class,
'chain' => false,
],
[
'seedMethod' => 'createApplicationConfig',
'seedMethod' => static function (self $test): void {
$test->createApplicationConfig();
},
'type' => InjectorInterface::TYPE_MODULE,
'expected' => Injector\ApplicationConfigInjector::class,
'chain' => false,
],
[
'seedMethod' => 'createAggregatorConfig',
'seedMethod' => static function (self $test): void {
$test->createAggregatorConfig();
},
'type' => InjectorInterface::TYPE_CONFIG_PROVIDER,
'expected' => Injector\ConfigAggregatorInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createAggregatorConfig',
'seedMethod' => static function (self $test): void {
$test->createAggregatorConfig();
},
'type' => InjectorInterface::TYPE_CONFIG_PROVIDER,
'expected' => Injector\ConfigAggregatorInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createDevelopmentConfig',
'seedMethod' => static function (self $test): void {
$test->createDevelopmentConfig();
},
'type' => InjectorInterface::TYPE_COMPONENT,
'expected' => Injector\DevelopmentConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createDevelopmentConfig',
'seedMethod' => static function (self $test): void {
$test->createDevelopmentConfig();
},
'type' => InjectorInterface::TYPE_MODULE,
'expected' => Injector\DevelopmentConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createDevelopmentWorkConfig',
'seedMethod' => static function (self $test): void {
$test->createDevelopmentWorkConfig();
},
'type' => InjectorInterface::TYPE_COMPONENT,
'expected' => Injector\DevelopmentWorkConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createDevelopmentWorkConfig',
'seedMethod' => static function (self $test): void {
$test->createDevelopmentWorkConfig();
},
'type' => InjectorInterface::TYPE_MODULE,
'expected' => Injector\DevelopmentWorkConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createMezzioConfig',
'seedMethod' => static function (self $test): void {
$test->createMezzioConfig();
},
'type' => InjectorInterface::TYPE_CONFIG_PROVIDER,
'expected' => Injector\MezzioConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createMezzioConfig',
'seedMethod' => static function (self $test): void {
$test->createMezzioConfig();
},
'type' => InjectorInterface::TYPE_CONFIG_PROVIDER,
'expected' => Injector\MezzioConfigInjector::class,
'chain' => true,
],
[
'seedMethod' => 'createModulesConfig',
'seedMethod' => static function (self $test): void {
$test->createModulesConfig();
},
'type' => InjectorInterface::TYPE_COMPONENT,
'expected' => Injector\ModulesConfigInjector::class,
'chain' => false,
],
[
'seedMethod' => 'createModulesConfig',
'seedMethod' => static function (self $test): void {
$test->createModulesConfig();
},
'type' => InjectorInterface::TYPE_MODULE,
'expected' => Injector\ModulesConfigInjector::class,
'chain' => false,
Expand All @@ -266,16 +290,17 @@ public function configFileSubset(): array

/**
* @dataProvider configFileSubset
* @param (callable(self): void) $seedMethod
* @param InjectorInterface::TYPE_* $type
* @param class-string<InjectorInterface> $expected
*/
public function testGetAvailableConfigOptionsCanReturnsSubsetOfOptionsBaseOnPackageType(
string $seedMethod,
callable $seedMethod,
int $type,
string $expected,
bool $chain
): void {
$this->{$seedMethod}();
$seedMethod($this);
$options = $this->discovery->getAvailableConfigOptions(new Collection([$type]), vfsStream::url('project'));
$this->assertCount(2, $options);

Expand Down
1 change: 0 additions & 1 deletion test/RememberedAnswerQuestionAssertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace LaminasTest\ComponentInstaller;

use function assert;
use function sprintf;
use function strpos;

Expand Down

0 comments on commit 82db7dd

Please sign in to comment.