Switch to a modern directory structure

Here are the steps I followed:

- `mkdir src`
- `git mv Collector DependencyInjection DoctrineMigrationsBundle.php MigrationsFactory src`
- adjust autoloading path
- tweak PHPUnit config
- tweak Psalm config
- `git mv Resources/config config`
- `git mv Resources/docs doc`
- overrode `Bundle::getPath()`
- `git mv Tests tests`
- `git mv Resources/views templates`
This commit is contained in:
Grégoire Paris
2024-03-26 19:48:38 +01:00
parent 62db2f2304
commit 47020af984
27 changed files with 30 additions and 40 deletions

View File

@@ -44,13 +44,10 @@
"vimeo/psalm": "^4.30 || ^5.15"
},
"autoload": {
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\": "src" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\Tests\\": "Tests" }
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\Tests\\": "tests" }
},
"config": {
"allow-plugins": {

View File

@@ -11,13 +11,10 @@
<config name="php_version" value="70200"/>
<file>Collector</file>
<file>MigrationsFactory</file>
<file>DoctrineMigrationsBundle.php</file>
<file>DependencyInjection</file>
<file>Tests</file>
<file>src</file>
<file>tests</file>
<exclude-pattern>Tests/Fixtures/CustomEntityManager.php</exclude-pattern>
<exclude-pattern>tests/Fixtures/CustomEntityManager.php</exclude-pattern>
<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint" />

View File

@@ -3,24 +3,24 @@ parameters:
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: Collector/MigrationsCollector.php
path: src/Collector/MigrationsCollector.php
-
message: "#^Only booleans are allowed in a negated boolean, Doctrine\\\\Migrations\\\\AbstractMigration\\|null given\\.$#"
count: 1
path: Collector/MigrationsFlattener.php
path: src/Collector/MigrationsFlattener.php
-
message: "#^Only booleans are allowed in a ternary operator condition, Doctrine\\\\Migrations\\\\AbstractMigration\\|null given\\.$#"
count: 2
path: Collector/MigrationsFlattener.php
path: src/Collector/MigrationsFlattener.php
-
message: "#^Call to method setContainer\\(\\) on an unknown class Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface\\.$#"
count: 1
path: MigrationsFactory/ContainerAwareMigrationFactory.php
path: src/MigrationsFactory/ContainerAwareMigrationFactory.php
-
message: "#^Class Symfony\\\\Component\\\\DependencyInjection\\\\ContainerAwareInterface not found\\.$#"
count: 2
path: MigrationsFactory/ContainerAwareMigrationFactory.php
path: src/MigrationsFactory/ContainerAwareMigrationFactory.php

View File

@@ -2,15 +2,12 @@ parameters:
level: 7
phpVersion: 80200
paths:
- Collector
- DependencyInjection
- DoctrineMigrationsBundle.php
- MigrationsFactory
- Tests
- src
- tests
excludePaths:
# That file contains an error that cannot be ignored
- Tests/Fixtures/Migrations/ContainerAwareMigration.php
- tests/Fixtures/Migrations/ContainerAwareMigration.php
ignoreErrors:
- '~Parameter \#1 \$configs.*DoctrineMigrationsExtension::load.*~'

View File

@@ -3,18 +3,13 @@
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="DoctrineMigrationsBundle for the Symfony Framework">
<directory>./Tests</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
<directory>src</directory>
</whitelist>
</filter>

View File

@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<file src="DependencyInjection/Configuration.php">
<file src="src/DependencyInjection/Configuration.php">
<UndefinedInterfaceMethod>
<code><![CDATA[end]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="DependencyInjection/DoctrineMigrationsExtension.php">
<file src="src/DependencyInjection/DoctrineMigrationsExtension.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$configs]]></code>
</MoreSpecificImplementedParamType>
</file>
<file src="MigrationsFactory/ContainerAwareMigrationFactory.php">
<file src="src/MigrationsFactory/ContainerAwareMigrationFactory.php">
<ContainerDependency>
<code><![CDATA[ContainerInterface $container]]></code>
</ContainerDependency>
@@ -18,7 +18,7 @@
<code><![CDATA[ContainerAwareInterface]]></code>
</UndefinedClass>
</file>
<file src="Tests/Fixtures/Migrations/ContainerAwareMigration.php">
<file src="tests/Fixtures/Migrations/ContainerAwareMigration.php">
<UndefinedClass>
<code><![CDATA[ContainerAwareInterface]]></code>
</UndefinedClass>

View File

@@ -10,11 +10,8 @@
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="Collector" />
<directory name="DependencyInjection" />
<directory name="MigrationsFactory" />
<directory name="Tests" />
<file name="DoctrineMigrationsBundle.php" />
<directory name="src" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>

View File

@@ -47,7 +47,7 @@ class DoctrineMigrationsExtension extends Extension
$config = $this->processConfiguration($configuration, $configs);
$locator = new FileLocator(__DIR__ . '/../Resources/config/');
$locator = new FileLocator(__DIR__ . '/../../config/');
$loader = new XmlFileLoader($container, $locator);
$loader->load('services.xml');
@@ -195,7 +195,7 @@ class DoctrineMigrationsExtension extends Extension
*/
public function getXsdValidationBasePath(): string
{
return __DIR__ . '/../Resources/config/schema';
return __DIR__ . '/../../config/schema';
}
public function getNamespace(): string

View File

@@ -8,6 +8,8 @@ use Doctrine\Bundle\MigrationsBundle\DependencyInjection\CompilerPass\ConfigureD
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use function dirname;
/**
* Bundle.
*/
@@ -18,4 +20,9 @@ class DoctrineMigrationsBundle extends Bundle
{
$container->addCompilerPass(new ConfigureDependencyFactoryPass());
}
public function getPath(): string
{
return dirname(__DIR__);
}
}

View File

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

View File

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 493 B