Skip to content
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

Trim down Config and Manager classes to remove unused behavior #689

Merged
merged 9 commits into from
Feb 13, 2024
3 changes: 1 addition & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
colors="true"
cacheDirectory=".phpunit.cache"
bootstrap="tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
>
<testsuites>
<testsuite name="migrations">
Expand Down Expand Up @@ -34,7 +34,6 @@
<php>
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>

<!-- SQLite
<env name="DB" value="sqlite"/>
Expand Down
22 changes: 0 additions & 22 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,6 @@
<code>ConfigurationTrait</code>
</DeprecatedTrait>
</file>
<file src="src/Config/Config.php">
<DeprecatedMethod>
<code>getEnvironments</code>
<code>getEnvironments</code>
<code>hasEnvironment</code>
<code>hasEnvironment</code>
<code>searchNamespace</code>
<code>searchNamespace</code>
</DeprecatedMethod>
<LessSpecificImplementedReturnType>
<code>array</code>
<code>array</code>
<code>array</code>
<code>array</code>
</LessSpecificImplementedReturnType>
</file>
<file src="src/Config/ConfigInterface.php">
<MissingTemplateParam>
<code>ArrayAccess</code>
Expand Down Expand Up @@ -143,12 +127,6 @@
<ArgumentTypeCoercion>
<code>array_merge($versions, array_keys($migrations))</code>
</ArgumentTypeCoercion>
<DeprecatedMethod>
<code>getDataDomain</code>
<code>getMigrationNamespaceByPath</code>
<code>getSeedNamespaceByPath</code>
<code>hasEnvironment</code>
</DeprecatedMethod>
<RedundantPropertyInitializationCheck>
<code><![CDATA[isset($this->container)]]></code>
</RedundantPropertyInitializationCheck>
Expand Down
9 changes: 4 additions & 5 deletions src/Command/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ protected function getConfig(Arguments $args): Config
'pass' => $connectionConfig['password'],
'host' => $connectionConfig['host'],
'name' => $connectionConfig['database'],
'migration_table' => $table,
];

$configData = [
Expand All @@ -146,10 +147,8 @@ protected function getConfig(Arguments $args): Config
'file' => $templatePath . 'Phinx/create.php.template',
],
'migration_base_class' => 'Migrations\AbstractMigration',
'environments' => [
'default_migration_table' => $table,
'default' => $adapterConfig,
],
'connection' => ConnectionManager::get($connectionName),
'environment' => $adapterConfig,
// TODO do we want to support the DI container in migrations?
];

Expand Down Expand Up @@ -180,7 +179,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
{
/** @var string|null $format */
$format = $args->getOption('format');
$migrations = $this->getManager($args)->printStatus('default', $format);
$migrations = $this->getManager($args)->printStatus($format);

switch ($format) {
case 'json':
Expand Down
Loading
Loading