Skip to content

Commit

Permalink
Merge pull request #538 from greg0ire/reduce-baseline
Browse files Browse the repository at this point in the history
Address static analysis issues from the baselines
  • Loading branch information
greg0ire committed Mar 27, 2024
2 parents 553a96f + 27b05cc commit bc599a5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 29 deletions.
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
@@ -1,20 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Collector/MigrationsCollector.php

-
message: "#^Only booleans are allowed in a negated boolean, Doctrine\\\\Migrations\\\\AbstractMigration\\|null given\\.$#"
count: 1
path: src/Collector/MigrationsFlattener.php

-
message: "#^Only booleans are allowed in a ternary operator condition, Doctrine\\\\Migrations\\\\AbstractMigration\\|null given\\.$#"
count: 2
path: src/Collector/MigrationsFlattener.php

-
message: "#^Call to method setContainer\\(\\) on an unknown class Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\.$#"
count: 1
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Expand Up @@ -9,9 +9,6 @@ parameters:
# That file contains an error that cannot be ignored
- tests/Fixtures/Migrations/ContainerAwareMigration.php

ignoreErrors:
- '~Parameter \#1 \$configs.*DoctrineMigrationsExtension::load.*~'

includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
Expand Down
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Expand Up @@ -5,11 +5,6 @@
<code><![CDATA[end]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="src/DependencyInjection/DoctrineMigrationsExtension.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$configs]]></code>
</MoreSpecificImplementedParamType>
</file>
<file src="src/MigrationsFactory/ContainerAwareMigrationFactory.php">
<ContainerDependency>
<code><![CDATA[ContainerInterface $container]]></code>
Expand Down
2 changes: 1 addition & 1 deletion src/Collector/MigrationsCollector.php
Expand Up @@ -32,7 +32,7 @@ public function __construct(DependencyFactory $dependencyFactory, MigrationsFlat
/** @return void */
public function collect(Request $request, Response $response, ?Throwable $exception = null)
{
if (! empty($this->data)) {
if ($this->data !== []) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Collector/MigrationsFlattener.php
Expand Up @@ -62,11 +62,11 @@ public function flattenExecutedMigrations(ExecutedMigrationsList $migrationsList
return [
'version' => (string) $migration->getVersion(),
'is_new' => false,
'is_unavailable' => ! $availableMigration,
'description' => $availableMigration ? $availableMigration->getDescription() : null,
'is_unavailable' => $availableMigration === null,
'description' => $availableMigration !== null ? $availableMigration->getDescription() : null,
'executed_at' => $migration->getExecutedAt(),
'execution_time' => $migration->getExecutionTime(),
'file' => $availableMigration ? (new ReflectionClass($availableMigration))->getFileName() : null,
'file' => $availableMigration !== null ? (new ReflectionClass($availableMigration))->getFileName() : null,
];
}, $migrationsList->getItems());
}
Expand Down
3 changes: 1 addition & 2 deletions src/DependencyInjection/DoctrineMigrationsExtension.php
Expand Up @@ -35,8 +35,7 @@ class DoctrineMigrationsExtension extends Extension
/**
* Responds to the migrations configuration parameter.
*
* @param mixed[][] $configs
* @psalm-param array<string, array<string, array<string, array<string, string>|string>|string>> $configs
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
Expand Down

0 comments on commit bc599a5

Please sign in to comment.