Skip to content

Commit

Permalink
Switch to a modern directory structure
Browse files Browse the repository at this point in the history
Here are the steps I followed:

- `mkdir src`
- `git mv *.php src`
- `git mv Command/ DependencyInjection Loader Purger src`
- adjust autoloading path
- overrode `Bunde::getPath()`
- `git mv Resources/doc/ docs`
- `git mv Resources/config/ config`
- `git mv Tests/ tests`
  • Loading branch information
greg0ire committed Mar 29, 2024
1 parent c27df72 commit 134bd7e
Show file tree
Hide file tree
Showing 31 changed files with 34 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/Tests export-ignore
/tests export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon.dist export-ignore
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
"doctrine/dbal": "< 3"
},
"autoload": {
"psr-4": { "Doctrine\\Bundle\\FixturesBundle\\": "" }
"psr-4": { "Doctrine\\Bundle\\FixturesBundle\\": "src" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Bundle\\FixturesBundle\\Tests\\": "tests" }
},
"config": {
"sort-packages": true,
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!-- Ignore warnings and show progress of the run -->
<arg value="nps"/>

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

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
Expand All @@ -21,15 +21,15 @@


<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix">
<exclude-pattern>FixtureGroupInterface.php</exclude-pattern>
<exclude-pattern>ORMFixtureInterface.php</exclude-pattern>
<exclude-pattern>src/FixtureGroupInterface.php</exclude-pattern>
<exclude-pattern>src/ORMFixtureInterface.php</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>Loader/SymfonyBridgeLoader.php</exclude-pattern>
<exclude-pattern>Command/CommandCompatibility.php</exclude-pattern>
<exclude-pattern>Tests/IntegrationTest.php</exclude-pattern>
<exclude-pattern>src/Loader/SymfonyBridgeLoader.php</exclude-pattern>
<exclude-pattern>src/Command/CommandCompatibility.php</exclude-pattern>
<exclude-pattern>tests/IntegrationTest.php</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>Tests/IntegrationTest.php</exclude-pattern>
<exclude-pattern>tests/IntegrationTest.php</exclude-pattern>
</rule>
</ruleset>
11 changes: 5 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
parameters:
excludePaths:
# Contains an error that is impossible to ignore
- Tests/IntegrationTest.php
- tests/IntegrationTest.php

ignoreErrors:
-
message: "#^Call to an undefined static method Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyBridgeLoader\\:\\:addFixture\\(\\)\\.$#"
count: 1
path: Loader/SymfonyFixturesLoader.php
path: src/Loader/SymfonyFixturesLoader.php

-
message: "#^Call to an undefined static method Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyBridgeLoader\\:\\:getFixtures\\(\\)\\.$#"
count: 1
path: Loader/SymfonyFixturesLoader.php
path: src/Loader/SymfonyFixturesLoader.php

-
message: "#^Class Doctrine\\\\Bundle\\\\FixturesBundle\\\\Loader\\\\SymfonyFixturesLoader does not have a constructor and must be instantiated without any parameters\\.$#"
count: 2
path: Tests/Command/LoadDataFixturesDoctrineCommandTest.php
path: tests/Command/LoadDataFixturesDoctrineCommandTest.php

-
message: "#^Constructor of class Doctrine\\\\Bundle\\\\FixturesBundle\\\\Tests\\\\Fixtures\\\\FooBundle\\\\DataFixtures\\\\RequiredConstructorArgsFixtures has an unused parameter \\$fooRequiredArg\\.$#"
count: 1
path: Tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php

path: tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php
5 changes: 2 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ parameters:
phpVersion: 80100
level: 3
paths:
- .
excludePaths:
- vendor
- src
- tests

includes:
- phpstan-baseline.neon
9 changes: 2 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="DoctrineFixturesBundle 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
15 changes: 4 additions & 11 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@
findUnusedCode="false"
>
<projectFiles>
<directory name="Command" />
<directory name="DependencyInjection" />
<directory name="Loader" />
<directory name="Purger" />
<directory name="Tests" />
<file name="DoctrineFixturesBundle.php" />
<file name="Fixture.php" />
<file name="FixtureGroupInterface.php" />
<file name="ORMFixtureInterface.php" />
<directory name="src" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
Expand All @@ -27,8 +20,8 @@
<issueHandlers>
<DuplicateClass>
<errorLevel type="suppress">
<file name="Command/CommandCompatibility.php"/>
<file name="Tests/IntegrationTest.php"/>
<file name="src/Command/CommandCompatibility.php"/>
<file name="tests/IntegrationTest.php"/>
</errorLevel>
</DuplicateClass>
</issueHandlers>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DoctrineFixturesExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/../config'));

$loader->load('services.xml');

Expand Down
7 changes: 7 additions & 0 deletions DoctrineFixturesBundle.php → src/DoctrineFixturesBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

use function dirname;

class DoctrineFixturesBundle extends Bundle
{
/** @return void */
Expand All @@ -17,4 +19,9 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new FixturesCompilerPass());
$container->addCompilerPass(new PurgerFactoryCompilerPass());
}

public function getPath(): string
{
return dirname(__DIR__);
}
}
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.

0 comments on commit 134bd7e

Please sign in to comment.