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

Use a modern directory structure #1767

Merged
merged 1 commit into from
Mar 15, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -21,4 +21,4 @@ schema management and PDO abstraction.
## Documentation

The documentation is rendered on [the symfony.com website](https://symfony.com/doc/current/reference/configuration/doctrine.html).
The source of the documentation is available in the Resources/docs folder.
The source of the documentation is available in the docs folder.
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -81,12 +81,13 @@
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Doctrine\\Bundle\\DoctrineBundle\\": ""
"Doctrine\\Bundle\\DoctrineBundle\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"": "Tests/DependencyInjection"
"": "tests/DependencyInjection",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this seems to be about autoloading the Fixtures namespace, I would suggest using Fixtures\\ as the PSR-4 prefix (and going one level deeper for the path) instead of a fallback for any class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will do in a separate PR

"Doctrine\\Bundle\\DoctrineBundle\\Tests\\": "tests"
}
},
"config": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions phpcs.xml.dist
Expand Up @@ -11,8 +11,7 @@

<config name="php_version" value="70400"/>

<file>.</file>
<exclude-pattern>vendor/*</exclude-pattern>
<file>src</file>

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
Expand Down
11 changes: 3 additions & 8 deletions phpunit.xml.dist
@@ -1,20 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" bootstrap="Tests/bootstrap.php">
<phpunit colors="true" bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="DoctrineBundle 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>

Expand Down
31 changes: 8 additions & 23 deletions psalm.xml.dist
Expand Up @@ -13,35 +13,20 @@
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
<!-- Deprecated classes, not worth fixing -->
<file name="Command/ImportMappingDoctrineCommand.php"/>
<file name="Command/Proxy/OrmProxyCommand.php"/>
<file name="DependencyInjection/Compiler/WellKnownSchemaFilterPass.php"/>
<file name="src/Command/ImportMappingDoctrineCommand.php"/>
<file name="src/Command/Proxy/OrmProxyCommand.php"/>
<file name="src/DependencyInjection/Compiler/WellKnownSchemaFilterPass.php"/>
</ignoreFiles>
<directory name="CacheWarmer"/>
<directory name="Command"/>
<directory name="Controller"/>
<directory name="DataCollector"/>
<directory name="Dbal"/>
<directory name="DependencyInjection"/>
<directory name="EventSubscriber"/>
<directory name="Mapping"/>
<directory name="Middleware"/>
<directory name="Repository"/>
<directory name="Tests"/>
<directory name="Twig"/>
<file name="ConnectionFactory.php"/>
<file name="DoctrineBundle.php"/>
<file name="ManagerConfigurator.php"/>
<file name="Registry.php"/>
</projectFiles>
<issueHandlers>
<RedundantPropertyInitializationCheck>
<errorLevel type="suppress">
<!-- Properties can be uninitialized in tests if setUp() fails. -->
<directory name="Tests"/>
<directory name="tests"/>
</errorLevel>
</RedundantPropertyInitializationCheck>
<UndefinedClass>
Expand All @@ -63,14 +48,14 @@
<DuplicateClass>
<errorLevel type="suppress">
<!-- Conditional class definition-->
<file name="Repository/RepositoryFactoryCompatibility.php"/>
<file name="Repository/ServiceEntityRepository.php"/>
<file name="src/Repository/RepositoryFactoryCompatibility.php"/>
<file name="src/Repository/ServiceEntityRepository.php"/>
</errorLevel>
</DuplicateClass>
<UndefinedMethod>
<errorLevel type="suppress">
<!-- Too tricky to configure very nested configuration in a way Psalm understands -->
<file name="DependencyInjection/Configuration.php" />
<file name="src/DependencyInjection/Configuration.php" />
</errorLevel>
</UndefinedMethod>
</issueHandlers>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -166,7 +166,7 @@
*/
protected function dbalLoad(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('dbal.xml');

if (empty($config['default_connection'])) {
Expand Down Expand Up @@ -447,7 +447,7 @@
throw new LogicException('To configure the ORM layer, you must first install the doctrine/orm package.');
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('orm.xml');

if (class_exists(AbstractType::class)) {
Expand Down Expand Up @@ -1116,7 +1116,7 @@

public function getXsdValidationBasePath(): string
{
return __DIR__ . '/../Resources/config/schema';
return __DIR__ . '/../../config/schema';
}

public function getNamespace(): string
Expand Down Expand Up @@ -1145,7 +1145,7 @@
return;
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));

Check warning on line 1148 in src/DependencyInjection/DoctrineExtension.php

View check run for this annotation

Codecov / codecov/patch

src/DependencyInjection/DoctrineExtension.php#L1148

Added line #L1148 was not covered by tests
$loader->load('messenger.xml');

// available in Symfony 6.3
Expand Down Expand Up @@ -1186,7 +1186,7 @@
array $connWithProfiling,
array $connWithBacktrace
): void {
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('middlewares.xml');

$loggingMiddlewareAbstractDef = $container->getDefinition('doctrine.dbal.logging_middleware');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -39,7 +39,7 @@ private function createContainer(): ContainerBuilder
{
$container = new ContainerBuilder();

$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../config'));
$loader->load('middlewares.xml');

$container->addCompilerPass(new RemoveLoggingMiddlewarePass());
Expand Down
Expand Up @@ -19,7 +19,7 @@
<entity-manager name="em2" validate-xml-mapping="true">
<mapping name="YamlBundle" dir="Resources/config/doctrine" alias="yml" />
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
dir="%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir="%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias="TestAlias"
/>
</entity-manager>
Expand Down
Expand Up @@ -16,7 +16,7 @@
<mapping name="AttributesBundle" type="attribute" />
<mapping name="YamlBundle" dir="Resources/config/doctrine" alias="yml" />
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
dir="%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir="%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias="TestAlias"
/>
</orm>
Expand Down
Expand Up @@ -20,7 +20,7 @@
<mapping name="AttributesBundle" type="attribute" />
<mapping name="YamlBundle" dir="Resources/config/doctrine" alias="yml" />
<mapping name="manual" type="xml" prefix="Fixtures\Bundles\XmlBundle"
dir="%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir="%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias="TestAlias"
/>
</orm>
Expand Down
Expand Up @@ -22,5 +22,5 @@ doctrine:
manual:
type: xml
prefix: Fixtures\Bundles\XmlBundle
dir: "%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir: "%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias: TestAlias
Expand Up @@ -17,5 +17,5 @@ doctrine:
manual:
type: xml
prefix: Fixtures\Bundles\XmlBundle
dir: "%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir: "%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias: TestAlias
Expand Up @@ -19,5 +19,5 @@ doctrine:
manual:
type: xml
prefix: Fixtures\Bundles\XmlBundle
dir: "%kernel.root_dir%/Tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
dir: "%kernel.root_dir%/tests/DependencyInjection/Fixtures/Bundles/XmlBundle/Resources/config/doctrine"
alias: TestAlias
Expand Up @@ -43,7 +43,7 @@ public function testValidateSchema(string $file): void
$configNode->appendChild($dbalNode);
$dbalDom->appendChild($configNode);

$ret = $dbalDom->schemaValidate(__DIR__ . '/../../Resources/config/schema/doctrine-1.0.xsd');
$ret = $dbalDom->schemaValidate(__DIR__ . '/../../config/schema/doctrine-1.0.xsd');
$this->assertTrue($ret, 'DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.');
$found = true;
}
Expand All @@ -56,7 +56,7 @@ public function testValidateSchema(string $file): void
$configNode->appendChild($ormNode);
$ormDom->appendChild($configNode);

$ret = $ormDom->schemaValidate(__DIR__ . '/../../Resources/config/schema/doctrine-1.0.xsd');
$ret = $ormDom->schemaValidate(__DIR__ . '/../../config/schema/doctrine-1.0.xsd');
$this->assertTrue($ret, 'DoctrineBundle Dependency Injection XMLSchema did not validate this XML instance.');
$found = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/ProfilerTest.php → tests/ProfilerTest.php
Expand Up @@ -50,7 +50,7 @@ public function setUp(): void
$registry->method('getManagers')->willReturn([]);
$this->collector = new DoctrineDataCollector($registry, true, $this->debugDataHolder);

$twigLoaderFilesystem = new FilesystemLoader(__DIR__ . '/../Resources/views/Collector');
$twigLoaderFilesystem = new FilesystemLoader(__DIR__ . '/../templates/Collector');
$twigLoaderFilesystem->addPath(__DIR__ . '/../vendor/symfony/web-profiler-bundle/Resources/views', 'WebProfiler');
$this->twig = new Environment($twigLoaderFilesystem, ['debug' => true, 'strict_variables' => true]);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.