diff --git a/composer.json b/composer.json index 53fcb722c..ea0dc53a8 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,8 @@ }, "autoload-dev": { "psr-4": { - "Tests\\Qossmic\\Deptrac\\": "tests/" + "Tests\\Qossmic\\Deptrac\\": "tests/", + "Internal\\Qossmic\\Deptrac\\": "internal/deptrac/" } }, "config": { diff --git a/config/cache.php b/config/cache.php index 460178b8f..d2c9a03be 100644 --- a/config/cache.php +++ b/config/cache.php @@ -2,10 +2,11 @@ declare(strict_types=1); -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceCacheInterface; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceDeferredCacheInterface; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceFileCache; -use Qossmic\Deptrac\Subscriber\CacheableFileSubscriber; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceCacheInterface; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceDeferredCacheInterface; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceFileCache; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\CacheableFileSubscriber; +use Qossmic\Deptrac\Supportive\Console\Application; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; @@ -18,7 +19,7 @@ $services ->set(AstFileReferenceFileCache::class) - ->args(['%deptrac.cache_file%']); + ->args(['%deptrac.cache_file%', Application::VERSION]); $services->alias(AstFileReferenceDeferredCacheInterface::class, AstFileReferenceFileCache::class); $services->alias(AstFileReferenceCacheInterface::class, AstFileReferenceDeferredCacheInterface::class); diff --git a/config/services.php b/config/services.php index f1df8da21..697127d69 100644 --- a/config/services.php +++ b/config/services.php @@ -6,87 +6,88 @@ use PhpParser\Parser; use PhpParser\ParserFactory; use Psr\EventDispatcher\EventDispatcherInterface; -use Qossmic\Deptrac\Analyser\AstMapExtractor; -use Qossmic\Deptrac\Analyser\DependencyLayersAnalyser; -use Qossmic\Deptrac\Analyser\EventHandler\AllowDependencyHandler; -use Qossmic\Deptrac\Analyser\EventHandler\MatchingLayersHandler; -use Qossmic\Deptrac\Analyser\EventHandler\UncoveredDependentHandler; -use Qossmic\Deptrac\Analyser\EventHandler\ViolationHandler; -use Qossmic\Deptrac\Analyser\LayerForTokenAnalyser; -use Qossmic\Deptrac\Analyser\LegacyDependencyLayersAnalyser; -use Qossmic\Deptrac\Analyser\TokenInLayerAnalyser; -use Qossmic\Deptrac\Analyser\UnassignedTokenAnalyser; -use Qossmic\Deptrac\Ast\AstLoader; -use Qossmic\Deptrac\Ast\Parser\AnnotationReferenceExtractor; -use Qossmic\Deptrac\Ast\Parser\AnonymousClassExtractor; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceCacheInterface; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\ClassConstantExtractor; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\ParserInterface; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; -use Qossmic\Deptrac\Configuration\FormatterConfiguration; -use Qossmic\Deptrac\Console\Command\AnalyseCommand; -use Qossmic\Deptrac\Console\Command\AnalyseRunner; -use Qossmic\Deptrac\Console\Command\DebugLayerCommand; -use Qossmic\Deptrac\Console\Command\DebugLayerRunner; -use Qossmic\Deptrac\Console\Command\DebugTokenCommand; -use Qossmic\Deptrac\Console\Command\DebugTokenRunner; -use Qossmic\Deptrac\Console\Command\DebugUnassignedCommand; -use Qossmic\Deptrac\Console\Command\DebugUnassignedRunner; -use Qossmic\Deptrac\Console\Command\InitCommand; -use Qossmic\Deptrac\Dependency\DependencyResolver; -use Qossmic\Deptrac\Dependency\Emitter\ClassDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\ClassSuperglobalDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FileDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FunctionCallDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FunctionDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\UsesDependencyEmitter; -use Qossmic\Deptrac\Dependency\InheritanceFlattener; -use Qossmic\Deptrac\Dependency\TokenResolver; -use Qossmic\Deptrac\File\Dumper; -use Qossmic\Deptrac\File\YmlFileLoader; -use Qossmic\Deptrac\InputCollector\FileInputCollector; -use Qossmic\Deptrac\InputCollector\InputCollectorInterface; -use Qossmic\Deptrac\Layer\Collector\AttributeCollector; -use Qossmic\Deptrac\Layer\Collector\BoolCollector; -use Qossmic\Deptrac\Layer\Collector\ClassCollector; -use Qossmic\Deptrac\Layer\Collector\ClassLikeCollector; -use Qossmic\Deptrac\Layer\Collector\ClassNameRegexCollector; -use Qossmic\Deptrac\Layer\Collector\CollectorProvider; -use Qossmic\Deptrac\Layer\Collector\CollectorResolver; -use Qossmic\Deptrac\Layer\Collector\CollectorResolverInterface; -use Qossmic\Deptrac\Layer\Collector\CollectorTypes; -use Qossmic\Deptrac\Layer\Collector\DirectoryCollector; -use Qossmic\Deptrac\Layer\Collector\ExtendsCollector; -use Qossmic\Deptrac\Layer\Collector\FunctionNameCollector; -use Qossmic\Deptrac\Layer\Collector\GlobCollector; -use Qossmic\Deptrac\Layer\Collector\ImplementsCollector; -use Qossmic\Deptrac\Layer\Collector\InheritanceLevelCollector; -use Qossmic\Deptrac\Layer\Collector\InheritsCollector; -use Qossmic\Deptrac\Layer\Collector\InterfaceCollector; -use Qossmic\Deptrac\Layer\Collector\LayerCollector; -use Qossmic\Deptrac\Layer\Collector\MethodCollector; -use Qossmic\Deptrac\Layer\Collector\SuperglobalCollector; -use Qossmic\Deptrac\Layer\Collector\TraitCollector; -use Qossmic\Deptrac\Layer\Collector\UsesCollector; -use Qossmic\Deptrac\Layer\LayerProvider; -use Qossmic\Deptrac\Layer\LayerResolver; -use Qossmic\Deptrac\Layer\LayerResolverInterface; -use Qossmic\Deptrac\OutputFormatter\BaselineOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\CodeclimateOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\ConsoleOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\FormatterProvider; -use Qossmic\Deptrac\OutputFormatter\GithubActionsOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\GraphVizOutputDisplayFormatter; -use Qossmic\Deptrac\OutputFormatter\GraphVizOutputDotFormatter; -use Qossmic\Deptrac\OutputFormatter\GraphVizOutputHtmlFormatter; -use Qossmic\Deptrac\OutputFormatter\GraphVizOutputImageFormatter; -use Qossmic\Deptrac\OutputFormatter\JsonOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\JUnitOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\TableOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\XMLOutputFormatter; +use Qossmic\Deptrac\Core\Analyser\AstMapExtractor; +use Qossmic\Deptrac\Core\Analyser\DependencyLayersAnalyser; +use Qossmic\Deptrac\Core\Analyser\EventHandler\AllowDependencyHandler; +use Qossmic\Deptrac\Core\Analyser\EventHandler\MatchingLayersHandler; +use Qossmic\Deptrac\Core\Analyser\EventHandler\UncoveredDependentHandler; +use Qossmic\Deptrac\Core\Analyser\EventHandler\ViolationHandler; +use Qossmic\Deptrac\Core\Analyser\LayerForTokenAnalyser; +use Qossmic\Deptrac\Core\Analyser\LegacyDependencyLayersAnalyser; +use Qossmic\Deptrac\Core\Analyser\TokenInLayerAnalyser; +use Qossmic\Deptrac\Core\Analyser\UnassignedTokenAnalyser; +use Qossmic\Deptrac\Core\Ast\AstLoader; +use Qossmic\Deptrac\Core\Ast\Parser\AnnotationReferenceExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\AnonymousClassExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceCacheInterface; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\ClassConstantExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\ParserInterface; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Dependency\DependencyResolver; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FileDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionCallDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\UsesDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\InheritanceFlattener; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\InputCollector\FileInputCollector; +use Qossmic\Deptrac\Core\InputCollector\InputCollectorInterface; +use Qossmic\Deptrac\Core\Layer\Collector\AttributeCollector; +use Qossmic\Deptrac\Core\Layer\Collector\BoolCollector; +use Qossmic\Deptrac\Core\Layer\Collector\ClassCollector; +use Qossmic\Deptrac\Core\Layer\Collector\ClassLikeCollector; +use Qossmic\Deptrac\Core\Layer\Collector\ClassNameRegexCollector; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorProvider; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorResolver; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorResolverInterface; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorTypes; +use Qossmic\Deptrac\Core\Layer\Collector\DirectoryCollector; +use Qossmic\Deptrac\Core\Layer\Collector\ExtendsCollector; +use Qossmic\Deptrac\Core\Layer\Collector\FunctionNameCollector; +use Qossmic\Deptrac\Core\Layer\Collector\GlobCollector; +use Qossmic\Deptrac\Core\Layer\Collector\ImplementsCollector; +use Qossmic\Deptrac\Core\Layer\Collector\InheritanceLevelCollector; +use Qossmic\Deptrac\Core\Layer\Collector\InheritsCollector; +use Qossmic\Deptrac\Core\Layer\Collector\InterfaceCollector; +use Qossmic\Deptrac\Core\Layer\Collector\LayerCollector; +use Qossmic\Deptrac\Core\Layer\Collector\MethodCollector; +use Qossmic\Deptrac\Core\Layer\Collector\SuperglobalCollector; +use Qossmic\Deptrac\Core\Layer\Collector\TraitCollector; +use Qossmic\Deptrac\Core\Layer\Collector\UsesCollector; +use Qossmic\Deptrac\Core\Layer\LayerProvider; +use Qossmic\Deptrac\Core\Layer\LayerResolver; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Supportive\Console\Command\AnalyseCommand; +use Qossmic\Deptrac\Supportive\Console\Command\AnalyseRunner; +use Qossmic\Deptrac\Supportive\Console\Command\DebugLayerCommand; +use Qossmic\Deptrac\Supportive\Console\Command\DebugLayerRunner; +use Qossmic\Deptrac\Supportive\Console\Command\DebugTokenCommand; +use Qossmic\Deptrac\Supportive\Console\Command\DebugTokenRunner; +use Qossmic\Deptrac\Supportive\Console\Command\DebugUnassignedCommand; +use Qossmic\Deptrac\Supportive\Console\Command\DebugUnassignedRunner; +use Qossmic\Deptrac\Supportive\Console\Command\InitCommand; +use Qossmic\Deptrac\Supportive\DependencyInjection\EmitterTypes; +use Qossmic\Deptrac\Supportive\File\Dumper; +use Qossmic\Deptrac\Supportive\File\YmlFileLoader; +use Qossmic\Deptrac\Supportive\OutputFormatter\BaselineOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\CodeclimateOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\FormatterConfiguration; +use Qossmic\Deptrac\Supportive\OutputFormatter\ConsoleOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\FormatterProvider; +use Qossmic\Deptrac\Supportive\OutputFormatter\GithubActionsOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\GraphVizOutputDisplayFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\GraphVizOutputDotFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\GraphVizOutputHtmlFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\GraphVizOutputImageFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\JsonOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\JUnitOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\TableOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\XMLOutputFormatter; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\EventDispatcher\EventDispatcher; use function Symfony\Component\DependencyInjection\Loader\Configurator\param; @@ -160,31 +161,31 @@ ->set(DependencyResolver::class) ->args([ '$config' => param('analyser'), - '$emitterLocator' => tagged_locator('dependency_emitter', null, 'getAlias'), + '$emitterLocator' => tagged_locator('dependency_emitter', 'key'), ]); $services->set(TokenResolver::class); $services->set(InheritanceFlattener::class); $services ->set(ClassDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::CLASS_TOKEN]); $services ->set(ClassSuperglobalDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::CLASS_SUPERGLOBAL_TOKEN]); $services ->set(FileDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::FILE_TOKEN]); $services ->set(FunctionDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::FUNCTION_TOKEN]); $services ->set(FunctionCallDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::FUNCTION_CALL]); $services ->set(FunctionSuperglobalDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::FUNCTION_SUPERGLOBAL_TOKEN]); $services ->set(UsesDependencyEmitter::class) - ->tag('dependency_emitter'); + ->tag('dependency_emitter', ['key' => EmitterTypes::USE_TOKEN]); /* * Layer diff --git a/deptrac.baseline.yaml b/deptrac.baseline.yaml index 307af64cc..0f99787db 100644 --- a/deptrac.baseline.yaml +++ b/deptrac.baseline.yaml @@ -1,2 +1,29 @@ deptrac: - skip_violations: ~ + skip_violations: + Qossmic\Deptrac\Contract\Analyser\ProcessEvent: + - Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Layer\CollectorInterface: + - Qossmic\Deptrac\Core\Ast\AstMap\AstMap + - Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface + Qossmic\Deptrac\Contract\Result\Allowed: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Result\CoveredRule: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Result\Rule: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Result\SkippedViolation: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Result\Uncovered: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Contract\Result\Violation: + - Qossmic\Deptrac\Core\Dependency\DependencyInterface + Qossmic\Deptrac\Core\Analyser\TokenType: + - Qossmic\Deptrac\Supportive\DependencyInjection\EmitterTypes + Qossmic\Deptrac\Supportive\OutputFormatter\ConsoleOutputFormatter: + - Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence + - Qossmic\Deptrac\Core\Dependency\InheritDependency + Qossmic\Deptrac\Supportive\OutputFormatter\GithubActionsOutputFormatter: + - Qossmic\Deptrac\Core\Dependency\InheritDependency + Qossmic\Deptrac\Supportive\OutputFormatter\TableOutputFormatter: + - Qossmic\Deptrac\Core\Dependency\InheritDependency diff --git a/deptrac.php b/deptrac.php index 9bc9dd26c..822648533 100755 --- a/deptrac.php +++ b/deptrac.php @@ -1,7 +1,7 @@ >I: Collect files to analyse + I->>A: List of files to analyse + + A->>As: Create Ast for collected files + alt Cached + As->>As: Load cached "AstMap" + else Not cached + note over As: Will collect all possible connections
regradless of deptrac configuration + As->>As: Apply "ReferenceExtractors" + end + As->>A: "AstMap" for all files + + A->>D: Resolve all dependencies between Ast Nodes + D->>D: Apply all registered "DependencyEmmiters" + D->>A: "DependencyList" of all dependencies + + loop for each dependency + A->>L: Resolve layers for both sides of the dependency + L->>A: One or more layers for each side + A->>A: Build "Result" based on defined ruleset + end +``` + +### InputCollector + +Is responsible for collecting all the files to be analysed. By default, it uses the [`deptrac.paths`](depfile.md#paths) section of the Depfile to determine which files to collect and [`exclude_files`][depfile.md#exclude_files] to exclude filenames matching the specified patterns. + +### Ast + +The Ast module is responsible for parsing all the provided files and building an Abstract Syntax Tree (AST) for those files. The `AstLoader` fetches everything, even if you have configured Deptrac to ignore some parts of the file, e.g. because the class is not in any layer or you configured [`types`](depfile.md#types) to ignore certain things like use-statements. Filtering the found dependencies happens in the next phase. + +The main part of the parsing is done in the `FileReferenceVisior`. This file is primarily concerned with keeping the appropriate scope (are you inside a class or a function) and also keeping track of currently applicable `@template` annotations. You can extend the functionality by adding extractors implementing the `ReferenceExtractorInterface` to build more connections between the nodes. + +The result is an `AstMap` containing all occurrences of found files, classes and functions. This is what gets saved into the `.deptrac.cache` file. + +### Dependency + +The Dependency module is concerned with taking the generated `AstMap` and converting it into a `DependencyList` of applicable dependencies between nodes based on the [`deptrac.analyser.types`](depfile.md#types) section of the Depfile. + +Each type corresponds to an emitter implementing `DependencyEmitterInterface`. + +### Layers + +As the name suggests, this module resolves what layers should each token be a part of. It leverages the [collectors](collectors.md) defined in the [`deptrac.layers`](depfile.md#layers) section of the Depfile. + +### Analyser + +The Analyser orchestrates between these modules. It calls the `InputCollector`, `Ast` and `Dependency` modules to generate a list of relevant dependencies matched to their layers, compares them against the [`deptrac.ruleset`](depfile.md#ruleset) section of the Depfile and finally generates a `Result`, which will be returned in the output. + +The `Result` is a collection of `Allowed`, `Error`, `Warning`, `Violation`, `Skipped` and `Uncovered` Rules. Those are then processed by the [`OutputFormatters`](formatters.md) to give you the desired output you can see when you call a command. diff --git a/docs/examples/Fixture.depfile.yaml b/docs/examples/Fixture.depfile.yaml index 3688d1e5e..14aa6bc8e 100644 --- a/docs/examples/Fixture.depfile.yaml +++ b/docs/examples/Fixture.depfile.yaml @@ -1,5 +1,5 @@ deptrac: - paths: ["../../tests/Dependency/Emitter/Fixtures/"] + paths: ["../../tests/Core/Dependency/Emitter/Fixtures/"] exclude_files: [] layers: - name: Models diff --git a/internal/deptrac/IgnoreDependenciesOnContract.php b/internal/deptrac/IgnoreDependenciesOnContract.php new file mode 100644 index 000000000..5d850410a --- /dev/null +++ b/internal/deptrac/IgnoreDependenciesOnContract.php @@ -0,0 +1,17 @@ +getDependentLayers())) { + $event->stopPropagation(); + } + } +} diff --git a/internal/deptrac/IgnoreDependenciesOnShouldNotHappenException.php b/internal/deptrac/IgnoreDependenciesOnShouldNotHappenException.php new file mode 100644 index 000000000..ee134ae14 --- /dev/null +++ b/internal/deptrac/IgnoreDependenciesOnShouldNotHappenException.php @@ -0,0 +1,17 @@ +getDependentReference()->getToken()->toString()) { + $event->stopPropagation(); + } + } +} diff --git a/stubs/ClassLike.php b/internal/stubs/ClassLike.php similarity index 100% rename from stubs/ClassLike.php rename to internal/stubs/ClassLike.php diff --git a/stubs/Function_.php b/internal/stubs/Function_.php similarity index 100% rename from stubs/Function_.php rename to internal/stubs/Function_.php diff --git a/stubs/Name.php b/internal/stubs/Name.php similarity index 100% rename from stubs/Name.php rename to internal/stubs/Name.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 31e879eaa..0f720586b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,16 +1,16 @@ parameters: ignoreErrors: - - message: "#^@readonly property Qossmic\\\\Deptrac\\\\Ast\\\\AstMap\\\\AstInherit\\:\\:\\$path is assigned outside of the constructor\\.$#" + message: "#^@readonly property Qossmic\\\\Deptrac\\\\Core\\\\Ast\\\\AstMap\\\\AstInherit\\:\\:\\$path is assigned outside of the constructor\\.$#" count: 1 - path: src/Ast/AstMap/AstInherit.php + path: src/Core/Ast/AstMap/AstInherit.php - - message: "#^@readonly property Qossmic\\\\Deptrac\\\\Ast\\\\AstMap\\\\ClassLike\\\\ClassLikeReference\\:\\:\\$fileReference is assigned outside of the constructor\\.$#" + message: "#^@readonly property Qossmic\\\\Deptrac\\\\Core\\\\Ast\\\\AstMap\\\\ClassLike\\\\ClassLikeReference\\:\\:\\$fileReference is assigned outside of the constructor\\.$#" count: 1 - path: src/Ast/AstMap/ClassLike/ClassLikeReference.php + path: src/Core/Ast/AstMap/ClassLike/ClassLikeReference.php - - message: "#^@readonly property Qossmic\\\\Deptrac\\\\Ast\\\\AstMap\\\\FunctionLike\\\\FunctionLikeReference\\:\\:\\$fileReference is assigned outside of the constructor\\.$#" + message: "#^@readonly property Qossmic\\\\Deptrac\\\\Core\\\\Ast\\\\AstMap\\\\FunctionLike\\\\FunctionLikeReference\\:\\:\\$fileReference is assigned outside of the constructor\\.$#" count: 1 - path: src/Ast/AstMap/FunctionLike/FunctionLikeReference.php + path: src/Core/Ast/AstMap/FunctionLike/FunctionLikeReference.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 465770487..16d07d6cf 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -12,6 +12,6 @@ parameters: level: max paths: [src] stubFiles: - - stubs/Function_.php - - stubs/ClassLike.php - - stubs/Name.php + - internal/stubs/Function_.php + - internal/stubs/ClassLike.php + - internal/stubs/Name.php diff --git a/src/Configuration/Exception/InvalidConfigurationException.php b/src/Configuration/Exception/InvalidConfigurationException.php deleted file mode 100644 index 5bb386107..000000000 --- a/src/Configuration/Exception/InvalidConfigurationException.php +++ /dev/null @@ -1,31 +0,0 @@ -toString(), + $tokenName, implode('", "', $layerNames) )); } diff --git a/src/Analyser/AstMapExtractor.php b/src/Core/Analyser/AstMapExtractor.php similarity index 77% rename from src/Analyser/AstMapExtractor.php rename to src/Core/Analyser/AstMapExtractor.php index b2d71ba34..6aec6b018 100644 --- a/src/Analyser/AstMapExtractor.php +++ b/src/Core/Analyser/AstMapExtractor.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Ast\AstLoader; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\InputCollector\InputCollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstLoader; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\InputCollector\InputCollectorInterface; /** * @internal diff --git a/src/Analyser/DependencyLayersAnalyser.php b/src/Core/Analyser/DependencyLayersAnalyser.php similarity index 84% rename from src/Analyser/DependencyLayersAnalyser.php rename to src/Core/Analyser/DependencyLayersAnalyser.php index 0d3346f98..f592e23ba 100644 --- a/src/Analyser/DependencyLayersAnalyser.php +++ b/src/Core/Analyser/DependencyLayersAnalyser.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; use Psr\EventDispatcher\EventDispatcherInterface; -use Qossmic\Deptrac\Analyser\Event\PostProcessEvent; -use Qossmic\Deptrac\Analyser\Event\ProcessEvent; -use Qossmic\Deptrac\Dependency\DependencyResolver; -use Qossmic\Deptrac\Dependency\TokenResolver; -use Qossmic\Deptrac\Layer\LayerResolverInterface; -use Qossmic\Deptrac\Result\Result; -use Qossmic\Deptrac\Result\Warning; +use Qossmic\Deptrac\Contract\Analyser\PostProcessEvent; +use Qossmic\Deptrac\Contract\Analyser\ProcessEvent; +use Qossmic\Deptrac\Contract\Result\Result; +use Qossmic\Deptrac\Contract\Result\Warning; +use Qossmic\Deptrac\Core\Dependency\DependencyResolver; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; use function count; class DependencyLayersAnalyser @@ -54,7 +54,7 @@ public function process(): Result $dependerLayers = array_keys($this->dependerLayerResolver->getLayersForReference($dependerRef, $astMap)); if (!isset($warnings[$depender->toString()]) && count($dependerLayers) > 1) { - $warnings[$depender->toString()] = Warning::tokenIsInMoreThanOneLayer($depender, $dependerLayers); + $warnings[$depender->toString()] = Warning::tokenIsInMoreThanOneLayer($depender->toString(), $dependerLayers); } $dependent = $dependency->getDependent(); diff --git a/src/Analyser/EventHandler/AllowDependencyHandler.php b/src/Core/Analyser/EventHandler/AllowDependencyHandler.php similarity index 81% rename from src/Analyser/EventHandler/AllowDependencyHandler.php rename to src/Core/Analyser/EventHandler/AllowDependencyHandler.php index e764355b2..51f9bf180 100644 --- a/src/Analyser/EventHandler/AllowDependencyHandler.php +++ b/src/Core/Analyser/EventHandler/AllowDependencyHandler.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser\EventHandler; +namespace Qossmic\Deptrac\Core\Analyser\EventHandler; -use Qossmic\Deptrac\Analyser\Event\ProcessEvent; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Layer\Exception\CircularReferenceException; -use Qossmic\Deptrac\Layer\LayerProvider; -use Qossmic\Deptrac\Result\Allowed; -use Qossmic\Deptrac\Result\Error; +use Qossmic\Deptrac\Contract\Analyser\ProcessEvent; +use Qossmic\Deptrac\Contract\Result\Allowed; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Layer\Exception\CircularReferenceException; +use Qossmic\Deptrac\Core\Layer\LayerProvider; use function in_array; /** diff --git a/src/Analyser/EventHandler/MatchingLayersHandler.php b/src/Core/Analyser/EventHandler/MatchingLayersHandler.php similarity index 83% rename from src/Analyser/EventHandler/MatchingLayersHandler.php rename to src/Core/Analyser/EventHandler/MatchingLayersHandler.php index c911528b8..fd79f2326 100644 --- a/src/Analyser/EventHandler/MatchingLayersHandler.php +++ b/src/Core/Analyser/EventHandler/MatchingLayersHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser\EventHandler; +namespace Qossmic\Deptrac\Core\Analyser\EventHandler; -use Qossmic\Deptrac\Analyser\Event\ProcessEvent; +use Qossmic\Deptrac\Contract\Analyser\ProcessEvent; /** * @internal diff --git a/src/Analyser/EventHandler/SkippedViolationHelper.php b/src/Core/Analyser/EventHandler/SkippedViolationHelper.php similarity index 95% rename from src/Analyser/EventHandler/SkippedViolationHelper.php rename to src/Core/Analyser/EventHandler/SkippedViolationHelper.php index 08f13003e..3a6010b75 100644 --- a/src/Analyser/EventHandler/SkippedViolationHelper.php +++ b/src/Core/Analyser/EventHandler/SkippedViolationHelper.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser\EventHandler; +namespace Qossmic\Deptrac\Core\Analyser\EventHandler; use function in_array; diff --git a/src/Analyser/EventHandler/UncoveredDependentHandler.php b/src/Core/Analyser/EventHandler/UncoveredDependentHandler.php similarity index 85% rename from src/Analyser/EventHandler/UncoveredDependentHandler.php rename to src/Core/Analyser/EventHandler/UncoveredDependentHandler.php index e999b71c7..5ad65035b 100644 --- a/src/Analyser/EventHandler/UncoveredDependentHandler.php +++ b/src/Core/Analyser/EventHandler/UncoveredDependentHandler.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser\EventHandler; +namespace Qossmic\Deptrac\Core\Analyser\EventHandler; use JetBrains\PHPStormStub\PhpStormStubsMap; -use Qossmic\Deptrac\Analyser\Event\ProcessEvent; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Result\Uncovered; +use Qossmic\Deptrac\Contract\Analyser\ProcessEvent; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; /** * @internal diff --git a/src/Analyser/EventHandler/ViolationHandler.php b/src/Core/Analyser/EventHandler/ViolationHandler.php similarity index 84% rename from src/Analyser/EventHandler/ViolationHandler.php rename to src/Core/Analyser/EventHandler/ViolationHandler.php index 3786a6481..889a12fce 100644 --- a/src/Analyser/EventHandler/ViolationHandler.php +++ b/src/Core/Analyser/EventHandler/ViolationHandler.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser\EventHandler; +namespace Qossmic\Deptrac\Core\Analyser\EventHandler; -use Qossmic\Deptrac\Analyser\Event\PostProcessEvent; -use Qossmic\Deptrac\Analyser\Event\ProcessEvent; -use Qossmic\Deptrac\Result\Error; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\Analyser\PostProcessEvent; +use Qossmic\Deptrac\Contract\Analyser\ProcessEvent; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Violation; use function sprintf; /** diff --git a/src/Console/Exception/InvalidTokenException.php b/src/Core/Analyser/InvalidTokenException.php similarity index 84% rename from src/Console/Exception/InvalidTokenException.php rename to src/Core/Analyser/InvalidTokenException.php index b85bf33b6..17bdd3ad4 100644 --- a/src/Console/Exception/InvalidTokenException.php +++ b/src/Core/Analyser/InvalidTokenException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Console\Exception; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use function implode; diff --git a/src/Analyser/LayerForTokenAnalyser.php b/src/Core/Analyser/LayerForTokenAnalyser.php similarity index 88% rename from src/Analyser/LayerForTokenAnalyser.php rename to src/Core/Analyser/LayerForTokenAnalyser.php index 9e88eb35f..14bfe5a40 100644 --- a/src/Analyser/LayerForTokenAnalyser.php +++ b/src/Core/Analyser/LayerForTokenAnalyser.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Dependency\TokenResolver; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; -use Qossmic\Deptrac\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; use function array_values; use function ksort; use function natcasesort; diff --git a/src/Analyser/LegacyDependencyLayersAnalyser.php b/src/Core/Analyser/LegacyDependencyLayersAnalyser.php similarity index 84% rename from src/Analyser/LegacyDependencyLayersAnalyser.php rename to src/Core/Analyser/LegacyDependencyLayersAnalyser.php index bbf595959..ea6fd37c6 100644 --- a/src/Analyser/LegacyDependencyLayersAnalyser.php +++ b/src/Core/Analyser/LegacyDependencyLayersAnalyser.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\Rule; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\Rule; use function array_merge; use function array_reduce; use function array_values; diff --git a/src/Analyser/TokenInLayerAnalyser.php b/src/Core/Analyser/TokenInLayerAnalyser.php similarity index 89% rename from src/Analyser/TokenInLayerAnalyser.php rename to src/Core/Analyser/TokenInLayerAnalyser.php index bf71098dc..4d0f510c5 100644 --- a/src/Analyser/TokenInLayerAnalyser.php +++ b/src/Core/Analyser/TokenInLayerAnalyser.php @@ -2,11 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Dependency\DependencyResolver; -use Qossmic\Deptrac\Dependency\TokenResolver; -use Qossmic\Deptrac\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; use function array_values; use function in_array; use function natcasesort; @@ -23,7 +22,7 @@ class TokenInLayerAnalyser private array $tokenTypes; /** - * @param array{types?: array} $config + * @param array{types: array} $config */ public function __construct( AstMapExtractor $astMapExtractor, @@ -34,7 +33,6 @@ public function __construct( $this->astMapExtractor = $astMapExtractor; $this->tokenResolver = $tokenResolver; $this->layerResolver = $layerResolver; - $emitters = array_merge(DependencyResolver::DEFAULT_EMITTERS, $config); $this->tokenTypes = array_filter( array_map( static function (string $emitterType): ?string { @@ -42,7 +40,7 @@ static function (string $emitterType): ?string { return null === $tokenType ? null : $tokenType->value; }, - $emitters['types'] + $config['types'] ) ); } diff --git a/src/Analyser/TokenType.php b/src/Core/Analyser/TokenType.php similarity index 89% rename from src/Analyser/TokenType.php rename to src/Core/Analyser/TokenType.php index eb0abb1bd..2757b9e7e 100644 --- a/src/Analyser/TokenType.php +++ b/src/Core/Analyser/TokenType.php @@ -2,10 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Console\Exception\InvalidTokenException; -use Qossmic\Deptrac\Dependency\Emitter\EmitterTypes; +use Qossmic\Deptrac\Supportive\DependencyInjection\EmitterTypes; /** * @psalm-immutable diff --git a/src/Analyser/UnassignedTokenAnalyser.php b/src/Core/Analyser/UnassignedTokenAnalyser.php similarity index 89% rename from src/Analyser/UnassignedTokenAnalyser.php rename to src/Core/Analyser/UnassignedTokenAnalyser.php index 7a5b8407e..7d306b406 100644 --- a/src/Analyser/UnassignedTokenAnalyser.php +++ b/src/Core/Analyser/UnassignedTokenAnalyser.php @@ -2,11 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Analyser; +namespace Qossmic\Deptrac\Core\Analyser; -use Qossmic\Deptrac\Dependency\DependencyResolver; -use Qossmic\Deptrac\Dependency\TokenResolver; -use Qossmic\Deptrac\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; use function array_values; use function natcasesort; @@ -22,7 +21,7 @@ class UnassignedTokenAnalyser private array $tokenTypes; /** - * @param array{types?: array} $config + * @param array{types: array} $config */ public function __construct( AstMapExtractor $astMapExtractor, @@ -33,7 +32,6 @@ public function __construct( $this->astMapExtractor = $astMapExtractor; $this->tokenResolver = $tokenResolver; $this->layerResolver = $layerResolver; - $emitters = array_merge(DependencyResolver::DEFAULT_EMITTERS, $config); $this->tokenTypes = array_filter( array_map( static function (string $emitterType): ?string { @@ -41,7 +39,7 @@ static function (string $emitterType): ?string { return null === $tokenType ? null : $tokenType->value; }, - $emitters['types'] + $config['types'] ) ); } diff --git a/src/Ast/AstLoader.php b/src/Core/Ast/AstLoader.php similarity index 76% rename from src/Ast/AstLoader.php rename to src/Core/Ast/AstLoader.php index 39e25fd04..8f701152b 100644 --- a/src/Ast/AstLoader.php +++ b/src/Core/Ast/AstLoader.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast; +namespace Qossmic\Deptrac\Core\Ast; use PhpParser\Error; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\Event\AstFileAnalysedEvent; -use Qossmic\Deptrac\Ast\Event\AstFileSyntaxErrorEvent; -use Qossmic\Deptrac\Ast\Event\PostCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Event\PreCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Parser\ParserInterface; +use Qossmic\Deptrac\Contract\Ast\AstFileAnalysedEvent; +use Qossmic\Deptrac\Contract\Ast\AstFileSyntaxErrorEvent; +use Qossmic\Deptrac\Contract\Ast\PostCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Ast\PreCreateAstMapEvent; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\Parser\ParserInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class AstLoader diff --git a/src/Ast/AstMap/AstInherit.php b/src/Core/Ast/AstMap/AstInherit.php similarity index 96% rename from src/Ast/AstMap/AstInherit.php rename to src/Core/Ast/AstMap/AstInherit.php index 07a9ed363..e503098da 100644 --- a/src/Ast/AstMap/AstInherit.php +++ b/src/Core/Ast/AstMap/AstInherit.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; use function array_reverse; use function implode; use function sprintf; diff --git a/src/Ast/AstMap/AstMap.php b/src/Core/Ast/AstMap/AstMap.php similarity index 91% rename from src/Ast/AstMap/AstMap.php rename to src/Core/Ast/AstMap/AstMap.php index 0e808f486..f3c1533be 100644 --- a/src/Ast/AstMap/AstMap.php +++ b/src/Core/Ast/AstMap/AstMap.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; use ArrayObject; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\File\FileToken; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; use SplStack; class AstMap diff --git a/src/Ast/AstMap/ClassLike/ClassLikeReference.php b/src/Core/Ast/AstMap/ClassLike/ClassLikeReference.php similarity index 87% rename from src/Ast/AstMap/ClassLike/ClassLikeReference.php rename to src/Core/Ast/AstMap/ClassLike/ClassLikeReference.php index fe8cabbd5..5c7b67532 100644 --- a/src/Ast/AstMap/ClassLike/ClassLikeReference.php +++ b/src/Core/Ast/AstMap/ClassLike/ClassLikeReference.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\ClassLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\ClassLike; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; /** * @psalm-immutable diff --git a/src/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php b/src/Core/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php similarity index 94% rename from src/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php rename to src/Core/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php index 65a353d2e..82f54d675 100644 --- a/src/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php +++ b/src/Core/Ast/AstMap/ClassLike/ClassLikeReferenceBuilder.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\ClassLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\ClassLike; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; final class ClassLikeReferenceBuilder extends ReferenceBuilder { diff --git a/src/Ast/AstMap/ClassLike/ClassLikeToken.php b/src/Core/Ast/AstMap/ClassLike/ClassLikeToken.php similarity index 86% rename from src/Ast/AstMap/ClassLike/ClassLikeToken.php rename to src/Core/Ast/AstMap/ClassLike/ClassLikeToken.php index b7842d944..e75f922f0 100644 --- a/src/Ast/AstMap/ClassLike/ClassLikeToken.php +++ b/src/Core/Ast/AstMap/ClassLike/ClassLikeToken.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\ClassLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\ClassLike; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; final class ClassLikeToken implements TokenInterface { diff --git a/src/Ast/AstMap/ClassLike/ClassLikeType.php b/src/Core/Ast/AstMap/ClassLike/ClassLikeType.php similarity index 57% rename from src/Ast/AstMap/ClassLike/ClassLikeType.php rename to src/Core/Ast/AstMap/ClassLike/ClassLikeType.php index 7a5d91c3c..2f428fd35 100644 --- a/src/Ast/AstMap/ClassLike/ClassLikeType.php +++ b/src/Core/Ast/AstMap/ClassLike/ClassLikeType.php @@ -2,13 +2,17 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\ClassLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\ClassLike; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; -use Qossmic\Deptrac\Layer\Collector\CollectorTypes; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; final class ClassLikeType implements TokenInterface { + private const TYPE_CLASSLIKE = 'classLike'; + private const TYPE_CLASS = 'class'; + private const TYPE_INTERFACE = 'interface'; + private const TYPE_TRAIT = 'trait'; + private string $type; private function __construct(string $type) @@ -18,22 +22,22 @@ private function __construct(string $type) public static function classLike(): self { - return new self(CollectorTypes::TYPE_CLASSLIKE); + return new self(self::TYPE_CLASSLIKE); } public static function class(): self { - return new self(CollectorTypes::TYPE_CLASS); + return new self(self::TYPE_CLASS); } public static function interface(): self { - return new self(CollectorTypes::TYPE_INTERFACE); + return new self(self::TYPE_INTERFACE); } public static function trait(): self { - return new self(CollectorTypes::TYPE_TRAIT); + return new self(self::TYPE_TRAIT); } public function matches(ClassLikeType $type): bool diff --git a/src/Ast/AstMap/DependencyToken.php b/src/Core/Ast/AstMap/DependencyToken.php similarity index 97% rename from src/Ast/AstMap/DependencyToken.php rename to src/Core/Ast/AstMap/DependencyToken.php index 89651011e..2a8efc7fd 100644 --- a/src/Ast/AstMap/DependencyToken.php +++ b/src/Core/Ast/AstMap/DependencyToken.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; /** * @psalm-immutable diff --git a/src/Ast/AstMap/File/FileReference.php b/src/Core/Ast/AstMap/File/FileReference.php similarity index 85% rename from src/Ast/AstMap/File/FileReference.php rename to src/Core/Ast/AstMap/File/FileReference.php index 202fe430b..0e0be3f52 100644 --- a/src/Ast/AstMap/File/FileReference.php +++ b/src/Core/Ast/AstMap/File/FileReference.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\File; +namespace Qossmic\Deptrac\Core\Ast\AstMap\File; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; /** * @psalm-immutable diff --git a/src/Ast/AstMap/File/FileReferenceBuilder.php b/src/Core/Ast/AstMap/File/FileReferenceBuilder.php similarity index 88% rename from src/Ast/AstMap/File/FileReferenceBuilder.php rename to src/Core/Ast/AstMap/File/FileReferenceBuilder.php index f6195a490..8cf498399 100644 --- a/src/Ast/AstMap/File/FileReferenceBuilder.php +++ b/src/Core/Ast/AstMap/File/FileReferenceBuilder.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\File; - -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReferenceBuilder; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReferenceBuilder; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +namespace Qossmic\Deptrac\Core\Ast\AstMap\File; + +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; final class FileReferenceBuilder extends ReferenceBuilder { diff --git a/src/Ast/AstMap/File/FileToken.php b/src/Core/Ast/AstMap/File/FileToken.php similarity index 86% rename from src/Ast/AstMap/File/FileToken.php rename to src/Core/Ast/AstMap/File/FileToken.php index 784f4cd14..f0d3633e7 100644 --- a/src/Ast/AstMap/File/FileToken.php +++ b/src/Core/Ast/AstMap/File/FileToken.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\File; +namespace Qossmic\Deptrac\Core\Ast\AstMap\File; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; use Symfony\Component\Filesystem\Path; final class FileToken implements TokenInterface diff --git a/src/Ast/AstMap/FileOccurrence.php b/src/Core/Ast/AstMap/FileOccurrence.php similarity index 93% rename from src/Ast/AstMap/FileOccurrence.php rename to src/Core/Ast/AstMap/FileOccurrence.php index c1aeebff0..a8fbaeecd 100644 --- a/src/Ast/AstMap/FileOccurrence.php +++ b/src/Core/Ast/AstMap/FileOccurrence.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; /** * @psalm-immutable diff --git a/src/Ast/AstMap/FunctionLike/FunctionLikeReference.php b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeReference.php similarity index 79% rename from src/Ast/AstMap/FunctionLike/FunctionLikeReference.php rename to src/Core/Ast/AstMap/FunctionLike/FunctionLikeReference.php index 9e6da79ea..9802b3d0c 100644 --- a/src/Ast/AstMap/FunctionLike/FunctionLikeReference.php +++ b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeReference.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\FunctionLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; /** * @psalm-immutable diff --git a/src/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php similarity index 88% rename from src/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php rename to src/Core/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php index 7908d4d26..e7433e86d 100644 --- a/src/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php +++ b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeReferenceBuilder.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\FunctionLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; class FunctionLikeReferenceBuilder extends ReferenceBuilder { diff --git a/src/Ast/AstMap/FunctionLike/FunctionLikeToken.php b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeToken.php similarity index 87% rename from src/Ast/AstMap/FunctionLike/FunctionLikeToken.php rename to src/Core/Ast/AstMap/FunctionLike/FunctionLikeToken.php index 3616dc764..84a6db14e 100644 --- a/src/Ast/AstMap/FunctionLike/FunctionLikeToken.php +++ b/src/Core/Ast/AstMap/FunctionLike/FunctionLikeToken.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\FunctionLike; +namespace Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; final class FunctionLikeToken implements TokenInterface { diff --git a/src/Ast/AstMap/ReferenceBuilder.php b/src/Core/Ast/AstMap/ReferenceBuilder.php similarity index 96% rename from src/Ast/AstMap/ReferenceBuilder.php rename to src/Core/Ast/AstMap/ReferenceBuilder.php index 6678612e2..bea5519dc 100644 --- a/src/Ast/AstMap/ReferenceBuilder.php +++ b/src/Core/Ast/AstMap/ReferenceBuilder.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Ast\AstMap\Variable\SuperGlobalToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\SuperGlobalToken; abstract class ReferenceBuilder { diff --git a/src/Ast/AstMap/TokenInterface.php b/src/Core/Ast/AstMap/TokenInterface.php similarity index 80% rename from src/Ast/AstMap/TokenInterface.php rename to src/Core/Ast/AstMap/TokenInterface.php index bff95e7e5..7445bf767 100644 --- a/src/Ast/AstMap/TokenInterface.php +++ b/src/Core/Ast/AstMap/TokenInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; /** * Represents an AST-Token, which can be referenced as dependency. diff --git a/src/Ast/AstMap/TokenReferenceInterface.php b/src/Core/Ast/AstMap/TokenReferenceInterface.php similarity index 67% rename from src/Ast/AstMap/TokenReferenceInterface.php rename to src/Core/Ast/AstMap/TokenReferenceInterface.php index bf99bd238..7d1131720 100644 --- a/src/Ast/AstMap/TokenReferenceInterface.php +++ b/src/Core/Ast/AstMap/TokenReferenceInterface.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap; +namespace Qossmic\Deptrac\Core\Ast\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; /** * @psalm-immutable diff --git a/src/Ast/AstMap/Variable/SuperGlobalToken.php b/src/Core/Ast/AstMap/Variable/SuperGlobalToken.php similarity index 82% rename from src/Ast/AstMap/Variable/SuperGlobalToken.php rename to src/Core/Ast/AstMap/Variable/SuperGlobalToken.php index aff96a425..1b6f5c1e1 100644 --- a/src/Ast/AstMap/Variable/SuperGlobalToken.php +++ b/src/Core/Ast/AstMap/Variable/SuperGlobalToken.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\Variable; +namespace Qossmic\Deptrac\Core\Ast\AstMap\Variable; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; final class SuperGlobalToken implements TokenInterface { diff --git a/src/Ast/AstMap/Variable/VariableReference.php b/src/Core/Ast/AstMap/Variable/VariableReference.php similarity index 67% rename from src/Ast/AstMap/Variable/VariableReference.php rename to src/Core/Ast/AstMap/Variable/VariableReference.php index 48fcec583..42f3b696c 100644 --- a/src/Ast/AstMap/Variable/VariableReference.php +++ b/src/Core/Ast/AstMap/Variable/VariableReference.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\AstMap\Variable; +namespace Qossmic\Deptrac\Core\Ast\AstMap\Variable; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; /** * @psalm-immutable diff --git a/src/Ast/Parser/AnnotationReferenceExtractor.php b/src/Core/Ast/Parser/AnnotationReferenceExtractor.php similarity index 96% rename from src/Ast/Parser/AnnotationReferenceExtractor.php rename to src/Core/Ast/Parser/AnnotationReferenceExtractor.php index 55438d214..95756522e 100644 --- a/src/Ast/Parser/AnnotationReferenceExtractor.php +++ b/src/Core/Ast/Parser/AnnotationReferenceExtractor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Comment\Doc; use PhpParser\Node; @@ -15,7 +15,7 @@ use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; class AnnotationReferenceExtractor implements ReferenceExtractorInterface { diff --git a/src/Ast/Parser/AnonymousClassExtractor.php b/src/Core/Ast/Parser/AnonymousClassExtractor.php similarity index 90% rename from src/Ast/Parser/AnonymousClassExtractor.php rename to src/Core/Ast/Parser/AnonymousClassExtractor.php index 8e86d72f9..a48c5db19 100644 --- a/src/Ast/Parser/AnonymousClassExtractor.php +++ b/src/Core/Ast/Parser/AnonymousClassExtractor.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; class AnonymousClassExtractor implements ReferenceExtractorInterface { diff --git a/src/Ast/Parser/Cache/AstFileReferenceCacheInterface.php b/src/Core/Ast/Parser/Cache/AstFileReferenceCacheInterface.php similarity index 62% rename from src/Ast/Parser/Cache/AstFileReferenceCacheInterface.php rename to src/Core/Ast/Parser/Cache/AstFileReferenceCacheInterface.php index 929fd19a0..9d9ecd682 100644 --- a/src/Ast/Parser/Cache/AstFileReferenceCacheInterface.php +++ b/src/Core/Ast/Parser/Cache/AstFileReferenceCacheInterface.php @@ -1,8 +1,8 @@ */ private array $parsedFiles = []; - public function __construct(string $cacheFile) + private string $cacheVersion; + + public function __construct(string $cacheFile, string $cacheVersion) { $this->cache = []; $this->cacheFile = $cacheFile; + $this->cacheVersion = $cacheVersion; } public function get(string $filepath): ?FileReference @@ -93,7 +95,7 @@ public function load(): void $this->loaded = true; - if (null === $cache || Application::VERSION !== $cache['version']) { + if (null === $cache || $this->cacheVersion !== $cache['version']) { return; } @@ -157,7 +159,7 @@ static function (array $data): array { $this->cacheFile, json_encode( [ - 'version' => Application::VERSION, + 'version' => $this->cacheVersion, 'payload' => $payload, ] ) diff --git a/src/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php b/src/Core/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php similarity index 84% rename from src/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php rename to src/Core/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php index f9d0a9388..e258279b0 100644 --- a/src/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php +++ b/src/Core/Ast/Parser/Cache/AstFileReferenceInMemoryCache.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser\Cache; +namespace Qossmic\Deptrac\Core\Ast\Parser\Cache; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; final class AstFileReferenceInMemoryCache implements AstFileReferenceCacheInterface { diff --git a/src/Subscriber/CacheableFileSubscriber.php b/src/Core/Ast/Parser/Cache/CacheableFileSubscriber.php similarity index 81% rename from src/Subscriber/CacheableFileSubscriber.php rename to src/Core/Ast/Parser/Cache/CacheableFileSubscriber.php index 10be92c19..74bb3b210 100644 --- a/src/Subscriber/CacheableFileSubscriber.php +++ b/src/Core/Ast/Parser/Cache/CacheableFileSubscriber.php @@ -2,11 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Subscriber; +namespace Qossmic\Deptrac\Core\Ast\Parser\Cache; -use Qossmic\Deptrac\Ast\Event\PostCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Event\PreCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceDeferredCacheInterface; +use Qossmic\Deptrac\Contract\Ast\PostCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Ast\PreCreateAstMapEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class CacheableFileSubscriber implements EventSubscriberInterface diff --git a/src/Ast/Parser/ClassConstantExtractor.php b/src/Core/Ast/Parser/ClassConstantExtractor.php similarity index 85% rename from src/Ast/Parser/ClassConstantExtractor.php rename to src/Core/Ast/Parser/ClassConstantExtractor.php index 984548ff0..e69d12739 100644 --- a/src/Ast/Parser/ClassConstantExtractor.php +++ b/src/Core/Ast/Parser/ClassConstantExtractor.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Node; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Name; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; class ClassConstantExtractor implements ReferenceExtractorInterface { diff --git a/src/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php b/src/Core/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php similarity index 96% rename from src/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php rename to src/Core/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php index 04f3c0114..d7fa3f9c0 100644 --- a/src/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php +++ b/src/Core/Ast/Parser/NikicPhpParser/FileReferenceVisitor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser\NikicPhpParser; +namespace Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser; use PhpParser\Node; use PhpParser\Node\Expr\Instanceof_; @@ -27,13 +27,13 @@ use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReferenceBuilder; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; -use Qossmic\Deptrac\Ast\AstMap\Variable\SuperGlobalToken; -use Qossmic\Deptrac\Ast\Parser\ReferenceExtractorInterface; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; -use Qossmic\Deptrac\Ast\Parser\TypeScope; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\SuperGlobalToken; +use Qossmic\Deptrac\Core\Ast\Parser\ReferenceExtractorInterface; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\Parser\TypeScope; class FileReferenceVisitor extends NodeVisitorAbstract { diff --git a/src/Ast/Parser/NikicPhpParser/NikicPhpParser.php b/src/Core/Ast/Parser/NikicPhpParser/NikicPhpParser.php similarity index 85% rename from src/Ast/Parser/NikicPhpParser/NikicPhpParser.php rename to src/Core/Ast/Parser/NikicPhpParser/NikicPhpParser.php index d6a7c5e3b..4ff57961f 100644 --- a/src/Ast/Parser/NikicPhpParser/NikicPhpParser.php +++ b/src/Core/Ast/Parser/NikicPhpParser/NikicPhpParser.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser\NikicPhpParser; +namespace Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser; use PhpParser\Node; use PhpParser\Node\Identifier; @@ -11,15 +11,15 @@ use PhpParser\NodeVisitor\FindingVisitor; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceCacheInterface; -use Qossmic\Deptrac\Ast\Parser\ParserInterface; -use Qossmic\Deptrac\Ast\Parser\ReferenceExtractorInterface; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; -use Qossmic\Deptrac\File\FileReader; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceCacheInterface; +use Qossmic\Deptrac\Core\Ast\Parser\ParserInterface; +use Qossmic\Deptrac\Core\Ast\Parser\ReferenceExtractorInterface; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Supportive\File\FileReader; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; class NikicPhpParser implements ParserInterface { diff --git a/src/Ast/Parser/ParserInterface.php b/src/Core/Ast/Parser/ParserInterface.php similarity index 55% rename from src/Ast/Parser/ParserInterface.php rename to src/Core/Ast/Parser/ParserInterface.php index e2cc6e3a5..b335b6d5e 100644 --- a/src/Ast/Parser/ParserInterface.php +++ b/src/Core/Ast/Parser/ParserInterface.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; interface ParserInterface { diff --git a/src/Ast/Parser/ReferenceExtractorInterface.php b/src/Core/Ast/Parser/ReferenceExtractorInterface.php similarity index 67% rename from src/Ast/Parser/ReferenceExtractorInterface.php rename to src/Core/Ast/Parser/ReferenceExtractorInterface.php index 5d87efec7..d280611f9 100644 --- a/src/Ast/Parser/ReferenceExtractorInterface.php +++ b/src/Core/Ast/Parser/ReferenceExtractorInterface.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Node; -use Qossmic\Deptrac\Ast\AstMap\ReferenceBuilder; +use Qossmic\Deptrac\Core\Ast\AstMap\ReferenceBuilder; interface ReferenceExtractorInterface { diff --git a/src/Ast/Parser/TypeResolver.php b/src/Core/Ast/Parser/TypeResolver.php similarity index 99% rename from src/Ast/Parser/TypeResolver.php rename to src/Core/Ast/Parser/TypeResolver.php index fcaf9095f..20282faa4 100644 --- a/src/Ast/Parser/TypeResolver.php +++ b/src/Core/Ast/Parser/TypeResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Type; diff --git a/src/Ast/Parser/TypeScope.php b/src/Core/Ast/Parser/TypeScope.php similarity index 93% rename from src/Ast/Parser/TypeScope.php rename to src/Core/Ast/Parser/TypeScope.php index 05b2a76f4..8936ccd4f 100644 --- a/src/Ast/Parser/TypeScope.php +++ b/src/Core/Ast/Parser/TypeScope.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Parser; +namespace Qossmic\Deptrac\Core\Ast\Parser; class TypeScope { diff --git a/src/Dependency/Dependency.php b/src/Core/Dependency/Dependency.php similarity index 84% rename from src/Dependency/Dependency.php rename to src/Core/Dependency/Dependency.php index aa0fa478e..9bc480460 100644 --- a/src/Dependency/Dependency.php +++ b/src/Core/Dependency/Dependency.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; /** * @psalm-immutable diff --git a/src/Dependency/DependencyInterface.php b/src/Core/Dependency/DependencyInterface.php similarity index 63% rename from src/Dependency/DependencyInterface.php rename to src/Core/Dependency/DependencyInterface.php index 842adca26..1464803ce 100644 --- a/src/Dependency/DependencyInterface.php +++ b/src/Core/Dependency/DependencyInterface.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; /** * @psalm-immutable diff --git a/src/Dependency/DependencyList.php b/src/Core/Dependency/DependencyList.php similarity index 94% rename from src/Dependency/DependencyList.php rename to src/Core/Dependency/DependencyList.php index 37ea2d359..2901f31d8 100644 --- a/src/Dependency/DependencyList.php +++ b/src/Core/Dependency/DependencyList.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; class DependencyList { diff --git a/src/Dependency/DependencyResolver.php b/src/Core/Dependency/DependencyResolver.php similarity index 68% rename from src/Dependency/DependencyResolver.php rename to src/Core/Dependency/DependencyResolver.php index 73f9b0755..cb69678c2 100644 --- a/src/Dependency/DependencyResolver.php +++ b/src/Core/Dependency/DependencyResolver.php @@ -2,20 +2,18 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Dependency\Emitter\DependencyEmitterInterface; -use Qossmic\Deptrac\Dependency\Emitter\EmitterTypes; -use Qossmic\Deptrac\Dependency\Event\PostEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PostFlattenEvent; -use Qossmic\Deptrac\Dependency\Event\PreEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PreFlattenEvent; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; +use Qossmic\Deptrac\Contract\Dependency\PostEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PostFlattenEvent; +use Qossmic\Deptrac\Contract\Dependency\PreEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PreFlattenEvent; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Dependency\Emitter\DependencyEmitterInterface; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use function array_merge; class DependencyResolver { @@ -23,23 +21,13 @@ class DependencyResolver private InheritanceFlattener $inheritanceFlattener; private EventDispatcherInterface $eventDispatcher; - /** - * @var array{types: array} - */ - public const DEFAULT_EMITTERS = [ - 'types' => [ - EmitterTypes::CLASS_TOKEN, - EmitterTypes::USE_TOKEN, - ], - ]; - /** * @var array{types: array} */ private array $config; /** - * @param array{types?: array} $config + * @param array{types: array} $config */ public function __construct( array $config, @@ -47,7 +35,7 @@ public function __construct( ContainerInterface $emitterLocator, EventDispatcherInterface $eventDispatcher ) { - $this->config = array_merge(self::DEFAULT_EMITTERS, $config); + $this->config = $config; $this->inheritanceFlattener = $inheritanceFlattener; $this->emitterLocator = $emitterLocator; $this->eventDispatcher = $eventDispatcher; diff --git a/src/Dependency/Emitter/ClassDependencyEmitter.php b/src/Core/Dependency/Emitter/ClassDependencyEmitter.php similarity index 81% rename from src/Dependency/Emitter/ClassDependencyEmitter.php rename to src/Core/Dependency/Emitter/ClassDependencyEmitter.php index e8845bfed..2edb32bed 100644 --- a/src/Dependency/Emitter/ClassDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/ClassDependencyEmitter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class ClassDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::CLASS_TOKEN; - } - public function getName(): string { return 'ClassDependencyEmitter'; diff --git a/src/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php b/src/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php similarity index 73% rename from src/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php rename to src/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php index fb9651720..c86c2e9cd 100644 --- a/src/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class ClassSuperglobalDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::CLASS_SUPERGLOBAL_TOKEN; - } - public function getName(): string { return 'ClassSuperglobalDependencyEmitter'; diff --git a/src/Dependency/Emitter/DependencyEmitterInterface.php b/src/Core/Dependency/Emitter/DependencyEmitterInterface.php similarity index 53% rename from src/Dependency/Emitter/DependencyEmitterInterface.php rename to src/Core/Dependency/Emitter/DependencyEmitterInterface.php index 17d2496f0..1940d81da 100644 --- a/src/Dependency/Emitter/DependencyEmitterInterface.php +++ b/src/Core/Dependency/Emitter/DependencyEmitterInterface.php @@ -2,15 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Dependency\DependencyList; interface DependencyEmitterInterface { - public static function getAlias(): string; - public function getName(): string; public function applyDependencies(AstMap $astMap, DependencyList $dependencyList): void; diff --git a/src/Dependency/Emitter/FQDNIndexNode.php b/src/Core/Dependency/Emitter/FQDNIndexNode.php similarity index 95% rename from src/Dependency/Emitter/FQDNIndexNode.php rename to src/Core/Dependency/Emitter/FQDNIndexNode.php index 06334cd59..0b390979f 100644 --- a/src/Dependency/Emitter/FQDNIndexNode.php +++ b/src/Core/Dependency/Emitter/FQDNIndexNode.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; use function array_shift; use function count; diff --git a/src/Dependency/Emitter/FileDependencyEmitter.php b/src/Core/Dependency/Emitter/FileDependencyEmitter.php similarity index 76% rename from src/Dependency/Emitter/FileDependencyEmitter.php rename to src/Core/Dependency/Emitter/FileDependencyEmitter.php index bbfa88e1b..bcf249adc 100644 --- a/src/Dependency/Emitter/FileDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/FileDependencyEmitter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class FileDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::FILE_TOKEN; - } - public function getName(): string { return 'FileDependencyEmitter'; diff --git a/src/Dependency/Emitter/FunctionCallDependencyEmitter.php b/src/Core/Dependency/Emitter/FunctionCallDependencyEmitter.php similarity index 74% rename from src/Dependency/Emitter/FunctionCallDependencyEmitter.php rename to src/Core/Dependency/Emitter/FunctionCallDependencyEmitter.php index 489c16a86..69a5858bc 100644 --- a/src/Dependency/Emitter/FunctionCallDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/FunctionCallDependencyEmitter.php @@ -2,24 +2,19 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class FunctionCallDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::FUNCTION_CALL; - } - public function getName(): string { return 'FunctionCallDependencyEmitter'; diff --git a/src/Dependency/Emitter/FunctionDependencyEmitter.php b/src/Core/Dependency/Emitter/FunctionDependencyEmitter.php similarity index 78% rename from src/Dependency/Emitter/FunctionDependencyEmitter.php rename to src/Core/Dependency/Emitter/FunctionDependencyEmitter.php index c8d0f9e9d..1edc10826 100644 --- a/src/Dependency/Emitter/FunctionDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/FunctionDependencyEmitter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class FunctionDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::FUNCTION_TOKEN; - } - public function getName(): string { return 'FunctionDependencyEmitter'; diff --git a/src/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php b/src/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php similarity index 76% rename from src/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php rename to src/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php index 9dd3e1d83..681eded3e 100644 --- a/src/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitter.php @@ -2,20 +2,15 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; final class FunctionSuperglobalDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::FUNCTION_SUPERGLOBAL_TOKEN; - } - public function getName(): string { return 'FunctionSuperglobalDependencyEmitter'; diff --git a/src/Dependency/Emitter/UsesDependencyEmitter.php b/src/Core/Dependency/Emitter/UsesDependencyEmitter.php similarity index 86% rename from src/Dependency/Emitter/UsesDependencyEmitter.php rename to src/Core/Dependency/Emitter/UsesDependencyEmitter.php index 336a44dd6..196fc9f0d 100644 --- a/src/Dependency/Emitter/UsesDependencyEmitter.php +++ b/src/Core/Dependency/Emitter/UsesDependencyEmitter.php @@ -2,23 +2,18 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Core\Dependency\Emitter; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; use function array_map; use function array_merge; use function explode; final class UsesDependencyEmitter implements DependencyEmitterInterface { - public static function getAlias(): string - { - return EmitterTypes::USE_TOKEN; - } - public function getName(): string { return 'UsesDependencyEmitter'; diff --git a/src/Dependency/InheritDependency.php b/src/Core/Dependency/InheritDependency.php similarity index 81% rename from src/Dependency/InheritDependency.php rename to src/Core/Dependency/InheritDependency.php index d5d855a90..2b7ed0f9f 100644 --- a/src/Dependency/InheritDependency.php +++ b/src/Core/Dependency/InheritDependency.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; /** * @psalm-immutable diff --git a/src/Dependency/InheritanceFlattener.php b/src/Core/Dependency/InheritanceFlattener.php similarity index 89% rename from src/Dependency/InheritanceFlattener.php rename to src/Core/Dependency/InheritanceFlattener.php index f7c8c5688..958a395d0 100644 --- a/src/Dependency/InheritanceFlattener.php +++ b/src/Core/Dependency/InheritanceFlattener.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; +namespace Qossmic\Deptrac\Core\Dependency; -use Qossmic\Deptrac\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; class InheritanceFlattener { diff --git a/src/Dependency/TokenResolver.php b/src/Core/Dependency/TokenResolver.php similarity index 51% rename from src/Dependency/TokenResolver.php rename to src/Core/Dependency/TokenResolver.php index c91cf26fe..94ee3d2c7 100644 --- a/src/Dependency/TokenResolver.php +++ b/src/Core/Dependency/TokenResolver.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency; - -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\File\FileToken; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenInterface; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Ast\AstMap\Variable\SuperGlobalToken; -use Qossmic\Deptrac\Ast\AstMap\Variable\VariableReference; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; +namespace Qossmic\Deptrac\Core\Dependency; + +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\SuperGlobalToken; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\VariableReference; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; class TokenResolver { diff --git a/src/InputCollector/FileInputCollector.php b/src/Core/InputCollector/FileInputCollector.php similarity index 85% rename from src/InputCollector/FileInputCollector.php rename to src/Core/InputCollector/FileInputCollector.php index 473c4cc50..73e4d568b 100644 --- a/src/InputCollector/FileInputCollector.php +++ b/src/Core/InputCollector/FileInputCollector.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\InputCollector; +namespace Qossmic\Deptrac\Core\InputCollector; use LogicException; -use Qossmic\Deptrac\File\Exception\InvalidPathException; +use Qossmic\Deptrac\Supportive\File\Exception\InvalidPathException; use SplFileInfo; use Symfony\Component\Filesystem\Path; use Symfony\Component\Finder\Finder; @@ -31,14 +31,14 @@ final class FileInputCollector implements InputCollectorInterface */ public function __construct(array $paths, array $excludedFilePatterns, string $basePath) { - $basePath = new SplFileInfo($basePath); - if (!$basePath->isDir() || !$basePath->isReadable()) { - throw InvalidPathException::unreadablePath($basePath); + $basePathInfo = new SplFileInfo($basePath); + if (!$basePathInfo->isDir() || !$basePathInfo->isReadable()) { + throw InvalidPathException::unreadablePath($basePathInfo); } $this->paths = []; foreach ($paths as $originalPath) { $path = Path::isRelative($originalPath) - ? Path::makeAbsolute($originalPath, $basePath->getPathname()) + ? Path::makeAbsolute($originalPath, $basePathInfo->getPathname()) : $originalPath; $path = new SplFileInfo($path); if (!$path->isReadable()) { diff --git a/src/InputCollector/InputCollectorInterface.php b/src/Core/InputCollector/InputCollectorInterface.php similarity index 76% rename from src/InputCollector/InputCollectorInterface.php rename to src/Core/InputCollector/InputCollectorInterface.php index 86f55bf30..16f79e11b 100644 --- a/src/InputCollector/InputCollectorInterface.php +++ b/src/Core/InputCollector/InputCollectorInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\InputCollector; +namespace Qossmic\Deptrac\Core\InputCollector; interface InputCollectorInterface { diff --git a/src/InputCollector/PathNameFilterIterator.php b/src/Core/InputCollector/PathNameFilterIterator.php similarity index 93% rename from src/InputCollector/PathNameFilterIterator.php rename to src/Core/InputCollector/PathNameFilterIterator.php index 44dfd0578..06aca344d 100644 --- a/src/InputCollector/PathNameFilterIterator.php +++ b/src/Core/InputCollector/PathNameFilterIterator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\InputCollector; +namespace Qossmic\Deptrac\Core\InputCollector; use SplFileInfo; use Symfony\Component\Filesystem\Path; diff --git a/src/Layer/Collector/AbstractTypeCollector.php b/src/Core/Layer/Collector/AbstractTypeCollector.php similarity index 82% rename from src/Layer/Collector/AbstractTypeCollector.php rename to src/Core/Layer/Collector/AbstractTypeCollector.php index f4529b361..49eef5ca6 100644 --- a/src/Layer/Collector/AbstractTypeCollector.php +++ b/src/Core/Layer/Collector/AbstractTypeCollector.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; use function is_string; abstract class AbstractTypeCollector extends RegexCollector diff --git a/src/Layer/Collector/AttributeCollector.php b/src/Core/Layer/Collector/AttributeCollector.php similarity index 72% rename from src/Layer/Collector/AttributeCollector.php rename to src/Core/Layer/Collector/AttributeCollector.php index 50c6cd286..aa9a41864 100644 --- a/src/Layer/Collector/AttributeCollector.php +++ b/src/Core/Layer/Collector/AttributeCollector.php @@ -2,15 +2,17 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use function str_contains; class AttributeCollector implements CollectorInterface { diff --git a/src/Layer/Collector/BoolCollector.php b/src/Core/Layer/Collector/BoolCollector.php similarity index 95% rename from src/Layer/Collector/BoolCollector.php rename to src/Core/Layer/Collector/BoolCollector.php index c475c3812..62900a18a 100644 --- a/src/Layer/Collector/BoolCollector.php +++ b/src/Core/Layer/Collector/BoolCollector.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use InvalidArgumentException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class BoolCollector implements ConditionalCollectorInterface { diff --git a/src/Layer/Collector/ClassCollector.php b/src/Core/Layer/Collector/ClassCollector.php similarity index 63% rename from src/Layer/Collector/ClassCollector.php rename to src/Core/Layer/Collector/ClassCollector.php index 8064ff1ab..2b7da8eba 100644 --- a/src/Layer/Collector/ClassCollector.php +++ b/src/Core/Layer/Collector/ClassCollector.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; class ClassCollector extends AbstractTypeCollector { diff --git a/src/Layer/Collector/ClassLikeCollector.php b/src/Core/Layer/Collector/ClassLikeCollector.php similarity index 64% rename from src/Layer/Collector/ClassLikeCollector.php rename to src/Core/Layer/Collector/ClassLikeCollector.php index d0ecdf664..489aa1e72 100644 --- a/src/Layer/Collector/ClassLikeCollector.php +++ b/src/Core/Layer/Collector/ClassLikeCollector.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; class ClassLikeCollector extends AbstractTypeCollector { diff --git a/src/Layer/Collector/ClassNameRegexCollector.php b/src/Core/Layer/Collector/ClassNameRegexCollector.php similarity index 81% rename from src/Layer/Collector/ClassNameRegexCollector.php rename to src/Core/Layer/Collector/ClassNameRegexCollector.php index 9d1974bd7..196fa0e2a 100644 --- a/src/Layer/Collector/ClassNameRegexCollector.php +++ b/src/Core/Layer/Collector/ClassNameRegexCollector.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class ClassNameRegexCollector extends RegexCollector { diff --git a/src/Layer/Collector/Collectable.php b/src/Core/Layer/Collector/Collectable.php similarity index 87% rename from src/Layer/Collector/Collectable.php rename to src/Core/Layer/Collector/Collectable.php index bbfe3dcda..7d99bcd41 100644 --- a/src/Layer/Collector/Collectable.php +++ b/src/Core/Layer/Collector/Collectable.php @@ -2,7 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; + +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; class Collectable { diff --git a/src/Layer/Collector/CollectorProvider.php b/src/Core/Layer/Collector/CollectorProvider.php similarity index 92% rename from src/Layer/Collector/CollectorProvider.php rename to src/Core/Layer/Collector/CollectorProvider.php index a9f50d0a2..2b54b29a5 100644 --- a/src/Layer/Collector/CollectorProvider.php +++ b/src/Core/Layer/Collector/CollectorProvider.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use Psr\Container\ContainerInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; use RuntimeException; use Symfony\Component\DependencyInjection\ServiceLocator; use function array_keys; diff --git a/src/Layer/Collector/CollectorResolver.php b/src/Core/Layer/Collector/CollectorResolver.php similarity index 89% rename from src/Layer/Collector/CollectorResolver.php rename to src/Core/Layer/Collector/CollectorResolver.php index b302a8315..9309cb88e 100644 --- a/src/Layer/Collector/CollectorResolver.php +++ b/src/Core/Layer/Collector/CollectorResolver.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use Psr\Container\ContainerExceptionInterface; -use Qossmic\Deptrac\Layer\Exception\InvalidCollectorDefinitionException; +use Qossmic\Deptrac\Core\Layer\Exception\InvalidCollectorDefinitionException; use function array_key_exists; use function is_string; diff --git a/src/Layer/Collector/CollectorResolverInterface.php b/src/Core/Layer/Collector/CollectorResolverInterface.php similarity index 81% rename from src/Layer/Collector/CollectorResolverInterface.php rename to src/Core/Layer/Collector/CollectorResolverInterface.php index a8e7f3031..b014282ad 100644 --- a/src/Layer/Collector/CollectorResolverInterface.php +++ b/src/Core/Layer/Collector/CollectorResolverInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; interface CollectorResolverInterface { diff --git a/src/Layer/Collector/CollectorTypes.php b/src/Core/Layer/Collector/CollectorTypes.php similarity index 95% rename from src/Layer/Collector/CollectorTypes.php rename to src/Core/Layer/Collector/CollectorTypes.php index 6f210845f..283b32241 100644 --- a/src/Layer/Collector/CollectorTypes.php +++ b/src/Core/Layer/Collector/CollectorTypes.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; final class CollectorTypes { diff --git a/src/Layer/Collector/ConditionalCollectorInterface.php b/src/Core/Layer/Collector/ConditionalCollectorInterface.php similarity index 70% rename from src/Layer/Collector/ConditionalCollectorInterface.php rename to src/Core/Layer/Collector/ConditionalCollectorInterface.php index 458c196b3..3c6b459cf 100644 --- a/src/Layer/Collector/ConditionalCollectorInterface.php +++ b/src/Core/Layer/Collector/ConditionalCollectorInterface.php @@ -2,7 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; + +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; interface ConditionalCollectorInterface extends CollectorInterface { diff --git a/src/Layer/Collector/DirectoryCollector.php b/src/Core/Layer/Collector/DirectoryCollector.php similarity index 88% rename from src/Layer/Collector/DirectoryCollector.php rename to src/Core/Layer/Collector/DirectoryCollector.php index 0498c2d98..99d660c8e 100644 --- a/src/Layer/Collector/DirectoryCollector.php +++ b/src/Core/Layer/Collector/DirectoryCollector.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; use Symfony\Component\Filesystem\Path; final class DirectoryCollector extends RegexCollector diff --git a/src/Layer/Collector/ExtendsCollector.php b/src/Core/Layer/Collector/ExtendsCollector.php similarity index 79% rename from src/Layer/Collector/ExtendsCollector.php rename to src/Core/Layer/Collector/ExtendsCollector.php index d561b0cd3..8b820880b 100644 --- a/src/Layer/Collector/ExtendsCollector.php +++ b/src/Core/Layer/Collector/ExtendsCollector.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class ExtendsCollector implements CollectorInterface { diff --git a/src/Layer/Collector/FunctionNameCollector.php b/src/Core/Layer/Collector/FunctionNameCollector.php similarity index 76% rename from src/Layer/Collector/FunctionNameCollector.php rename to src/Core/Layer/Collector/FunctionNameCollector.php index fccd5b4b2..9b0bd646e 100644 --- a/src/Layer/Collector/FunctionNameCollector.php +++ b/src/Core/Layer/Collector/FunctionNameCollector.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class FunctionNameCollector implements CollectorInterface { diff --git a/src/Layer/Collector/GlobCollector.php b/src/Core/Layer/Collector/GlobCollector.php similarity index 88% rename from src/Layer/Collector/GlobCollector.php rename to src/Core/Layer/Collector/GlobCollector.php index d021048a5..b455ba3f0 100644 --- a/src/Layer/Collector/GlobCollector.php +++ b/src/Core/Layer/Collector/GlobCollector.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; use Symfony\Component\Filesystem\Path; use Symfony\Component\Finder\Glob; diff --git a/src/Layer/Collector/ImplementsCollector.php b/src/Core/Layer/Collector/ImplementsCollector.php similarity index 79% rename from src/Layer/Collector/ImplementsCollector.php rename to src/Core/Layer/Collector/ImplementsCollector.php index a5928a7e4..d2bca64a3 100644 --- a/src/Layer/Collector/ImplementsCollector.php +++ b/src/Core/Layer/Collector/ImplementsCollector.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class ImplementsCollector implements CollectorInterface { diff --git a/src/Layer/Collector/InheritanceLevelCollector.php b/src/Core/Layer/Collector/InheritanceLevelCollector.php similarity index 80% rename from src/Layer/Collector/InheritanceLevelCollector.php rename to src/Core/Layer/Collector/InheritanceLevelCollector.php index aae449dea..43927e86b 100644 --- a/src/Layer/Collector/InheritanceLevelCollector.php +++ b/src/Core/Layer/Collector/InheritanceLevelCollector.php @@ -2,12 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; use function intval; use function trigger_deprecation; diff --git a/src/Layer/Collector/InheritsCollector.php b/src/Core/Layer/Collector/InheritsCollector.php similarity index 79% rename from src/Layer/Collector/InheritsCollector.php rename to src/Core/Layer/Collector/InheritsCollector.php index befe271f4..496ecb7d3 100644 --- a/src/Layer/Collector/InheritsCollector.php +++ b/src/Core/Layer/Collector/InheritsCollector.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class InheritsCollector implements CollectorInterface { diff --git a/src/Layer/Collector/InterfaceCollector.php b/src/Core/Layer/Collector/InterfaceCollector.php similarity index 64% rename from src/Layer/Collector/InterfaceCollector.php rename to src/Core/Layer/Collector/InterfaceCollector.php index d1436b338..88cf24896 100644 --- a/src/Layer/Collector/InterfaceCollector.php +++ b/src/Core/Layer/Collector/InterfaceCollector.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; class InterfaceCollector extends AbstractTypeCollector { diff --git a/src/Layer/Collector/LayerCollector.php b/src/Core/Layer/Collector/LayerCollector.php similarity index 89% rename from src/Layer/Collector/LayerCollector.php rename to src/Core/Layer/Collector/LayerCollector.php index 2ef85bbb5..3319a526b 100644 --- a/src/Layer/Collector/LayerCollector.php +++ b/src/Core/Layer/Collector/LayerCollector.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use InvalidArgumentException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Layer\Exception\CircularReferenceException; -use Qossmic\Deptrac\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Layer\Exception\CircularReferenceException; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; use function array_key_exists; use function is_string; use function sprintf; diff --git a/src/Layer/Collector/MethodCollector.php b/src/Core/Layer/Collector/MethodCollector.php similarity index 83% rename from src/Layer/Collector/MethodCollector.php rename to src/Core/Layer/Collector/MethodCollector.php index ed195bccb..bf01b1116 100644 --- a/src/Layer/Collector/MethodCollector.php +++ b/src/Core/Layer/Collector/MethodCollector.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; final class MethodCollector extends RegexCollector { diff --git a/src/Layer/Collector/RegexCollector.php b/src/Core/Layer/Collector/RegexCollector.php similarity index 86% rename from src/Layer/Collector/RegexCollector.php rename to src/Core/Layer/Collector/RegexCollector.php index f67db6888..efab10c44 100644 --- a/src/Layer/Collector/RegexCollector.php +++ b/src/Core/Layer/Collector/RegexCollector.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; abstract class RegexCollector implements CollectorInterface { diff --git a/src/Layer/Collector/SuperglobalCollector.php b/src/Core/Layer/Collector/SuperglobalCollector.php similarity index 80% rename from src/Layer/Collector/SuperglobalCollector.php rename to src/Core/Layer/Collector/SuperglobalCollector.php index 30c36a74c..6be470eec 100644 --- a/src/Layer/Collector/SuperglobalCollector.php +++ b/src/Core/Layer/Collector/SuperglobalCollector.php @@ -2,12 +2,13 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Ast\AstMap\Variable\VariableReference; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\VariableReference; final class SuperglobalCollector implements CollectorInterface { diff --git a/src/Layer/Collector/TraitCollector.php b/src/Core/Layer/Collector/TraitCollector.php similarity index 63% rename from src/Layer/Collector/TraitCollector.php rename to src/Core/Layer/Collector/TraitCollector.php index 3231768bf..f313630b1 100644 --- a/src/Layer/Collector/TraitCollector.php +++ b/src/Core/Layer/Collector/TraitCollector.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; class TraitCollector extends AbstractTypeCollector { diff --git a/src/Layer/Collector/UsesCollector.php b/src/Core/Layer/Collector/UsesCollector.php similarity index 79% rename from src/Layer/Collector/UsesCollector.php rename to src/Core/Layer/Collector/UsesCollector.php index 9a65bb2da..663d378b6 100644 --- a/src/Layer/Collector/UsesCollector.php +++ b/src/Core/Layer/Collector/UsesCollector.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Collector; +namespace Qossmic\Deptrac\Core\Layer\Collector; use LogicException; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Contract\Layer\CollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; final class UsesCollector implements CollectorInterface { diff --git a/src/Layer/Exception/CircularReferenceException.php b/src/Core/Layer/Exception/CircularReferenceException.php similarity index 87% rename from src/Layer/Exception/CircularReferenceException.php rename to src/Core/Layer/Exception/CircularReferenceException.php index 3c356a6e4..837ff5f12 100644 --- a/src/Layer/Exception/CircularReferenceException.php +++ b/src/Core/Layer/Exception/CircularReferenceException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Exception; +namespace Qossmic\Deptrac\Core\Layer\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use function implode; use function sprintf; diff --git a/src/Layer/Exception/InvalidCollectorDefinitionException.php b/src/Core/Layer/Exception/InvalidCollectorDefinitionException.php similarity index 89% rename from src/Layer/Exception/InvalidCollectorDefinitionException.php rename to src/Core/Layer/Exception/InvalidCollectorDefinitionException.php index 91bf9d41a..392740ed8 100644 --- a/src/Layer/Exception/InvalidCollectorDefinitionException.php +++ b/src/Core/Layer/Exception/InvalidCollectorDefinitionException.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Exception; +namespace Qossmic\Deptrac\Core\Layer\Exception; use Psr\Container\ContainerExceptionInterface; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use function implode; diff --git a/src/Layer/Exception/InvalidLayerDefinitionException.php b/src/Core/Layer/Exception/InvalidLayerDefinitionException.php similarity index 90% rename from src/Layer/Exception/InvalidLayerDefinitionException.php rename to src/Core/Layer/Exception/InvalidLayerDefinitionException.php index 47b0e77bc..7a8bb20b9 100644 --- a/src/Layer/Exception/InvalidLayerDefinitionException.php +++ b/src/Core/Layer/Exception/InvalidLayerDefinitionException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer\Exception; +namespace Qossmic\Deptrac\Core\Layer\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use function sprintf; diff --git a/src/Layer/LayerProvider.php b/src/Core/Layer/LayerProvider.php similarity index 93% rename from src/Layer/LayerProvider.php rename to src/Core/Layer/LayerProvider.php index 253717ad1..ab92ce432 100644 --- a/src/Layer/LayerProvider.php +++ b/src/Core/Layer/LayerProvider.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer; +namespace Qossmic\Deptrac\Core\Layer; -use Qossmic\Deptrac\Layer\Exception\CircularReferenceException; +use Qossmic\Deptrac\Core\Layer\Exception\CircularReferenceException; class LayerProvider { diff --git a/src/Layer/LayerResolver.php b/src/Core/Layer/LayerResolver.php similarity index 91% rename from src/Layer/LayerResolver.php rename to src/Core/Layer/LayerResolver.php index 76d8bf485..232c48de2 100644 --- a/src/Layer/LayerResolver.php +++ b/src/Core/Layer/LayerResolver.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer; - -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; -use Qossmic\Deptrac\Layer\Collector\Collectable; -use Qossmic\Deptrac\Layer\Collector\CollectorResolverInterface; -use Qossmic\Deptrac\Layer\Collector\ConditionalCollectorInterface; -use Qossmic\Deptrac\Layer\Exception\InvalidLayerDefinitionException; +namespace Qossmic\Deptrac\Core\Layer; + +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Layer\Collector\Collectable; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorResolverInterface; +use Qossmic\Deptrac\Core\Layer\Collector\ConditionalCollectorInterface; +use Qossmic\Deptrac\Core\Layer\Exception\InvalidLayerDefinitionException; use function array_key_exists; class LayerResolver implements LayerResolverInterface diff --git a/src/Layer/LayerResolverInterface.php b/src/Core/Layer/LayerResolverInterface.php similarity index 76% rename from src/Layer/LayerResolverInterface.php rename to src/Core/Layer/LayerResolverInterface.php index 1ecd7310b..06172f62c 100644 --- a/src/Layer/LayerResolverInterface.php +++ b/src/Core/Layer/LayerResolverInterface.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Layer; +namespace Qossmic\Deptrac\Core\Layer; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\TokenReferenceInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\TokenReferenceInterface; interface LayerResolverInterface { diff --git a/src/Console/Application.php b/src/Supportive/Console/Application.php similarity index 95% rename from src/Console/Application.php rename to src/Supportive/Console/Application.php index 65fdbd569..bb94b9966 100644 --- a/src/Console/Application.php +++ b/src/Supportive/Console/Application.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Console; +namespace Qossmic\Deptrac\Supportive\Console; -use Qossmic\Deptrac\DependencyInjection\ServiceContainerBuilder; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; +use Qossmic\Deptrac\Supportive\DependencyInjection\ServiceContainerBuilder; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; use RuntimeException; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; diff --git a/src/Console/Command/AnalyseCommand.php b/src/Supportive/Console/Command/AnalyseCommand.php similarity index 86% rename from src/Console/Command/AnalyseCommand.php rename to src/Supportive/Console/Command/AnalyseCommand.php index 3b00e37d9..6c65021c1 100644 --- a/src/Console/Command/AnalyseCommand.php +++ b/src/Supportive/Console/Command/AnalyseCommand.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Console\Command; - -use Qossmic\Deptrac\Console\Exception\AnalyseException; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Env; -use Qossmic\Deptrac\OutputFormatter\FormatterProvider; -use Qossmic\Deptrac\OutputFormatter\GithubActionsOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\TableOutputFormatter; -use Qossmic\Deptrac\Subscriber\ConsoleSubscriber; -use Qossmic\Deptrac\Subscriber\ProgressSubscriber; +namespace Qossmic\Deptrac\Supportive\Console\Command; + +use Qossmic\Deptrac\Supportive\Console\Env; +use Qossmic\Deptrac\Supportive\Console\Exception\AnalyseException; +use Qossmic\Deptrac\Supportive\Console\Subscriber\ConsoleSubscriber; +use Qossmic\Deptrac\Supportive\Console\Subscriber\ProgressSubscriber; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\FormatterProvider; +use Qossmic\Deptrac\Supportive\OutputFormatter\GithubActionsOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\TableOutputFormatter; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Console/Command/AnalyseOptions.php b/src/Supportive/Console/Command/AnalyseOptions.php similarity index 95% rename from src/Console/Command/AnalyseOptions.php rename to src/Supportive/Console/Command/AnalyseOptions.php index 8d39affa9..d8db5bcab 100644 --- a/src/Console/Command/AnalyseOptions.php +++ b/src/Supportive/Console/Command/AnalyseOptions.php @@ -1,6 +1,6 @@ children() ->arrayNode('analyser') @@ -157,10 +161,10 @@ private function appendEmitterTypes(ArrayNodeDefinition $node): void ->children() ->arrayNode('types') ->isRequired() - ->defaultValue([EmitterTypes::CLASS_TOKEN, EmitterTypes::USE_TOKEN]) + ->defaultValue(self::DEFAULT_EMITTER_TYPES) ->scalarPrototype() ->beforeNormalization() - ->ifNotInArray($emitterTypes) + ->ifNotInArray(self::ALLOWED_EMITTER_TYPES) ->thenInvalid('Invalid type %s') ->end() ->end() diff --git a/src/DependencyInjection/DeptracExtension.php b/src/Supportive/DependencyInjection/DeptracExtension.php similarity index 96% rename from src/DependencyInjection/DeptracExtension.php rename to src/Supportive/DependencyInjection/DeptracExtension.php index e3bd3ad39..69c02a21f 100644 --- a/src/DependencyInjection/DeptracExtension.php +++ b/src/Supportive/DependencyInjection/DeptracExtension.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\DependencyInjection; +namespace Qossmic\Deptrac\Supportive\DependencyInjection; -use Qossmic\Deptrac\Dependency\Emitter\EmitterTypes; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; diff --git a/src/Dependency/Emitter/EmitterTypes.php b/src/Supportive/DependencyInjection/EmitterTypes.php similarity index 87% rename from src/Dependency/Emitter/EmitterTypes.php rename to src/Supportive/DependencyInjection/EmitterTypes.php index c03b7100c..e482a044d 100644 --- a/src/Dependency/Emitter/EmitterTypes.php +++ b/src/Supportive/DependencyInjection/EmitterTypes.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Dependency\Emitter; +namespace Qossmic\Deptrac\Supportive\DependencyInjection; final class EmitterTypes { diff --git a/src/Console/Exception/CacheFileException.php b/src/Supportive/DependencyInjection/Exception/CacheFileException.php similarity index 74% rename from src/Console/Exception/CacheFileException.php rename to src/Supportive/DependencyInjection/Exception/CacheFileException.php index 2c9248079..5191dd93d 100644 --- a/src/Console/Exception/CacheFileException.php +++ b/src/Supportive/DependencyInjection/Exception/CacheFileException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Console\Exception; +namespace Qossmic\Deptrac\Supportive\DependencyInjection\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use SplFileInfo; diff --git a/src/DependencyInjection/Exception/InvalidServiceInLocatorException.php b/src/Supportive/DependencyInjection/Exception/InvalidServiceInLocatorException.php similarity index 84% rename from src/DependencyInjection/Exception/InvalidServiceInLocatorException.php rename to src/Supportive/DependencyInjection/Exception/InvalidServiceInLocatorException.php index 68be06061..f20cf6142 100644 --- a/src/DependencyInjection/Exception/InvalidServiceInLocatorException.php +++ b/src/Supportive/DependencyInjection/Exception/InvalidServiceInLocatorException.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\DependencyInjection\Exception; +namespace Qossmic\Deptrac\Supportive\DependencyInjection\Exception; use Psr\Container\ContainerExceptionInterface; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use function implode; use function sprintf; diff --git a/src/DependencyInjection/ServiceContainerBuilder.php b/src/Supportive/DependencyInjection/ServiceContainerBuilder.php similarity index 96% rename from src/DependencyInjection/ServiceContainerBuilder.php rename to src/Supportive/DependencyInjection/ServiceContainerBuilder.php index 0dd4b90b9..5d660bdd9 100644 --- a/src/DependencyInjection/ServiceContainerBuilder.php +++ b/src/Supportive/DependencyInjection/ServiceContainerBuilder.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\DependencyInjection; +namespace Qossmic\Deptrac\Supportive\DependencyInjection; -use Qossmic\Deptrac\Console\Exception\CacheFileException; +use Qossmic\Deptrac\Supportive\DependencyInjection\Exception\CacheFileException; use SplFileInfo; use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Loader\DelegatingLoader; @@ -113,7 +113,7 @@ private static function registerCompilerPasses(ContainerBuilder $container): voi private static function loadServices(ContainerBuilder $container, ?SplFileInfo $cacheFile): void { - $loader = new PhpFileLoader($container, new FileLocator([__DIR__.'/../../config'])); + $loader = new PhpFileLoader($container, new FileLocator([__DIR__.'/../../../config'])); $loader->load('services.php'); diff --git a/src/File/Dumper.php b/src/Supportive/File/Dumper.php similarity index 82% rename from src/File/Dumper.php rename to src/Supportive/File/Dumper.php index 070fb04d6..9423a14fa 100644 --- a/src/File/Dumper.php +++ b/src/Supportive/File/Dumper.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File; +namespace Qossmic\Deptrac\Supportive\File; -use Qossmic\Deptrac\File\Exception\FileNotWritableException; -use Qossmic\Deptrac\Finder\Exception\FileAlreadyExistsException; +use Qossmic\Deptrac\Supportive\File\Exception\FileAlreadyExistsException; +use Qossmic\Deptrac\Supportive\File\Exception\FileNotWritableException; use SplFileInfo; use Symfony\Component\Filesystem\Filesystem; diff --git a/src/File/Exception/CouldNotReadFileException.php b/src/Supportive/File/Exception/CouldNotReadFileException.php similarity index 77% rename from src/File/Exception/CouldNotReadFileException.php rename to src/Supportive/File/Exception/CouldNotReadFileException.php index 8c129d840..2844e9794 100644 --- a/src/File/Exception/CouldNotReadFileException.php +++ b/src/Supportive/File/Exception/CouldNotReadFileException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; /** diff --git a/src/Finder/Exception/FileAlreadyExistsException.php b/src/Supportive/File/Exception/FileAlreadyExistsException.php similarity index 80% rename from src/Finder/Exception/FileAlreadyExistsException.php rename to src/Supportive/File/Exception/FileAlreadyExistsException.php index 4f52e98f1..6c2920251 100644 --- a/src/Finder/Exception/FileAlreadyExistsException.php +++ b/src/Supportive/File/Exception/FileAlreadyExistsException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Finder\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use SplFileInfo; use Symfony\Component\Filesystem\Path; diff --git a/src/File/Exception/FileCannotBeParsedAsYamlException.php b/src/Supportive/File/Exception/FileCannotBeParsedAsYamlException.php similarity index 83% rename from src/File/Exception/FileCannotBeParsedAsYamlException.php rename to src/Supportive/File/Exception/FileCannotBeParsedAsYamlException.php index b9b5b758d..2881b0431 100644 --- a/src/File/Exception/FileCannotBeParsedAsYamlException.php +++ b/src/Supportive/File/Exception/FileCannotBeParsedAsYamlException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use Symfony\Component\Yaml\Exception\ParseException; diff --git a/src/Ast/Exception/FileNotExistsException.php b/src/Supportive/File/Exception/FileNotExistsException.php similarity index 74% rename from src/Ast/Exception/FileNotExistsException.php rename to src/Supportive/File/Exception/FileNotExistsException.php index ed0a209ce..1944ccab3 100644 --- a/src/Ast/Exception/FileNotExistsException.php +++ b/src/Supportive/File/Exception/FileNotExistsException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\Ast\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; class FileNotExistsException extends RuntimeException implements ExceptionInterface diff --git a/src/File/Exception/FileNotWritableException.php b/src/Supportive/File/Exception/FileNotWritableException.php similarity index 79% rename from src/File/Exception/FileNotWritableException.php rename to src/Supportive/File/Exception/FileNotWritableException.php index 9f12418cf..cbd7a20b9 100644 --- a/src/File/Exception/FileNotWritableException.php +++ b/src/Supportive/File/Exception/FileNotWritableException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use SplFileInfo; use Symfony\Component\Filesystem\Path; diff --git a/src/File/Exception/InvalidPathException.php b/src/Supportive/File/Exception/InvalidPathException.php similarity index 80% rename from src/File/Exception/InvalidPathException.php rename to src/Supportive/File/Exception/InvalidPathException.php index 496bf0d5f..21d8e8d26 100644 --- a/src/File/Exception/InvalidPathException.php +++ b/src/Supportive/File/Exception/InvalidPathException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; use SplFileInfo; use Symfony\Component\Filesystem\Path; diff --git a/src/File/Exception/ParsedYamlIsNotAnArrayException.php b/src/Supportive/File/Exception/ParsedYamlIsNotAnArrayException.php similarity index 79% rename from src/File/Exception/ParsedYamlIsNotAnArrayException.php rename to src/Supportive/File/Exception/ParsedYamlIsNotAnArrayException.php index e94083235..a7a70a137 100644 --- a/src/File/Exception/ParsedYamlIsNotAnArrayException.php +++ b/src/Supportive/File/Exception/ParsedYamlIsNotAnArrayException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File\Exception; +namespace Qossmic\Deptrac\Supportive\File\Exception; -use Qossmic\Deptrac\Exception\ExceptionInterface; +use Qossmic\Deptrac\Contract\ExceptionInterface; use RuntimeException; /** diff --git a/src/File/FileReader.php b/src/Supportive/File/FileReader.php similarity index 79% rename from src/File/FileReader.php rename to src/Supportive/File/FileReader.php index 0e0be3fbf..549e2a473 100644 --- a/src/File/FileReader.php +++ b/src/Supportive/File/FileReader.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Qossmic\Deptrac\File; +namespace Qossmic\Deptrac\Supportive\File; -use Qossmic\Deptrac\File\Exception\CouldNotReadFileException; +use Qossmic\Deptrac\Supportive\File\Exception\CouldNotReadFileException; final class FileReader { diff --git a/src/File/YmlFileLoader.php b/src/Supportive/File/YmlFileLoader.php similarity index 80% rename from src/File/YmlFileLoader.php rename to src/Supportive/File/YmlFileLoader.php index edde3cf79..9a51cd2e1 100644 --- a/src/File/YmlFileLoader.php +++ b/src/Supportive/File/YmlFileLoader.php @@ -1,9 +1,9 @@ create(ParserFactory::ONLY_PHP7, new Lexer()), - new AstFileReferenceInMemoryCache(), - new TypeResolver(), - [] - ), - new EventDispatcher() - ); - - return $astRunner->createAstMap([__DIR__.'/Fixtures/BasicInheritance/'.$fixture.'.php']); - } - - private function getInheritedInherits(string $class, AstMap $astMap): array - { - $inherits = []; - foreach ($astMap->getClassInherits(ClassLikeToken::fromFQCN($class)) as $v) { - if (count($v->getPath()) > 0) { - $inherits[] = (string) $v; - } - } - - return $inherits; - } - - public function testBasicInheritance(): void - { - $astMap = $this->getAstMap('FixtureBasicInheritance'); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceA::class, $astMap) - ); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceB::class, $astMap) - ); - - self::assertArrayValuesEquals( - ['Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))'], - $this->getInheritedInherits(FixtureBasicInheritanceC::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends))', - ], - $this->getInheritedInherits(FixtureBasicInheritanceD::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends))', - ], - $this->getInheritedInherits(FixtureBasicInheritanceE::class, $astMap) - ); - } - - public function testBasicInheritanceInterfaces(): void - { - $astMap = $this->getAstMap('FixtureBasicInheritanceInterfaces'); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceInterfaceA::class, $astMap) - ); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceInterfaceB::class, $astMap) - ); - - self::assertArrayValuesEquals( - ['Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))'], - $this->getInheritedInherits(FixtureBasicInheritanceInterfaceC::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements))', - ], - $this->getInheritedInherits(FixtureBasicInheritanceInterfaceD::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements))', - ], - $this->getInheritedInherits(FixtureBasicInheritanceInterfaceE::class, $astMap) - ); - } - - public function testBasicMultipleInheritanceInterfaces(): void - { - $astMap = $this->getAstMap('MultipleInheritanceInterfaces'); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(MultipleInteritanceA1::class, $astMap) - ); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(MultipleInteritanceA2::class, $astMap) - ); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(MultipleInteritanceA::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA1::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA2::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', - ], - $this->getInheritedInherits(MultipleInteritanceB::class, $astMap) - ); - - self::assertArrayValuesEquals( - [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA1::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceB::9 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA1::8 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceB::9 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA2::7 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceB::9 (Implements) -> Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceA::8 (Implements) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\MultipleInteritanceB::9 (Implements))', - ], - $this->getInheritedInherits(MultipleInteritanceC::class, $astMap) - ); - } - - public function testBasicMultipleInheritanceWithNoise(): void - { - $astMap = $this->getAstMap('FixtureBasicInheritanceWithNoise'); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseA::class, $astMap) - ); - - self::assertArrayValuesEquals( - [], - $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseB::class, $astMap) - ); - - self::assertArrayValuesEquals( - ['Tests\Qossmic\Deptrac\Ast\Fixtures\BasicInheritance\FixtureBasicInheritanceWithNoiseA::18 (Extends) (path: Tests\Qossmic\Deptrac\Ast\Fixtures\BasicInheritance\FixtureBasicInheritanceWithNoiseB::19 (Extends))'], - $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseC::class, $astMap) - ); - } -} diff --git a/tests/Analyser/EventHandler/SkippedViolationHelperTest.php b/tests/Core/Analyser/EventHandler/SkippedViolationHelperTest.php similarity index 92% rename from tests/Analyser/EventHandler/SkippedViolationHelperTest.php rename to tests/Core/Analyser/EventHandler/SkippedViolationHelperTest.php index 3a1972d3a..233ddec2c 100644 --- a/tests/Analyser/EventHandler/SkippedViolationHelperTest.php +++ b/tests/Core/Analyser/EventHandler/SkippedViolationHelperTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Analyser\EventHandler; +namespace Tests\Qossmic\Deptrac\Core\Analyser\EventHandler; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Analyser\EventHandler\SkippedViolationHelper; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Analyser\EventHandler\SkippedViolationHelper; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; final class SkippedViolationHelperTest extends TestCase { diff --git a/tests/Ast/ArrayAssertionTrait.php b/tests/Core/Ast/ArrayAssertionTrait.php similarity index 89% rename from tests/Ast/ArrayAssertionTrait.php rename to tests/Core/Ast/ArrayAssertionTrait.php index cba46a632..149f4d6c1 100644 --- a/tests/Ast/ArrayAssertionTrait.php +++ b/tests/Core/Ast/ArrayAssertionTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast; +namespace Tests\Qossmic\Deptrac\Core\Ast; trait ArrayAssertionTrait { diff --git a/tests/Ast/AstMap/File/FileTokenTest.php b/tests/Core/Ast/AstMap/File/FileTokenTest.php similarity index 84% rename from tests/Ast/AstMap/File/FileTokenTest.php rename to tests/Core/Ast/AstMap/File/FileTokenTest.php index d549337cd..b0386529c 100644 --- a/tests/Ast/AstMap/File/FileTokenTest.php +++ b/tests/Core/Ast/AstMap/File/FileTokenTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast\AstMap\File; +namespace Tests\Qossmic\Deptrac\Core\Ast\AstMap\File; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\File\FileToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileToken; final class FileTokenTest extends TestCase { diff --git a/tests/Core/Ast/AstMapFlattenGeneratorTest.php b/tests/Core/Ast/AstMapFlattenGeneratorTest.php new file mode 100644 index 000000000..bd9cb5a3f --- /dev/null +++ b/tests/Core/Ast/AstMapFlattenGeneratorTest.php @@ -0,0 +1,198 @@ +create(ParserFactory::ONLY_PHP7, new Lexer()), + new AstFileReferenceInMemoryCache(), + new TypeResolver(), + [] + ), + new EventDispatcher() + ); + + return $astRunner->createAstMap([__DIR__.'/Fixtures/BasicInheritance/'.$fixture.'.php']); + } + + private function getInheritedInherits(string $class, AstMap $astMap): array + { + $inherits = []; + foreach ($astMap->getClassInherits(ClassLikeToken::fromFQCN($class)) as $v) { + if (count($v->getPath()) > 0) { + $inherits[] = (string) $v; + } + } + + return $inherits; + } + + public function testBasicInheritance(): void + { + $astMap = $this->getAstMap('FixtureBasicInheritance'); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceA::class, $astMap) + ); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceB::class, $astMap) + ); + + self::assertArrayValuesEquals( + ['Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))'], + $this->getInheritedInherits(FixtureBasicInheritanceC::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends))', + ], + $this->getInheritedInherits(FixtureBasicInheritanceD::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceA::6 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceB::7 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceC::8 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceD::9 (Extends))', + ], + $this->getInheritedInherits(FixtureBasicInheritanceE::class, $astMap) + ); + } + + public function testBasicInheritanceInterfaces(): void + { + $astMap = $this->getAstMap('FixtureBasicInheritanceInterfaces'); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceInterfaceA::class, $astMap) + ); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceInterfaceB::class, $astMap) + ); + + self::assertArrayValuesEquals( + ['Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))'], + $this->getInheritedInherits(FixtureBasicInheritanceInterfaceC::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements))', + ], + $this->getInheritedInherits(FixtureBasicInheritanceInterfaceD::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceA::6 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceB::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceC::8 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\FixtureBasicInheritanceInterfaceD::9 (Implements))', + ], + $this->getInheritedInherits(FixtureBasicInheritanceInterfaceE::class, $astMap) + ); + } + + public function testBasicMultipleInheritanceInterfaces(): void + { + $astMap = $this->getAstMap('MultipleInheritanceInterfaces'); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(MultipleInteritanceA1::class, $astMap) + ); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(MultipleInteritanceA2::class, $astMap) + ); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(MultipleInteritanceA::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA1::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA2::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', + ], + $this->getInheritedInherits(MultipleInteritanceB::class, $astMap) + ); + + self::assertArrayValuesEquals( + [ + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA1::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceB::9 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA1::8 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceB::9 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA2::7 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceB::9 (Implements) -> Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA::8 (Implements))', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceA::8 (Implements) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\MultipleInteritanceB::9 (Implements))', + ], + $this->getInheritedInherits(MultipleInteritanceC::class, $astMap) + ); + } + + public function testBasicMultipleInheritanceWithNoise(): void + { + $astMap = $this->getAstMap('FixtureBasicInheritanceWithNoise'); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseA::class, $astMap) + ); + + self::assertArrayValuesEquals( + [], + $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseB::class, $astMap) + ); + + self::assertArrayValuesEquals( + ['Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicInheritance\FixtureBasicInheritanceWithNoiseA::18 (Extends) (path: Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicInheritance\FixtureBasicInheritanceWithNoiseB::19 (Extends))'], + $this->getInheritedInherits(FixtureBasicInheritanceWithNoiseC::class, $astMap) + ); + } +} diff --git a/tests/Ast/AstMapGeneratorTest.php b/tests/Core/Ast/AstMapGeneratorTest.php similarity index 61% rename from tests/Ast/AstMapGeneratorTest.php rename to tests/Core/Ast/AstMapGeneratorTest.php index 3cb2b7a53..218fed918 100644 --- a/tests/Ast/AstMapGeneratorTest.php +++ b/tests/Core/Ast/AstMapGeneratorTest.php @@ -2,30 +2,30 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast; +namespace Tests\Qossmic\Deptrac\Core\Ast; use PhpParser\Lexer; use PhpParser\ParserFactory; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstLoader; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\DependencyToken; -use Qossmic\Deptrac\Ast\Parser\AnnotationReferenceExtractor; -use Qossmic\Deptrac\Ast\Parser\AnonymousClassExtractor; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\ClassConstantExtractor; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\AstLoader; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\DependencyToken; +use Qossmic\Deptrac\Core\Ast\Parser\AnnotationReferenceExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\AnonymousClassExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\ClassConstantExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; use Symfony\Component\EventDispatcher\EventDispatcher; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassB; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassC; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitA; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitB; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitC; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitClass; -use Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitD; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassB; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassC; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitA; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitB; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitC; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitClass; +use Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitD; final class AstMapGeneratorTest extends TestCase { @@ -57,16 +57,16 @@ public function testBasicDependencyClass(): void self::assertArrayValuesEquals( [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassA::9 (Extends)', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceA::9 (Implements)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassA::9 (Extends)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceA::9 (Implements)', ], $this->getInheritsAsString($astMap->getClassReferenceForToken(ClassLikeToken::fromFQCN(BasicDependencyClassB::class))) ); self::assertArrayValuesEquals( [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceA::13 (Implements)', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceB::13 (Implements)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceA::13 (Implements)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyClassInterfaceB::13 (Implements)', ], $this->getInheritsAsString($astMap->getClassReferenceForToken(ClassLikeToken::fromFQCN(BasicDependencyClassC::class))) ); @@ -87,20 +87,20 @@ public function testBasicTraitsClass(): void ); self::assertArrayValuesEquals( - ['Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitB::7 (Uses)'], + ['Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitB::7 (Uses)'], $this->getInheritsAsString($astMap->getClassReferenceForToken(ClassLikeToken::fromFQCN(BasicDependencyTraitC::class))) ); self::assertArrayValuesEquals( [ - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitA::10 (Uses)', - 'Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitB::11 (Uses)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitA::10 (Uses)', + 'Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitB::11 (Uses)', ], $this->getInheritsAsString($astMap->getClassReferenceForToken(ClassLikeToken::fromFQCN(BasicDependencyTraitD::class))) ); self::assertArrayValuesEquals( - ['Tests\Qossmic\Deptrac\Ast\Fixtures\BasicDependency\BasicDependencyTraitA::15 (Uses)'], + ['Tests\Qossmic\Deptrac\Core\Ast\Fixtures\BasicDependency\BasicDependencyTraitA::15 (Uses)'], $this->getInheritsAsString($astMap->getClassReferenceForToken(ClassLikeToken::fromFQCN(BasicDependencyTraitClass::class))) ); } diff --git a/tests/Ast/Fixtures/BasicDependency/BasicDependencyClass.php b/tests/Core/Ast/Fixtures/BasicDependency/BasicDependencyClass.php similarity index 84% rename from tests/Ast/Fixtures/BasicDependency/BasicDependencyClass.php rename to tests/Core/Ast/Fixtures/BasicDependency/BasicDependencyClass.php index f01555230..35986de38 100644 --- a/tests/Ast/Fixtures/BasicDependency/BasicDependencyClass.php +++ b/tests/Core/Ast/Fixtures/BasicDependency/BasicDependencyClass.php @@ -1,6 +1,6 @@ getDependencies()); self::assertSame( - 'Tests\Qossmic\Deptrac\Integration\Fixtures\AnnotationDependencyChild', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\AnnotationDependencyChild', $annotationDependency[0]->getToken()->toString() ); self::assertSame($filePath, $annotationDependency[0]->getFileOccurrence()->getFilepath()); @@ -45,7 +45,7 @@ public function testPropertyDependencyResolving(): void self::assertSame('variable', $annotationDependency[0]->getType()); self::assertSame( - 'Tests\Qossmic\Deptrac\Integration\Fixtures\AnnotationDependencyChild', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\AnnotationDependencyChild', $annotationDependency[1]->getToken()->toString() ); self::assertSame($filePath, $annotationDependency[1]->getFileOccurrence()->getFilepath()); @@ -53,7 +53,7 @@ public function testPropertyDependencyResolving(): void self::assertSame('variable', $annotationDependency[1]->getType()); self::assertSame( - 'Tests\Qossmic\Deptrac\Integration\Fixtures\AnnotationDependencyChild', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\AnnotationDependencyChild', $annotationDependency[2]->getToken()->toString() ); self::assertSame($filePath, $annotationDependency[2]->getFileOccurrence()->getFilepath()); @@ -77,7 +77,7 @@ public function testPropertyDependencyResolving(): void self::assertSame('parameter', $annotationDependency[4]->getType()); self::assertSame( - 'Tests\Qossmic\Deptrac\Integration\Fixtures\AnnotationDependencyChild', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\AnnotationDependencyChild', $annotationDependency[5]->getToken()->toString() ); self::assertSame($filePath, $annotationDependency[5]->getFileOccurrence()->getFilepath()); diff --git a/tests/Ast/Parser/AnonymousClassExtractorTest.php b/tests/Core/Ast/Parser/AnonymousClassExtractorTest.php similarity index 79% rename from tests/Ast/Parser/AnonymousClassExtractorTest.php rename to tests/Core/Ast/Parser/AnonymousClassExtractorTest.php index 52000608d..f5f2a76ff 100644 --- a/tests/Ast/Parser/AnonymousClassExtractorTest.php +++ b/tests/Core/Ast/Parser/AnonymousClassExtractorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast\Parser; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Lexer; use PhpParser\ParserFactory; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Parser\AnonymousClassExtractor; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\Parser\AnonymousClassExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; final class AnonymousClassExtractorTest extends TestCase { @@ -38,7 +38,7 @@ public function testPropertyDependencyResolving(): void $dependencies = $astClassReferences[2]->getDependencies(); self::assertSame( - 'Tests\Qossmic\Deptrac\AstRunner\Resolver\Fixtures\ClassA', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\ClassA', $dependencies[0]->getToken()->toString() ); self::assertSame($filePath, $dependencies[0]->getFileOccurrence()->getFilepath()); @@ -46,7 +46,7 @@ public function testPropertyDependencyResolving(): void self::assertSame('anonymous_class_extends', $dependencies[0]->getType()); self::assertSame( - 'Tests\Qossmic\Deptrac\AstRunner\Resolver\Fixtures\InterfaceC', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\InterfaceC', $dependencies[1]->getToken()->toString() ); self::assertSame($filePath, $dependencies[1]->getFileOccurrence()->getFilepath()); diff --git a/tests/Subscriber/CacheableFileSubscriberTest.php b/tests/Core/Ast/Parser/CacheableFileSubscriberTest.php similarity index 78% rename from tests/Subscriber/CacheableFileSubscriberTest.php rename to tests/Core/Ast/Parser/CacheableFileSubscriberTest.php index f8fa7acb7..b129c35e4 100644 --- a/tests/Subscriber/CacheableFileSubscriberTest.php +++ b/tests/Core/Ast/Parser/CacheableFileSubscriberTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Subscriber; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Event\PostCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Event\PreCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceFileCache; -use Qossmic\Deptrac\Subscriber\CacheableFileSubscriber; +use Qossmic\Deptrac\Contract\Ast\PostCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Ast\PreCreateAstMapEvent; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceFileCache; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\CacheableFileSubscriber; final class CacheableFileSubscriberTest extends TestCase { diff --git a/tests/Ast/Parser/ClassConstantExtractorTest.php b/tests/Core/Ast/Parser/ClassConstantExtractorTest.php similarity index 78% rename from tests/Ast/Parser/ClassConstantExtractorTest.php rename to tests/Core/Ast/Parser/ClassConstantExtractorTest.php index 84a5f7506..25013f44b 100644 --- a/tests/Ast/Parser/ClassConstantExtractorTest.php +++ b/tests/Core/Ast/Parser/ClassConstantExtractorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast\Parser; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser; use PhpParser\Lexer; use PhpParser\ParserFactory; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\ClassConstantExtractor; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\ClassConstantExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; final class ClassConstantExtractorTest extends TestCase { @@ -36,7 +36,7 @@ public function testPropertyDependencyResolving(): void $dependencies = $astClassReferences[1]->getDependencies(); self::assertSame( - 'Tests\Qossmic\Deptrac\Integration\Fixtures\ClassA', + 'Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures\ClassA', $dependencies[0]->getToken()->toString() ); self::assertSame($filePath, $dependencies[0]->getFileOccurrence()->getFilepath()); diff --git a/tests/Ast/Parser/Fixtures/AnnotationDependency.php b/tests/Core/Ast/Parser/Fixtures/AnnotationDependency.php similarity index 95% rename from tests/Ast/Parser/Fixtures/AnnotationDependency.php rename to tests/Core/Ast/Parser/Fixtures/AnnotationDependency.php index 055d9a3a2..09f750ada 100644 --- a/tests/Ast/Parser/Fixtures/AnnotationDependency.php +++ b/tests/Core/Ast/Parser/Fixtures/AnnotationDependency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Integration\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures; final class AnnotationDependency { diff --git a/tests/Ast/Parser/Fixtures/AnonymousClass.php b/tests/Core/Ast/Parser/Fixtures/AnonymousClass.php similarity index 78% rename from tests/Ast/Parser/Fixtures/AnonymousClass.php rename to tests/Core/Ast/Parser/Fixtures/AnonymousClass.php index 37b2a41ac..50250dcec 100644 --- a/tests/Ast/Parser/Fixtures/AnonymousClass.php +++ b/tests/Core/Ast/Parser/Fixtures/AnonymousClass.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\AstRunner\Resolver\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures; interface InterfaceC { diff --git a/tests/Ast/Parser/Fixtures/ClassConst.php b/tests/Core/Ast/Parser/Fixtures/ClassConst.php similarity index 71% rename from tests/Ast/Parser/Fixtures/ClassConst.php rename to tests/Core/Ast/Parser/Fixtures/ClassConst.php index 954490872..e04cac10b 100644 --- a/tests/Ast/Parser/Fixtures/ClassConst.php +++ b/tests/Core/Ast/Parser/Fixtures/ClassConst.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Integration\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures; final class ClassA { diff --git a/tests/Ast/Parser/Fixtures/PropertyTypeDependency.php b/tests/Core/Ast/Parser/Fixtures/PropertyTypeDependency.php similarity index 87% rename from tests/Ast/Parser/Fixtures/PropertyTypeDependency.php rename to tests/Core/Ast/Parser/Fixtures/PropertyTypeDependency.php index 7e54275bd..a428c7d15 100644 --- a/tests/Ast/Parser/Fixtures/PropertyTypeDependency.php +++ b/tests/Core/Ast/Parser/Fixtures/PropertyTypeDependency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Integration\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\Fixtures; use Symfony\Component\Finder\SplFileInfo; diff --git a/tests/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php similarity index 83% rename from tests/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php rename to tests/Core/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php index 2a10edd5e..a18112dd1 100644 --- a/tests/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php +++ b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/Attributes.php @@ -2,9 +2,10 @@ declare(strict_types = 1); -namespace Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\Fixtures; use Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures\Attribute\MyAttribute; +use Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures\Tests; #[MyAttribute] #[Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures\Attribute\MyAttribute] diff --git a/tests/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php similarity index 76% rename from tests/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php rename to tests/Core/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php index 25bfaee57..9cf167e4d 100644 --- a/tests/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php +++ b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/CountingUseStatements.php @@ -8,7 +8,7 @@ class ClassFoo { } -namespace Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures2; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\Fixtures; use Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures\ClassFoo; diff --git a/tests/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php similarity index 64% rename from tests/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php rename to tests/Core/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php index 0f4a1f89e..7e669f719 100644 --- a/tests/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php +++ b/tests/Core/Ast/Parser/NikicPhpParser/Fixtures/TemplateTypes.php @@ -2,7 +2,9 @@ declare(strict_types = 1); -namespace Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\Fixtures; + +use Tests\Qossmic\Deptrac\AstRunner\AstParser\NikicPhpParser\Fixtures\Tests; /** * @template Ta of AnotherThing diff --git a/tests/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php b/tests/Core/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php similarity index 89% rename from tests/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php rename to tests/Core/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php index eb6b1a0da..da6574ed4 100644 --- a/tests/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php +++ b/tests/Core/Ast/Parser/NikicPhpParser/NikicPhpParserTest.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast\Parser\NikicPhpParser; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser; use PhpParser\Lexer; use PhpParser\Parser; use PhpParser\ParserFactory; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Parser\AnnotationReferenceExtractor; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\Parser\AnnotationReferenceExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; use stdClass; use TypeError; diff --git a/tests/Ast/Parser/TypeResolverTest.php b/tests/Core/Ast/Parser/TypeResolverTest.php similarity index 94% rename from tests/Ast/Parser/TypeResolverTest.php rename to tests/Core/Ast/Parser/TypeResolverTest.php index 0d1cc78ac..2a39829ed 100644 --- a/tests/Ast/Parser/TypeResolverTest.php +++ b/tests/Core/Ast/Parser/TypeResolverTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Ast\Parser; +namespace Tests\Qossmic\Deptrac\Core\Ast\Parser; use PHPStan\PhpDocParser\Lexer\Lexer; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; -use Qossmic\Deptrac\Ast\Parser\TypeScope; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Ast\Parser\TypeScope; final class TypeResolverTest extends TestCase { diff --git a/tests/Dependency/DependencyListTest.php b/tests/Core/Dependency/DependencyListTest.php similarity index 82% rename from tests/Dependency/DependencyListTest.php rename to tests/Core/Dependency/DependencyListTest.php index ad5d0005c..1c7d2f14a 100644 --- a/tests/Dependency/DependencyListTest.php +++ b/tests/Core/Dependency/DependencyListTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; -use Qossmic\Deptrac\Dependency\InheritDependency; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; final class DependencyListTest extends TestCase { diff --git a/tests/Dependency/DependencyResolverTest.php b/tests/Core/Dependency/DependencyResolverTest.php similarity index 74% rename from tests/Dependency/DependencyResolverTest.php rename to tests/Core/Dependency/DependencyResolverTest.php index a715e7cc7..89b807a26 100644 --- a/tests/Dependency/DependencyResolverTest.php +++ b/tests/Core/Dependency/DependencyResolverTest.php @@ -2,25 +2,26 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Dependency\DependencyResolver; -use Qossmic\Deptrac\Dependency\Emitter\ClassDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\ClassSuperglobalDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\EmitterTypes; -use Qossmic\Deptrac\Dependency\Emitter\FileDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FunctionDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; -use Qossmic\Deptrac\Dependency\Emitter\UsesDependencyEmitter; -use Qossmic\Deptrac\Dependency\Event\PostEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PostFlattenEvent; -use Qossmic\Deptrac\Dependency\Event\PreEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PreFlattenEvent; -use Qossmic\Deptrac\Dependency\InheritanceFlattener; -use Qossmic\Deptrac\Exception\ShouldNotHappenException; +use Qossmic\Deptrac\Contract\Dependency\PostEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PostFlattenEvent; +use Qossmic\Deptrac\Contract\Dependency\PreEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PreFlattenEvent; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Dependency\DependencyResolver; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FileDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\UsesDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\InheritanceFlattener; +use Qossmic\Deptrac\Supportive\DependencyInjection\Configuration; +use Qossmic\Deptrac\Supportive\DependencyInjection\EmitterTypes; +use Qossmic\Deptrac\Supportive\ShouldNotHappenException; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -62,7 +63,7 @@ public function testResolveWithDefaultEmitters(): void $this->flattener->expects(self::once())->method('flattenDependencies'); $resolver = new DependencyResolver( - [], + ['types' => Configuration::DEFAULT_EMITTER_TYPES], $this->flattener, $this->container, $this->dispatcher diff --git a/tests/Dependency/DependencyTest.php b/tests/Core/Dependency/DependencyTest.php similarity index 75% rename from tests/Dependency/DependencyTest.php rename to tests/Core/Dependency/DependencyTest.php index a569c3535..a8a033150 100644 --- a/tests/Dependency/DependencyTest.php +++ b/tests/Core/Dependency/DependencyTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Dependency\Dependency; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; final class DependencyTest extends TestCase { diff --git a/tests/Dependency/Emitter/ClassDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/ClassDependencyEmitterTest.php similarity index 93% rename from tests/Dependency/Emitter/ClassDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/ClassDependencyEmitterTest.php index e871cceb0..565e18ab8 100644 --- a/tests/Dependency/Emitter/ClassDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/ClassDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\ClassDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassDependencyEmitter; final class ClassDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php similarity index 83% rename from tests/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php index a5e8de3dc..7b01e409e 100644 --- a/tests/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/ClassSuperglobalDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\ClassSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\ClassSuperglobalDependencyEmitter; final class ClassSuperglobalDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/Emitter/EmitterTrait.php b/tests/Core/Dependency/Emitter/EmitterTrait.php similarity index 69% rename from tests/Dependency/Emitter/EmitterTrait.php rename to tests/Core/Dependency/Emitter/EmitterTrait.php index b1edff4e7..d086e52a5 100644 --- a/tests/Dependency/Emitter/EmitterTrait.php +++ b/tests/Core/Dependency/Emitter/EmitterTrait.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PhpParser\Lexer; use PhpParser\ParserFactory; -use Qossmic\Deptrac\Ast\AstLoader; -use Qossmic\Deptrac\Ast\Parser\AnonymousClassExtractor; -use Qossmic\Deptrac\Ast\Parser\Cache\AstFileReferenceInMemoryCache; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Ast\Parser\TypeResolver; -use Qossmic\Deptrac\Dependency\DependencyInterface; -use Qossmic\Deptrac\Dependency\DependencyList; -use Qossmic\Deptrac\Dependency\Emitter\DependencyEmitterInterface; +use Qossmic\Deptrac\Core\Ast\AstLoader; +use Qossmic\Deptrac\Core\Ast\Parser\AnonymousClassExtractor; +use Qossmic\Deptrac\Core\Ast\Parser\Cache\AstFileReferenceInMemoryCache; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Ast\Parser\TypeResolver; +use Qossmic\Deptrac\Core\Dependency\DependencyInterface; +use Qossmic\Deptrac\Core\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Dependency\Emitter\DependencyEmitterInterface; use Symfony\Component\EventDispatcher\EventDispatcher; trait EmitterTrait diff --git a/tests/Dependency/Emitter/FQDNIndexNodeTest.php b/tests/Core/Dependency/Emitter/FQDNIndexNodeTest.php similarity index 93% rename from tests/Dependency/Emitter/FQDNIndexNodeTest.php rename to tests/Core/Dependency/Emitter/FQDNIndexNodeTest.php index 15fa3a2f3..d37aee91a 100644 --- a/tests/Dependency/Emitter/FQDNIndexNodeTest.php +++ b/tests/Core/Dependency/Emitter/FQDNIndexNodeTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\FQDNIndexNode; +use Qossmic\Deptrac\Core\Dependency\Emitter\FQDNIndexNode; use function array_slice; use function explode; diff --git a/tests/Core/Dependency/Emitter/FileDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/FileDependencyEmitterTest.php new file mode 100644 index 000000000..6e9db6555 --- /dev/null +++ b/tests/Core/Dependency/Emitter/FileDependencyEmitterTest.php @@ -0,0 +1,59 @@ +getName()); + } + + public function testApplyDependencies(): void + { + $deps = $this->getEmittedDependencies( + new FileDependencyEmitter(), + __DIR__.'/Fixtures/Baz.php' + ); + + self::assertCount(31, $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:7 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:8 on SomeOtherClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:10 on Foo\SomeOtherParam', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:13 on Foo\SomeInstanceOf', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:15 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:17 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:20 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:25 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:33 on Foo\string2', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:41 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:45 on $_SESSION', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:46 on $_POST', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:54 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:55 on SomeOtherClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:57 on Foo\SomeOtherParam', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:60 on Foo\SomeInstanceOf', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:62 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:64 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:52 on Foo\SomeParam', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:52 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:67 on Some\NamespacedClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:74 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:79 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:87 on Foo\string2', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:95 on Foo\SomeClass', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:110 on $_SESSION', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:111 on $_POST', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:48 on Foo\BarExtends', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:48 on Foo\BarInterface1', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:48 on BarInterface2', $deps); + self::assertContains('/tests/Core/Dependency/Emitter/Fixtures/Baz.php:50 on Foo\SomeTrait', $deps); + } +} diff --git a/tests/Dependency/Emitter/Fixtures/Bar.php b/tests/Core/Dependency/Emitter/Fixtures/Bar.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/Bar.php rename to tests/Core/Dependency/Emitter/Fixtures/Bar.php diff --git a/tests/Dependency/Emitter/Fixtures/Baz.php b/tests/Core/Dependency/Emitter/Fixtures/Baz.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/Baz.php rename to tests/Core/Dependency/Emitter/Fixtures/Baz.php diff --git a/tests/Dependency/Emitter/Fixtures/FQDNIsSubstring/FQDN/SomeClass.php b/tests/Core/Dependency/Emitter/Fixtures/FQDNIsSubstring/FQDN/SomeClass.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/FQDNIsSubstring/FQDN/SomeClass.php rename to tests/Core/Dependency/Emitter/Fixtures/FQDNIsSubstring/FQDN/SomeClass.php diff --git a/tests/Dependency/Emitter/Fixtures/FQDNIsSubstring/Foo.php b/tests/Core/Dependency/Emitter/Fixtures/FQDNIsSubstring/Foo.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/FQDNIsSubstring/Foo.php rename to tests/Core/Dependency/Emitter/Fixtures/FQDNIsSubstring/Foo.php diff --git a/tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN.php b/tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN.php rename to tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN.php diff --git a/tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN/SomeClass.php b/tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN/SomeClass.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN/SomeClass.php rename to tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/FQDN/SomeClass.php diff --git a/tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/Uses/Foo.php b/tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/Uses/Foo.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/Uses/Foo.php rename to tests/Core/Dependency/Emitter/Fixtures/FQDNNamespacePrefix/Uses/Foo.php diff --git a/tests/Dependency/Emitter/Fixtures/Foo.php b/tests/Core/Dependency/Emitter/Fixtures/Foo.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/Foo.php rename to tests/Core/Dependency/Emitter/Fixtures/Foo.php diff --git a/tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/Functions.php b/tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/Functions.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/Functions.php rename to tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/Functions.php diff --git a/tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithFQDN.php b/tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithFQDN.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithFQDN.php rename to tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithFQDN.php diff --git a/tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithNamespace.php b/tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithNamespace.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithNamespace.php rename to tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Deps/UsedWithNamespace.php diff --git a/tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Uses/Foo.php b/tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Uses/Foo.php similarity index 100% rename from tests/Dependency/Emitter/Fixtures/IgnoreNamespace/Uses/Foo.php rename to tests/Core/Dependency/Emitter/Fixtures/IgnoreNamespace/Uses/Foo.php diff --git a/tests/Dependency/Emitter/FunctionCallDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/FunctionCallDependencyEmitterTest.php similarity index 83% rename from tests/Dependency/Emitter/FunctionCallDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/FunctionCallDependencyEmitterTest.php index e2ef6149e..b6c6d5487 100644 --- a/tests/Dependency/Emitter/FunctionCallDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/FunctionCallDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\FunctionCallDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionCallDependencyEmitter; final class FunctionCallDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/Emitter/FunctionDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/FunctionDependencyEmitterTest.php similarity index 95% rename from tests/Dependency/Emitter/FunctionDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/FunctionDependencyEmitterTest.php index 457ee93db..34ad7a846 100644 --- a/tests/Dependency/Emitter/FunctionDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/FunctionDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\FunctionDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionDependencyEmitter; final class FunctionDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php similarity index 86% rename from tests/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php index fe1166f48..3863fd235 100644 --- a/tests/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/FunctionSuperglobalDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\FunctionSuperglobalDependencyEmitter; final class FunctionSuperglobalDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/Emitter/UsesDependencyEmitterTest.php b/tests/Core/Dependency/Emitter/UsesDependencyEmitterTest.php similarity index 95% rename from tests/Dependency/Emitter/UsesDependencyEmitterTest.php rename to tests/Core/Dependency/Emitter/UsesDependencyEmitterTest.php index a88645969..888bf39e0 100644 --- a/tests/Dependency/Emitter/UsesDependencyEmitterTest.php +++ b/tests/Core/Dependency/Emitter/UsesDependencyEmitterTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency\Emitter; +namespace Tests\Qossmic\Deptrac\Core\Dependency\Emitter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\UsesDependencyEmitter; +use Qossmic\Deptrac\Core\Dependency\Emitter\UsesDependencyEmitter; final class UsesDependencyEmitterTest extends TestCase { diff --git a/tests/Dependency/InheritDependencyTest.php b/tests/Core/Dependency/InheritDependencyTest.php similarity index 76% rename from tests/Dependency/InheritDependencyTest.php rename to tests/Core/Dependency/InheritDependencyTest.php index b44003823..63ec7acb7 100644 --- a/tests/Dependency/InheritDependencyTest.php +++ b/tests/Core/Dependency/InheritDependencyTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; final class InheritDependencyTest extends TestCase { diff --git a/tests/Dependency/InheritanceFlattenerTest.php b/tests/Core/Dependency/InheritanceFlattenerTest.php similarity index 83% rename from tests/Dependency/InheritanceFlattenerTest.php rename to tests/Core/Dependency/InheritanceFlattenerTest.php index ac5e3cbf5..fa1d26e15 100644 --- a/tests/Dependency/InheritanceFlattenerTest.php +++ b/tests/Core/Dependency/InheritanceFlattenerTest.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\DependencyList; -use Qossmic\Deptrac\Dependency\InheritanceFlattener; -use Qossmic\Deptrac\Dependency\InheritDependency; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\DependencyList; +use Qossmic\Deptrac\Core\Dependency\InheritanceFlattener; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; final class InheritanceFlattenerTest extends TestCase { diff --git a/tests/Dependency/TokenResolverTest.php b/tests/Core/Dependency/TokenResolverTest.php similarity index 84% rename from tests/Dependency/TokenResolverTest.php rename to tests/Core/Dependency/TokenResolverTest.php index 1dc7490aa..25a2a6150 100644 --- a/tests/Dependency/TokenResolverTest.php +++ b/tests/Core/Dependency/TokenResolverTest.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Dependency; +namespace Tests\Qossmic\Deptrac\Core\Dependency; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\File\FileReference; -use Qossmic\Deptrac\Ast\AstMap\File\FileToken; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Ast\AstMap\Variable\SuperGlobalToken; -use Qossmic\Deptrac\Ast\AstMap\Variable\VariableReference; -use Qossmic\Deptrac\Dependency\TokenResolver; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReference; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\SuperGlobalToken; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\VariableReference; +use Qossmic\Deptrac\Core\Dependency\TokenResolver; final class TokenResolverTest extends TestCase { diff --git a/tests/InputCollector/FileInputCollectorTest.php b/tests/Core/InputCollector/FileInputCollectorTest.php similarity index 89% rename from tests/InputCollector/FileInputCollectorTest.php rename to tests/Core/InputCollector/FileInputCollectorTest.php index 9f57d6e37..b08b132ff 100644 --- a/tests/InputCollector/FileInputCollectorTest.php +++ b/tests/Core/InputCollector/FileInputCollectorTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\InputCollector; +namespace Tests\Qossmic\Deptrac\Core\InputCollector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\InputCollector\FileInputCollector; +use Qossmic\Deptrac\Core\InputCollector\FileInputCollector; use Symfony\Component\Filesystem\Path; use function array_values; use function natcasesort; diff --git a/tests/InputCollector/Fixtures/example.php b/tests/Core/InputCollector/Fixtures/example.php similarity index 100% rename from tests/InputCollector/Fixtures/example.php rename to tests/Core/InputCollector/Fixtures/example.php diff --git a/tests/InputCollector/Fixtures/example.txt b/tests/Core/InputCollector/Fixtures/example.txt similarity index 100% rename from tests/InputCollector/Fixtures/example.txt rename to tests/Core/InputCollector/Fixtures/example.txt diff --git a/tests/InputCollector/PathNameFilterIteratorTest.php b/tests/Core/InputCollector/PathNameFilterIteratorTest.php similarity index 96% rename from tests/InputCollector/PathNameFilterIteratorTest.php rename to tests/Core/InputCollector/PathNameFilterIteratorTest.php index 4d8be1a59..1b6ab8190 100644 --- a/tests/InputCollector/PathNameFilterIteratorTest.php +++ b/tests/Core/InputCollector/PathNameFilterIteratorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\InputCollector; +namespace Tests\Qossmic\Deptrac\Core\InputCollector; use ArrayIterator; use Iterator; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\InputCollector\PathNameFilterIterator; +use Qossmic\Deptrac\Core\InputCollector\PathNameFilterIterator; use SplFileInfo; use const DIRECTORY_SEPARATOR; diff --git a/tests/Layer/Collector/AttributeCollectorTest.php b/tests/Core/Layer/Collector/AttributeCollectorTest.php similarity index 85% rename from tests/Layer/Collector/AttributeCollectorTest.php rename to tests/Core/Layer/Collector/AttributeCollectorTest.php index 28a3dfd94..65a2bb3e1 100644 --- a/tests/Layer/Collector/AttributeCollectorTest.php +++ b/tests/Core/Layer/Collector/AttributeCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\AttributeCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\AttributeCollector; final class AttributeCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/BoolCollectorTest.php b/tests/Core/Layer/Collector/BoolCollectorTest.php similarity index 95% rename from tests/Layer/Collector/BoolCollectorTest.php rename to tests/Core/Layer/Collector/BoolCollectorTest.php index 62ab2adf1..254b719ed 100644 --- a/tests/Layer/Collector/BoolCollectorTest.php +++ b/tests/Core/Layer/Collector/BoolCollectorTest.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use InvalidArgumentException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Layer\Collector\BoolCollector; -use Qossmic\Deptrac\Layer\Collector\Collectable; -use Qossmic\Deptrac\Layer\Collector\CollectorResolverInterface; -use Qossmic\Deptrac\Layer\Collector\ConditionalCollectorInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\BoolCollector; +use Qossmic\Deptrac\Core\Layer\Collector\Collectable; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorResolverInterface; +use Qossmic\Deptrac\Core\Layer\Collector\ConditionalCollectorInterface; final class BoolCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/ClassCollectorTest.php b/tests/Core/Layer/Collector/ClassCollectorTest.php similarity index 84% rename from tests/Layer/Collector/ClassCollectorTest.php rename to tests/Core/Layer/Collector/ClassCollectorTest.php index 9ee687892..ad4c57924 100644 --- a/tests/Layer/Collector/ClassCollectorTest.php +++ b/tests/Core/Layer/Collector/ClassCollectorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; -use Qossmic\Deptrac\Layer\Collector\ClassCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Layer\Collector\ClassCollector; final class ClassCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/ClassLikeCollectorTest.php b/tests/Core/Layer/Collector/ClassLikeCollectorTest.php similarity index 84% rename from tests/Layer/Collector/ClassLikeCollectorTest.php rename to tests/Core/Layer/Collector/ClassLikeCollectorTest.php index c9b2d163d..4ff82f2a6 100644 --- a/tests/Layer/Collector/ClassLikeCollectorTest.php +++ b/tests/Core/Layer/Collector/ClassLikeCollectorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; -use Qossmic\Deptrac\Layer\Collector\ClassLikeCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Layer\Collector\ClassLikeCollector; final class ClassLikeCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/ClassNameRegexCollectorTest.php b/tests/Core/Layer/Collector/ClassNameRegexCollectorTest.php similarity index 85% rename from tests/Layer/Collector/ClassNameRegexCollectorTest.php rename to tests/Core/Layer/Collector/ClassNameRegexCollectorTest.php index 9831b44ed..4c64c01c0 100644 --- a/tests/Layer/Collector/ClassNameRegexCollectorTest.php +++ b/tests/Core/Layer/Collector/ClassNameRegexCollectorTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Layer\Collector\ClassNameRegexCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\ClassNameRegexCollector; final class ClassNameRegexCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/DirectoryCollectorTest.php b/tests/Core/Layer/Collector/DirectoryCollectorTest.php similarity index 92% rename from tests/Layer/Collector/DirectoryCollectorTest.php rename to tests/Core/Layer/Collector/DirectoryCollectorTest.php index 1316df936..f0b847db4 100644 --- a/tests/Layer/Collector/DirectoryCollectorTest.php +++ b/tests/Core/Layer/Collector/DirectoryCollectorTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\DirectoryCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\DirectoryCollector; final class DirectoryCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/ExtendsCollectorTest.php b/tests/Core/Layer/Collector/ExtendsCollectorTest.php similarity index 92% rename from tests/Layer/Collector/ExtendsCollectorTest.php rename to tests/Core/Layer/Collector/ExtendsCollectorTest.php index 0ede8c5d6..6ceb6aa23 100644 --- a/tests/Layer/Collector/ExtendsCollectorTest.php +++ b/tests/Core/Layer/Collector/ExtendsCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\ExtendsCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\ExtendsCollector; final class ExtendsCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/FunctionNameCollectorTest.php b/tests/Core/Layer/Collector/FunctionNameCollectorTest.php similarity index 81% rename from tests/Layer/Collector/FunctionNameCollectorTest.php rename to tests/Core/Layer/Collector/FunctionNameCollectorTest.php index cd2286025..1c8f500f5 100644 --- a/tests/Layer/Collector/FunctionNameCollectorTest.php +++ b/tests/Core/Layer/Collector/FunctionNameCollectorTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeReference; -use Qossmic\Deptrac\Ast\AstMap\FunctionLike\FunctionLikeToken; -use Qossmic\Deptrac\Layer\Collector\FunctionNameCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\FunctionLike\FunctionLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\FunctionNameCollector; final class FunctionNameCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/GlobCollectorTest.php b/tests/Core/Layer/Collector/GlobCollectorTest.php similarity index 85% rename from tests/Layer/Collector/GlobCollectorTest.php rename to tests/Core/Layer/Collector/GlobCollectorTest.php index 4e58a7609..45f3c6722 100644 --- a/tests/Layer/Collector/GlobCollectorTest.php +++ b/tests/Core/Layer/Collector/GlobCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\GlobCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\GlobCollector; final class GlobCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/ImplementsCollectorTest.php b/tests/Core/Layer/Collector/ImplementsCollectorTest.php similarity index 92% rename from tests/Layer/Collector/ImplementsCollectorTest.php rename to tests/Core/Layer/Collector/ImplementsCollectorTest.php index bcc10f8cb..519f87912 100644 --- a/tests/Layer/Collector/ImplementsCollectorTest.php +++ b/tests/Core/Layer/Collector/ImplementsCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\ImplementsCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\ImplementsCollector; final class ImplementsCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/InheritanceLevelCollectorTest.php b/tests/Core/Layer/Collector/InheritanceLevelCollectorTest.php similarity index 79% rename from tests/Layer/Collector/InheritanceLevelCollectorTest.php rename to tests/Core/Layer/Collector/InheritanceLevelCollectorTest.php index 9d9a243af..be72bc3a7 100644 --- a/tests/Layer/Collector/InheritanceLevelCollectorTest.php +++ b/tests/Core/Layer/Collector/InheritanceLevelCollectorTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Layer\Collector\InheritanceLevelCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\InheritanceLevelCollector; final class InheritanceLevelCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/InheritsCollectorTest.php b/tests/Core/Layer/Collector/InheritsCollectorTest.php similarity index 92% rename from tests/Layer/Collector/InheritsCollectorTest.php rename to tests/Core/Layer/Collector/InheritsCollectorTest.php index 800edb94e..9e365889e 100644 --- a/tests/Layer/Collector/InheritsCollectorTest.php +++ b/tests/Core/Layer/Collector/InheritsCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\InheritsCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\InheritsCollector; final class InheritsCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/InterfaceCollectorTest.php b/tests/Core/Layer/Collector/InterfaceCollectorTest.php similarity index 84% rename from tests/Layer/Collector/InterfaceCollectorTest.php rename to tests/Core/Layer/Collector/InterfaceCollectorTest.php index 73bb3f592..250366c37 100644 --- a/tests/Layer/Collector/InterfaceCollectorTest.php +++ b/tests/Core/Layer/Collector/InterfaceCollectorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; -use Qossmic\Deptrac\Layer\Collector\InterfaceCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Layer\Collector\InterfaceCollector; final class InterfaceCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/LayerCollectorTest.php b/tests/Core/Layer/Collector/LayerCollectorTest.php similarity index 91% rename from tests/Layer/Collector/LayerCollectorTest.php rename to tests/Core/Layer/Collector/LayerCollectorTest.php index 02bfaa277..d01b5fcf1 100644 --- a/tests/Layer/Collector/LayerCollectorTest.php +++ b/tests/Core/Layer/Collector/LayerCollectorTest.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use InvalidArgumentException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Layer\Collector\LayerCollector; -use Qossmic\Deptrac\Layer\Exception\CircularReferenceException; -use Qossmic\Deptrac\Layer\LayerResolverInterface; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\LayerCollector; +use Qossmic\Deptrac\Core\Layer\Exception\CircularReferenceException; +use Qossmic\Deptrac\Core\Layer\LayerResolverInterface; final class LayerCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/MethodCollectorTest.php b/tests/Core/Layer/Collector/MethodCollectorTest.php similarity index 90% rename from tests/Layer/Collector/MethodCollectorTest.php rename to tests/Core/Layer/Collector/MethodCollectorTest.php index 20f207200..1133bcef1 100644 --- a/tests/Layer/Collector/MethodCollectorTest.php +++ b/tests/Core/Layer/Collector/MethodCollectorTest.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PhpParser\Node; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\Parser\NikicPhpParser\NikicPhpParser; -use Qossmic\Deptrac\Layer\Collector\MethodCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\Parser\NikicPhpParser\NikicPhpParser; +use Qossmic\Deptrac\Core\Layer\Collector\MethodCollector; use stdClass; final class MethodCollectorTest extends TestCase diff --git a/tests/Layer/Collector/SuperglobalCollectorTest.php b/tests/Core/Layer/Collector/SuperglobalCollectorTest.php similarity index 80% rename from tests/Layer/Collector/SuperglobalCollectorTest.php rename to tests/Core/Layer/Collector/SuperglobalCollectorTest.php index 44e26f50d..03bd34e3e 100644 --- a/tests/Layer/Collector/SuperglobalCollectorTest.php +++ b/tests/Core/Layer/Collector/SuperglobalCollectorTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\Variable\SuperGlobalToken; -use Qossmic\Deptrac\Ast\AstMap\Variable\VariableReference; -use Qossmic\Deptrac\Layer\Collector\SuperglobalCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\SuperGlobalToken; +use Qossmic\Deptrac\Core\Ast\AstMap\Variable\VariableReference; +use Qossmic\Deptrac\Core\Layer\Collector\SuperglobalCollector; final class SuperglobalCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/TraitCollectorTest.php b/tests/Core/Layer/Collector/TraitCollectorTest.php similarity index 84% rename from tests/Layer/Collector/TraitCollectorTest.php rename to tests/Core/Layer/Collector/TraitCollectorTest.php index 8fced2998..27822444c 100644 --- a/tests/Layer/Collector/TraitCollectorTest.php +++ b/tests/Core/Layer/Collector/TraitCollectorTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use LogicException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeType; -use Qossmic\Deptrac\Layer\Collector\TraitCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeType; +use Qossmic\Deptrac\Core\Layer\Collector\TraitCollector; final class TraitCollectorTest extends TestCase { diff --git a/tests/Layer/Collector/UsesCollectorTest.php b/tests/Core/Layer/Collector/UsesCollectorTest.php similarity index 91% rename from tests/Layer/Collector/UsesCollectorTest.php rename to tests/Core/Layer/Collector/UsesCollectorTest.php index a6269121c..901a2249c 100644 --- a/tests/Layer/Collector/UsesCollectorTest.php +++ b/tests/Core/Layer/Collector/UsesCollectorTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer\Collector; +namespace Tests\Qossmic\Deptrac\Core\Layer\Collector; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\File\FileReferenceBuilder; -use Qossmic\Deptrac\Layer\Collector\UsesCollector; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\File\FileReferenceBuilder; +use Qossmic\Deptrac\Core\Layer\Collector\UsesCollector; final class UsesCollectorTest extends TestCase { diff --git a/tests/Layer/LayerResolverTest.php b/tests/Core/Layer/LayerResolverTest.php similarity index 92% rename from tests/Layer/LayerResolverTest.php rename to tests/Core/Layer/LayerResolverTest.php index 69ea8e999..5933ff123 100644 --- a/tests/Layer/LayerResolverTest.php +++ b/tests/Core/Layer/LayerResolverTest.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Layer; +namespace Tests\Qossmic\Deptrac\Core\Layer; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstMap; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeReference; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Layer\Collector\Collectable; -use Qossmic\Deptrac\Layer\Collector\CollectorResolverInterface; -use Qossmic\Deptrac\Layer\Collector\ConditionalCollectorInterface; -use Qossmic\Deptrac\Layer\Exception\InvalidLayerDefinitionException; -use Qossmic\Deptrac\Layer\LayerResolver; +use Qossmic\Deptrac\Core\Ast\AstMap\AstMap; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeReference; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Layer\Collector\Collectable; +use Qossmic\Deptrac\Core\Layer\Collector\CollectorResolverInterface; +use Qossmic\Deptrac\Core\Layer\Collector\ConditionalCollectorInterface; +use Qossmic\Deptrac\Core\Layer\Exception\InvalidLayerDefinitionException; +use Qossmic\Deptrac\Core\Layer\LayerResolver; final class LayerResolverTest extends TestCase { diff --git a/tests/Dependency/Emitter/FileDependencyEmitterTest.php b/tests/Dependency/Emitter/FileDependencyEmitterTest.php deleted file mode 100644 index 44fe033e2..000000000 --- a/tests/Dependency/Emitter/FileDependencyEmitterTest.php +++ /dev/null @@ -1,59 +0,0 @@ -getName()); - } - - public function testApplyDependencies(): void - { - $deps = $this->getEmittedDependencies( - new FileDependencyEmitter(), - __DIR__.'/Fixtures/Baz.php' - ); - - self::assertCount(31, $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:7 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:8 on SomeOtherClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:10 on Foo\SomeOtherParam', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:13 on Foo\SomeInstanceOf', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:15 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:17 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:20 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:25 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:33 on Foo\string2', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:41 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:45 on $_SESSION', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:46 on $_POST', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:54 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:55 on SomeOtherClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:57 on Foo\SomeOtherParam', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:60 on Foo\SomeInstanceOf', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:62 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:64 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:52 on Foo\SomeParam', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:52 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:67 on Some\NamespacedClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:74 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:79 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:87 on Foo\string2', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:95 on Foo\SomeClass', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:110 on $_SESSION', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:111 on $_POST', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:48 on Foo\BarExtends', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:48 on Foo\BarInterface1', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:48 on BarInterface2', $deps); - self::assertContains('/tests/Dependency/Emitter/Fixtures/Baz.php:50 on Foo\SomeTrait', $deps); - } -} diff --git a/tests/Exception/Configuration/InvalidConfigurationExceptionTest.php b/tests/Exception/Configuration/InvalidConfigurationExceptionTest.php deleted file mode 100644 index 86288a6c8..000000000 --- a/tests/Exception/Configuration/InvalidConfigurationExceptionTest.php +++ /dev/null @@ -1,60 +0,0 @@ -getMessage()); - } - - public function testFromUnknownLayerNamesReturnsException(): void - { - $layerNames = [ - 'foo', - 'bar', - ]; - - $exception = InvalidConfigurationException::fromUnknownLayerNames(...$layerNames); - - natsort($layerNames); - - $message = sprintf( - 'Configuration can not reference rule sets with unknown layer names, got "%s" as unknown.', - implode('", "', $layerNames) - ); - - self::assertSame($message, $exception->getMessage()); - } -} diff --git a/tests/Console/Command/AnalyseCommandTest.php b/tests/Supportive/Console/Command/AnalyseCommandTest.php similarity index 67% rename from tests/Console/Command/AnalyseCommandTest.php rename to tests/Supportive/Console/Command/AnalyseCommandTest.php index a3085e02c..c9f249718 100644 --- a/tests/Console/Command/AnalyseCommandTest.php +++ b/tests/Supportive/Console/Command/AnalyseCommandTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Console\Command; +namespace Tests\Qossmic\Deptrac\Supportive\Console\Command; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Console\Command\AnalyseCommand; -use Qossmic\Deptrac\OutputFormatter\GithubActionsOutputFormatter; +use Qossmic\Deptrac\Supportive\Console\Command\AnalyseCommand; +use Qossmic\Deptrac\Supportive\OutputFormatter\GithubActionsOutputFormatter; class AnalyseCommandTest extends TestCase { diff --git a/tests/Subscriber/ConsoleSubscriberTest.php b/tests/Supportive/Console/ConsoleSubscriberTest.php similarity index 88% rename from tests/Subscriber/ConsoleSubscriberTest.php rename to tests/Supportive/Console/ConsoleSubscriberTest.php index 7ac18e738..cff4e47e0 100644 --- a/tests/Subscriber/ConsoleSubscriberTest.php +++ b/tests/Supportive/Console/ConsoleSubscriberTest.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Subscriber; +namespace Tests\Qossmic\Deptrac\Supportive\Console; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Event\AstFileAnalysedEvent; -use Qossmic\Deptrac\Ast\Event\AstFileSyntaxErrorEvent; -use Qossmic\Deptrac\Ast\Event\PostCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Event\PreCreateAstMapEvent; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Event\PostEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PostFlattenEvent; -use Qossmic\Deptrac\Dependency\Event\PreEmitEvent; -use Qossmic\Deptrac\Dependency\Event\PreFlattenEvent; -use Qossmic\Deptrac\Subscriber\ConsoleSubscriber; +use Qossmic\Deptrac\Contract\Ast\AstFileAnalysedEvent; +use Qossmic\Deptrac\Contract\Ast\AstFileSyntaxErrorEvent; +use Qossmic\Deptrac\Contract\Ast\PostCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Ast\PreCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Dependency\PostEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PostFlattenEvent; +use Qossmic\Deptrac\Contract\Dependency\PreEmitEvent; +use Qossmic\Deptrac\Contract\Dependency\PreFlattenEvent; +use Qossmic\Deptrac\Supportive\Console\Subscriber\ConsoleSubscriber; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\OutputInterface; diff --git a/tests/EmptyEnv.php b/tests/Supportive/Console/EmptyEnv.php similarity index 60% rename from tests/EmptyEnv.php rename to tests/Supportive/Console/EmptyEnv.php index eb854e0d8..864b1e49f 100644 --- a/tests/EmptyEnv.php +++ b/tests/Supportive/Console/EmptyEnv.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac; +namespace Tests\Qossmic\Deptrac\Supportive\Console; -use Qossmic\Deptrac\Env; +use Qossmic\Deptrac\Supportive\Console\Env; final class EmptyEnv extends Env { diff --git a/tests/EnvTest.php b/tests/Supportive/Console/EnvTest.php similarity index 85% rename from tests/EnvTest.php rename to tests/Supportive/Console/EnvTest.php index 552db1120..6da8494b4 100644 --- a/tests/EnvTest.php +++ b/tests/Supportive/Console/EnvTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac; +namespace Tests\Qossmic\Deptrac\Supportive\Console; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Env; +use Qossmic\Deptrac\Supportive\Console\Env; class EnvTest extends TestCase { diff --git a/tests/Exception/Console/InvalidArgumentExceptionTest.php b/tests/Supportive/Console/InvalidArgumentExceptionTest.php similarity index 81% rename from tests/Exception/Console/InvalidArgumentExceptionTest.php rename to tests/Supportive/Console/InvalidArgumentExceptionTest.php index ef61ebf3b..811edc9b0 100644 --- a/tests/Exception/Console/InvalidArgumentExceptionTest.php +++ b/tests/Supportive/Console/InvalidArgumentExceptionTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Exception\Console; +namespace Tests\Qossmic\Deptrac\Supportive\Console; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Console\Exception\InvalidArgumentException; +use Qossmic\Deptrac\Supportive\Console\Exception\InvalidArgumentException; use RuntimeException; /** - * @covers \Qossmic\Deptrac\Console\Exception\InvalidArgumentException + * @covers \Qossmic\Deptrac\Supportive\Console\Exception\InvalidArgumentException */ final class InvalidArgumentExceptionTest extends TestCase { diff --git a/tests/Subscriber/ProgressSubscriberTest.php b/tests/Supportive/Console/ProgressSubscriberTest.php similarity index 85% rename from tests/Subscriber/ProgressSubscriberTest.php rename to tests/Supportive/Console/ProgressSubscriberTest.php index cfb6aa70b..d1fcbcf0d 100644 --- a/tests/Subscriber/ProgressSubscriberTest.php +++ b/tests/Supportive/Console/ProgressSubscriberTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Subscriber; +namespace Tests\Qossmic\Deptrac\Supportive\Console; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\Event\AstFileAnalysedEvent; -use Qossmic\Deptrac\Ast\Event\PostCreateAstMapEvent; -use Qossmic\Deptrac\Ast\Event\PreCreateAstMapEvent; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Subscriber\ProgressSubscriber; +use Qossmic\Deptrac\Contract\Ast\AstFileAnalysedEvent; +use Qossmic\Deptrac\Contract\Ast\PostCreateAstMapEvent; +use Qossmic\Deptrac\Contract\Ast\PreCreateAstMapEvent; +use Qossmic\Deptrac\Supportive\Console\Subscriber\ProgressSubscriber; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/DependencyInjection/DeptracExtensionTest.php b/tests/Supportive/DependencyInjection/DeptracExtensionTest.php similarity index 98% rename from tests/DependencyInjection/DeptracExtensionTest.php rename to tests/Supportive/DependencyInjection/DeptracExtensionTest.php index 04b59b37b..0184d75c3 100644 --- a/tests/DependencyInjection/DeptracExtensionTest.php +++ b/tests/Supportive/DependencyInjection/DeptracExtensionTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\DependencyInjection; +namespace Tests\Qossmic\Deptrac\Supportive\DependencyInjection; use InvalidArgumentException; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Dependency\Emitter\EmitterTypes; -use Qossmic\Deptrac\DependencyInjection\DeptracExtension; +use Qossmic\Deptrac\Supportive\DependencyInjection\DeptracExtension; +use Qossmic\Deptrac\Supportive\DependencyInjection\EmitterTypes; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/tests/DependencyInjection/ServiceContainerBuilderTest.php b/tests/Supportive/DependencyInjection/ServiceContainerBuilderTest.php similarity index 88% rename from tests/DependencyInjection/ServiceContainerBuilderTest.php rename to tests/Supportive/DependencyInjection/ServiceContainerBuilderTest.php index 15dad6d1c..8f44b5a99 100644 --- a/tests/DependencyInjection/ServiceContainerBuilderTest.php +++ b/tests/Supportive/DependencyInjection/ServiceContainerBuilderTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\DependencyInjection; +namespace Tests\Qossmic\Deptrac\Supportive\DependencyInjection; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\DependencyInjection\ServiceContainerBuilder; +use Qossmic\Deptrac\Supportive\DependencyInjection\ServiceContainerBuilder; final class ServiceContainerBuilderTest extends TestCase { diff --git a/tests/Exception/File/CouldNotReadFileExceptionTest.php b/tests/Supportive/File/CouldNotReadFileExceptionTest.php similarity index 77% rename from tests/Exception/File/CouldNotReadFileExceptionTest.php rename to tests/Supportive/File/CouldNotReadFileExceptionTest.php index 71575d1eb..e4e07c345 100644 --- a/tests/Exception/File/CouldNotReadFileExceptionTest.php +++ b/tests/Supportive/File/CouldNotReadFileExceptionTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Exception\File; +namespace Tests\Qossmic\Deptrac\Utils\File; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\File\Exception\CouldNotReadFileException; +use Qossmic\Deptrac\Supportive\File\Exception\CouldNotReadFileException; use RuntimeException; /** - * @covers \Qossmic\Deptrac\File\Exception\CouldNotReadFileException + * @covers \Qossmic\Deptrac\Supportive\File\Exception\CouldNotReadFileException */ final class CouldNotReadFileExceptionTest extends TestCase { diff --git a/tests/Exception/Configuration/FileCannotBeParsedAsYamlExceptionTest.php b/tests/Supportive/FileCannotBeParsedAsYamlExceptionTest.php similarity index 80% rename from tests/Exception/Configuration/FileCannotBeParsedAsYamlExceptionTest.php rename to tests/Supportive/FileCannotBeParsedAsYamlExceptionTest.php index a70340b67..a82ede1b7 100644 --- a/tests/Exception/Configuration/FileCannotBeParsedAsYamlExceptionTest.php +++ b/tests/Supportive/FileCannotBeParsedAsYamlExceptionTest.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Exception\Configuration; +namespace Tests\Qossmic\Deptrac\Utils; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\File\Exception\FileCannotBeParsedAsYamlException; +use Qossmic\Deptrac\Supportive\File\Exception\FileCannotBeParsedAsYamlException; use RuntimeException; use Symfony\Component\Yaml\Exception\ParseException; /** - * @covers \Qossmic\Deptrac\File\Exception\FileCannotBeParsedAsYamlException + * @covers \Qossmic\Deptrac\Supportive\File\Exception\FileCannotBeParsedAsYamlException */ final class FileCannotBeParsedAsYamlExceptionTest extends TestCase { diff --git a/tests/Configuration/Fixtures/depfile-syntax-error.yaml b/tests/Supportive/Fixtures/depfile-syntax-error.yaml similarity index 100% rename from tests/Configuration/Fixtures/depfile-syntax-error.yaml rename to tests/Supportive/Fixtures/depfile-syntax-error.yaml diff --git a/tests/Configuration/Fixtures/does-not-contain-array.yml b/tests/Supportive/Fixtures/does-not-contain-array.yml similarity index 100% rename from tests/Configuration/Fixtures/does-not-contain-array.yml rename to tests/Supportive/Fixtures/does-not-contain-array.yml diff --git a/tests/OutputFormatter/BaselineOutputFormatterTest.php b/tests/Supportive/OutputFormatter/BaselineOutputFormatterTest.php similarity index 83% rename from tests/OutputFormatter/BaselineOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/BaselineOutputFormatterTest.php index 73985cc9f..38ce78766 100644 --- a/tests/OutputFormatter/BaselineOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/BaselineOutputFormatterTest.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\BaselineOutputFormatter; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\BaselineOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/OutputFormatter/CodeclimateOutputFormatterTest.php b/tests/Supportive/OutputFormatter/CodeclimateOutputFormatterTest.php similarity index 95% rename from tests/OutputFormatter/CodeclimateOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/CodeclimateOutputFormatterTest.php index 26076b66b..92ce3b3a5 100644 --- a/tests/OutputFormatter/CodeclimateOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/CodeclimateOutputFormatterTest.php @@ -2,24 +2,24 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use Exception; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\FormatterConfiguration; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\CodeclimateOutputFormatter; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\CodeclimateOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\FormatterConfiguration; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/Configuration/ConfigurationCodeclimateTest.php b/tests/Supportive/OutputFormatter/ConfigurationCodeclimateTest.php similarity index 73% rename from tests/Configuration/ConfigurationCodeclimateTest.php rename to tests/Supportive/OutputFormatter/ConfigurationCodeclimateTest.php index ca1676963..778baa4a2 100644 --- a/tests/Configuration/ConfigurationCodeclimateTest.php +++ b/tests/Supportive/OutputFormatter/ConfigurationCodeclimateTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Configuration; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Configuration\ConfigurationCodeclimate; +use Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\ConfigurationCodeclimate; /** - * @covers \Qossmic\Deptrac\Configuration\ConfigurationCodeclimate + * @covers \Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\ConfigurationCodeclimate */ final class ConfigurationCodeclimateTest extends TestCase { diff --git a/tests/Configuration/ConfigurationGraphVizTest.php b/tests/Supportive/OutputFormatter/ConfigurationGraphVizTest.php similarity index 74% rename from tests/Configuration/ConfigurationGraphVizTest.php rename to tests/Supportive/OutputFormatter/ConfigurationGraphVizTest.php index 1d27c321b..1752cab85 100644 --- a/tests/Configuration/ConfigurationGraphVizTest.php +++ b/tests/Supportive/OutputFormatter/ConfigurationGraphVizTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Configuration; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Configuration\ConfigurationGraphViz; +use Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\ConfigurationGraphViz; /** - * @covers \Qossmic\Deptrac\Configuration\ConfigurationGraphViz + * @covers \Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\ConfigurationGraphViz */ final class ConfigurationGraphVizTest extends TestCase { diff --git a/tests/OutputFormatter/ConsoleOutputFormatterTest.php b/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php similarity index 88% rename from tests/OutputFormatter/ConsoleOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php index 11a7c735e..ca5c6de51 100644 --- a/tests/OutputFormatter/ConsoleOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/ConsoleOutputFormatterTest.php @@ -2,24 +2,24 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\ConsoleOutputFormatter; -use Qossmic\Deptrac\Result\Error; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; -use Qossmic\Deptrac\Result\Warning; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Contract\Result\Warning; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\ConsoleOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; @@ -171,7 +171,7 @@ public function basicDataProvider(): iterable yield 'an warning occurred' => [ [], [], - 'warnings' => [Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar'), ['Layer 1', 'Layer 2'])], + 'warnings' => [Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar')->toString(), ['Layer 1', 'Layer 2'])], '[WARNING]Foo\Barisinmorethanonelayer["Layer1","Layer2"].Itisrecommendedthatonetokenshouldonlybeinonelayer.Report:Violations:0Skippedviolations:0Uncovered:0Allowed:0Warnings:1Errors:0', ]; } diff --git a/tests/OutputFormatter/FormatterProviderTest.php b/tests/Supportive/OutputFormatter/FormatterProviderTest.php similarity index 80% rename from tests/OutputFormatter/FormatterProviderTest.php rename to tests/Supportive/OutputFormatter/FormatterProviderTest.php index c4d9406ac..ad75c966a 100644 --- a/tests/OutputFormatter/FormatterProviderTest.php +++ b/tests/Supportive/OutputFormatter/FormatterProviderTest.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\DependencyInjection\Exception\InvalidServiceInLocatorException; -use Qossmic\Deptrac\OutputFormatter\ConsoleOutputFormatter; -use Qossmic\Deptrac\OutputFormatter\FormatterProvider; -use Qossmic\Deptrac\OutputFormatter\TableOutputFormatter; +use Qossmic\Deptrac\Supportive\DependencyInjection\Exception\InvalidServiceInLocatorException; +use Qossmic\Deptrac\Supportive\OutputFormatter\ConsoleOutputFormatter; +use Qossmic\Deptrac\Supportive\OutputFormatter\FormatterProvider; +use Qossmic\Deptrac\Supportive\OutputFormatter\TableOutputFormatter; use stdClass; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\ServiceLocator; @@ -35,7 +35,7 @@ public function testGet(): void public function testContainerHasInvalidService(): void { $this->expectException(InvalidServiceInLocatorException::class); - $this->expectExceptionMessage('Trying to get unsupported service "formatter1" from locator (expected "Qossmic\\Deptrac\\OutputFormatter\\OutputFormatterInterface", but is "stdClass").'); + $this->expectExceptionMessage('Trying to get unsupported service "formatter1" from locator (expected "Qossmic\\Deptrac\\Contract\\OutputFormatter\\OutputFormatterInterface", but is "stdClass").'); (new FormatterProvider(new ServiceLocator(['formatter1' => static fn () => new stdClass()])))->get('formatter1'); } diff --git a/tests/OutputFormatter/GithubActionsOutputFormatterTest.php b/tests/Supportive/OutputFormatter/GithubActionsOutputFormatterTest.php similarity index 88% rename from tests/OutputFormatter/GithubActionsOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/GithubActionsOutputFormatterTest.php index 32cafd6f8..9c929e8c1 100644 --- a/tests/OutputFormatter/GithubActionsOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/GithubActionsOutputFormatterTest.php @@ -2,24 +2,24 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\GithubActionsOutputFormatter; -use Qossmic\Deptrac\Result\Error; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; -use Qossmic\Deptrac\Result\Warning; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Contract\Result\Warning; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\GithubActionsOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; @@ -138,7 +138,7 @@ public function finishProvider(): iterable 'violations' => [], 'errors' => [], 'warnings' => [ - Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar'), ['Layer 1', 'Layer 2']), + Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar')->toString(), ['Layer 1', 'Layer 2']), ], "::warning ::Foo\Bar is in more than one layer [\"Layer 1\", \"Layer 2\"]. It is recommended that one token should only be in one layer.\n", ]; diff --git a/tests/OutputFormatter/GraphVizDotOutputFormatterTest.php b/tests/Supportive/OutputFormatter/GraphVizDotOutputFormatterTest.php similarity index 87% rename from tests/OutputFormatter/GraphVizDotOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/GraphVizDotOutputFormatterTest.php index 5bbc616cd..f5a8ff096 100644 --- a/tests/OutputFormatter/GraphVizDotOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/GraphVizDotOutputFormatterTest.php @@ -2,21 +2,21 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\FormatterConfiguration; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\OutputFormatter\GraphVizOutputDotFormatter; -use Qossmic\Deptrac\Result\Allowed; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\Allowed; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\Configuration\FormatterConfiguration; +use Qossmic\Deptrac\Supportive\OutputFormatter\GraphVizOutputDotFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/OutputFormatter/JUnitOutputFormatterTest.php b/tests/Supportive/OutputFormatter/JUnitOutputFormatterTest.php similarity index 88% rename from tests/OutputFormatter/JUnitOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/JUnitOutputFormatterTest.php index 090c7ac7d..01e3fc604 100644 --- a/tests/OutputFormatter/JUnitOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/JUnitOutputFormatterTest.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\JUnitOutputFormatter; -use Qossmic\Deptrac\Result\Error; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\JUnitOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/OutputFormatter/JsonOutputFormatterTest.php b/tests/Supportive/OutputFormatter/JsonOutputFormatterTest.php similarity index 95% rename from tests/OutputFormatter/JsonOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/JsonOutputFormatterTest.php index d21623f63..8c5be612d 100644 --- a/tests/OutputFormatter/JsonOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/JsonOutputFormatterTest.php @@ -2,23 +2,23 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use Exception; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\JsonOutputFormatter; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\JsonOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/OutputFormatter/TableOutputFormatterTest.php b/tests/Supportive/OutputFormatter/TableOutputFormatterTest.php similarity index 91% rename from tests/OutputFormatter/TableOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/TableOutputFormatterTest.php index 355c765c8..8f76c1f6e 100644 --- a/tests/OutputFormatter/TableOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/TableOutputFormatterTest.php @@ -2,24 +2,24 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\TableOutputFormatter; -use Qossmic\Deptrac\Result\Error; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Uncovered; -use Qossmic\Deptrac\Result\Violation; -use Qossmic\Deptrac\Result\Warning; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\Error; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Uncovered; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Contract\Result\Warning; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\TableOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; @@ -291,7 +291,7 @@ public function basicDataProvider(): iterable yield 'an warning occurred' => [ 'rules' => [], 'errors' => [], - 'warnings' => [Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar'), ['Layer 1', 'Layer 2'])], + 'warnings' => [Warning::tokenIsInMoreThanOneLayer(ClassLikeToken::fromFQCN('Foo\Bar')->toString(), ['Layer 1', 'Layer 2'])], ' ------------------------------------------------------------------------------------------------------------------------- Warnings ------------------------------------------------------------------------------------------------------------------------- diff --git a/tests/OutputFormatter/XMLOutputFormatterTest.php b/tests/Supportive/OutputFormatter/XMLOutputFormatterTest.php similarity index 88% rename from tests/OutputFormatter/XMLOutputFormatterTest.php rename to tests/Supportive/OutputFormatter/XMLOutputFormatterTest.php index 43550f557..27e37f222 100644 --- a/tests/OutputFormatter/XMLOutputFormatterTest.php +++ b/tests/Supportive/OutputFormatter/XMLOutputFormatterTest.php @@ -2,21 +2,21 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\OutputFormatter; +namespace Tests\Qossmic\Deptrac\Supportive\OutputFormatter; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\Ast\AstMap\AstInherit; -use Qossmic\Deptrac\Ast\AstMap\ClassLike\ClassLikeToken; -use Qossmic\Deptrac\Ast\AstMap\FileOccurrence; -use Qossmic\Deptrac\Configuration\OutputFormatterInput; -use Qossmic\Deptrac\Console\Symfony\Style; -use Qossmic\Deptrac\Console\Symfony\SymfonyOutput; -use Qossmic\Deptrac\Dependency\Dependency; -use Qossmic\Deptrac\Dependency\InheritDependency; -use Qossmic\Deptrac\OutputFormatter\XMLOutputFormatter; -use Qossmic\Deptrac\Result\LegacyResult; -use Qossmic\Deptrac\Result\SkippedViolation; -use Qossmic\Deptrac\Result\Violation; +use Qossmic\Deptrac\Contract\OutputFormatter\OutputFormatterInput; +use Qossmic\Deptrac\Contract\Result\LegacyResult; +use Qossmic\Deptrac\Contract\Result\SkippedViolation; +use Qossmic\Deptrac\Contract\Result\Violation; +use Qossmic\Deptrac\Core\Ast\AstMap\AstInherit; +use Qossmic\Deptrac\Core\Ast\AstMap\ClassLike\ClassLikeToken; +use Qossmic\Deptrac\Core\Ast\AstMap\FileOccurrence; +use Qossmic\Deptrac\Core\Dependency\Dependency; +use Qossmic\Deptrac\Core\Dependency\InheritDependency; +use Qossmic\Deptrac\Supportive\Console\Symfony\Style; +use Qossmic\Deptrac\Supportive\Console\Symfony\SymfonyOutput; +use Qossmic\Deptrac\Supportive\OutputFormatter\XMLOutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/tests/OutputFormatter/data/expected-baseline-report_1.yml b/tests/Supportive/OutputFormatter/data/expected-baseline-report_1.yml similarity index 100% rename from tests/OutputFormatter/data/expected-baseline-report_1.yml rename to tests/Supportive/OutputFormatter/data/expected-baseline-report_1.yml diff --git a/tests/OutputFormatter/data/expected-baseline-report_2.yml b/tests/Supportive/OutputFormatter/data/expected-baseline-report_2.yml similarity index 100% rename from tests/OutputFormatter/data/expected-baseline-report_2.yml rename to tests/Supportive/OutputFormatter/data/expected-baseline-report_2.yml diff --git a/tests/OutputFormatter/data/expected-baseline-report_3.yml b/tests/Supportive/OutputFormatter/data/expected-baseline-report_3.yml similarity index 100% rename from tests/OutputFormatter/data/expected-baseline-report_3.yml rename to tests/Supportive/OutputFormatter/data/expected-baseline-report_3.yml diff --git a/tests/OutputFormatter/data/expected-baseline-report_4.yml b/tests/Supportive/OutputFormatter/data/expected-baseline-report_4.yml similarity index 100% rename from tests/OutputFormatter/data/expected-baseline-report_4.yml rename to tests/Supportive/OutputFormatter/data/expected-baseline-report_4.yml diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_1.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_1.json similarity index 85% rename from tests/OutputFormatter/data/expected-codeclimate-report_1.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_1.json index ed8bfaab7..37ce70e33 100644 --- a/tests/OutputFormatter/data/expected-codeclimate-report_1.json +++ b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_1.json @@ -2,7 +2,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "ac4734c12b47a898cf9897223f7f84b817666381", + "fingerprint": "c68d30f5693b2993a902e3554f0458c069bb001e", "description": "ClassA must not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "major", @@ -16,7 +16,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "71612440afbf568fd7eeefe98866276e2862cdb7", + "fingerprint": "a9d2c2a1b580cb24bb64216fbfd39be0c5600542", "description": "ClassC must not depend on ClassD (LayerA on LayerC)", "categories": ["Style", "Complexity"], "severity": "major", @@ -30,7 +30,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "b9d686a9529e304423bac712f009ed53d4550aa7", + "fingerprint": "f9079fc4392790726fb648e4914931f07a11f2e7", "description": "ClassC must not depend on ClassE (LayerA on LayerE)", "categories": ["Style", "Complexity"], "severity": "major", diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_2.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_2.json similarity index 85% rename from tests/OutputFormatter/data/expected-codeclimate-report_2.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_2.json index e3da2e199..ff4135d03 100644 --- a/tests/OutputFormatter/data/expected-codeclimate-report_2.json +++ b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_2.json @@ -2,7 +2,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "8b937450757be9dd8c27d325130904e774397b21", + "fingerprint": "591fe77ebf73037749a9380b66904c405c44a63b", "description": "OriginalA must not depend on OriginalB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "major", diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_3.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_3.json similarity index 100% rename from tests/OutputFormatter/data/expected-codeclimate-report_3.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_3.json diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_4.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_4.json similarity index 85% rename from tests/OutputFormatter/data/expected-codeclimate-report_4.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_4.json index 558e03d15..2622c8eb8 100644 --- a/tests/OutputFormatter/data/expected-codeclimate-report_4.json +++ b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_4.json @@ -2,7 +2,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "41269d64e26ddb32e996c1bf1dfabcf609bbda61", + "fingerprint": "b0271a8bc6e79aed2b96029f4ad8eff55deced1e", "description": "ClassA should not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "minor", @@ -16,7 +16,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "11de15c77ec721e0a0cddf4040c68d548e2ad584", + "fingerprint": "ac218020428e307ab893f42f56392879fc3a9856", "description": "ClassC should not depend on ClassD (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "minor", diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_5.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_5.json similarity index 85% rename from tests/OutputFormatter/data/expected-codeclimate-report_5.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_5.json index 1a49a8137..cc6d8100f 100644 --- a/tests/OutputFormatter/data/expected-codeclimate-report_5.json +++ b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_5.json @@ -2,7 +2,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "ac4734c12b47a898cf9897223f7f84b817666381", + "fingerprint": "c68d30f5693b2993a902e3554f0458c069bb001e", "description": "ClassA must not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "major", @@ -16,7 +16,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "f3fcfc6815b83d9f78ca21a513fb36d9dac5da9a", + "fingerprint": "8f3679f74dfabe02f1fc5693227d3d8835ef208b", "description": "ClassA should not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "minor", @@ -30,7 +30,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "11de15c77ec721e0a0cddf4040c68d548e2ad584", + "fingerprint": "ac218020428e307ab893f42f56392879fc3a9856", "description": "ClassC should not depend on ClassD (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "minor", @@ -44,7 +44,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "662737b116cf5284a0171de255bebb61f6fc483e", + "fingerprint": "5467e280ef828188fa20a99908518469f7595361", "description": "OriginalA has uncovered dependency on OriginalB (LayerA)", "categories": ["Style", "Complexity"], "severity": "info", diff --git a/tests/OutputFormatter/data/expected-codeclimate-report_6.json b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_6.json similarity index 85% rename from tests/OutputFormatter/data/expected-codeclimate-report_6.json rename to tests/Supportive/OutputFormatter/data/expected-codeclimate-report_6.json index 4de9ee55e..fdadc0544 100644 --- a/tests/OutputFormatter/data/expected-codeclimate-report_6.json +++ b/tests/Supportive/OutputFormatter/data/expected-codeclimate-report_6.json @@ -2,7 +2,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "ac4734c12b47a898cf9897223f7f84b817666381", + "fingerprint": "c68d30f5693b2993a902e3554f0458c069bb001e", "description": "ClassA must not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "blocker", @@ -16,7 +16,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "f3fcfc6815b83d9f78ca21a513fb36d9dac5da9a", + "fingerprint": "8f3679f74dfabe02f1fc5693227d3d8835ef208b", "description": "ClassA should not depend on ClassB (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "critical", @@ -30,7 +30,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "11de15c77ec721e0a0cddf4040c68d548e2ad584", + "fingerprint": "ac218020428e307ab893f42f56392879fc3a9856", "description": "ClassC should not depend on ClassD (LayerA on LayerB)", "categories": ["Style", "Complexity"], "severity": "critical", @@ -44,7 +44,7 @@ { "type": "issue", "check_name": "Dependency violation", - "fingerprint": "662737b116cf5284a0171de255bebb61f6fc483e", + "fingerprint": "5467e280ef828188fa20a99908518469f7595361", "description": "OriginalA has uncovered dependency on OriginalB (LayerA)", "categories": ["Style", "Complexity"], "severity": "minor", diff --git a/tests/OutputFormatter/data/expected-json-report_1.json b/tests/Supportive/OutputFormatter/data/expected-json-report_1.json similarity index 100% rename from tests/OutputFormatter/data/expected-json-report_1.json rename to tests/Supportive/OutputFormatter/data/expected-json-report_1.json diff --git a/tests/OutputFormatter/data/expected-json-report_2.json b/tests/Supportive/OutputFormatter/data/expected-json-report_2.json similarity index 100% rename from tests/OutputFormatter/data/expected-json-report_2.json rename to tests/Supportive/OutputFormatter/data/expected-json-report_2.json diff --git a/tests/OutputFormatter/data/expected-json-report_3.json b/tests/Supportive/OutputFormatter/data/expected-json-report_3.json similarity index 100% rename from tests/OutputFormatter/data/expected-json-report_3.json rename to tests/Supportive/OutputFormatter/data/expected-json-report_3.json diff --git a/tests/OutputFormatter/data/expected-json-report_4.json b/tests/Supportive/OutputFormatter/data/expected-json-report_4.json similarity index 100% rename from tests/OutputFormatter/data/expected-json-report_4.json rename to tests/Supportive/OutputFormatter/data/expected-json-report_4.json diff --git a/tests/OutputFormatter/data/expected-json-report_5.json b/tests/Supportive/OutputFormatter/data/expected-json-report_5.json similarity index 100% rename from tests/OutputFormatter/data/expected-json-report_5.json rename to tests/Supportive/OutputFormatter/data/expected-json-report_5.json diff --git a/tests/OutputFormatter/data/expected-junit-report-with-skipped-violations.xml b/tests/Supportive/OutputFormatter/data/expected-junit-report-with-skipped-violations.xml similarity index 100% rename from tests/OutputFormatter/data/expected-junit-report-with-skipped-violations.xml rename to tests/Supportive/OutputFormatter/data/expected-junit-report-with-skipped-violations.xml diff --git a/tests/OutputFormatter/data/expected-junit-report-with-unmatched-violations.xml b/tests/Supportive/OutputFormatter/data/expected-junit-report-with-unmatched-violations.xml similarity index 100% rename from tests/OutputFormatter/data/expected-junit-report-with-unmatched-violations.xml rename to tests/Supportive/OutputFormatter/data/expected-junit-report-with-unmatched-violations.xml diff --git a/tests/OutputFormatter/data/expected-junit-report_1.xml b/tests/Supportive/OutputFormatter/data/expected-junit-report_1.xml similarity index 100% rename from tests/OutputFormatter/data/expected-junit-report_1.xml rename to tests/Supportive/OutputFormatter/data/expected-junit-report_1.xml diff --git a/tests/OutputFormatter/data/expected-junit-report_2.xml b/tests/Supportive/OutputFormatter/data/expected-junit-report_2.xml similarity index 100% rename from tests/OutputFormatter/data/expected-junit-report_2.xml rename to tests/Supportive/OutputFormatter/data/expected-junit-report_2.xml diff --git a/tests/OutputFormatter/data/expected-junit-report_3.xml b/tests/Supportive/OutputFormatter/data/expected-junit-report_3.xml similarity index 100% rename from tests/OutputFormatter/data/expected-junit-report_3.xml rename to tests/Supportive/OutputFormatter/data/expected-junit-report_3.xml diff --git a/tests/OutputFormatter/data/expected-xml-report-with-skipped-violations.xml b/tests/Supportive/OutputFormatter/data/expected-xml-report-with-skipped-violations.xml similarity index 100% rename from tests/OutputFormatter/data/expected-xml-report-with-skipped-violations.xml rename to tests/Supportive/OutputFormatter/data/expected-xml-report-with-skipped-violations.xml diff --git a/tests/OutputFormatter/data/expected-xml-report_1.xml b/tests/Supportive/OutputFormatter/data/expected-xml-report_1.xml similarity index 100% rename from tests/OutputFormatter/data/expected-xml-report_1.xml rename to tests/Supportive/OutputFormatter/data/expected-xml-report_1.xml diff --git a/tests/OutputFormatter/data/expected-xml-report_2.xml b/tests/Supportive/OutputFormatter/data/expected-xml-report_2.xml similarity index 100% rename from tests/OutputFormatter/data/expected-xml-report_2.xml rename to tests/Supportive/OutputFormatter/data/expected-xml-report_2.xml diff --git a/tests/OutputFormatter/data/expected-xml-report_3.xml b/tests/Supportive/OutputFormatter/data/expected-xml-report_3.xml similarity index 100% rename from tests/OutputFormatter/data/expected-xml-report_3.xml rename to tests/Supportive/OutputFormatter/data/expected-xml-report_3.xml diff --git a/tests/OutputFormatter/data/graphviz-expected.dot b/tests/Supportive/OutputFormatter/data/graphviz-expected.dot similarity index 100% rename from tests/OutputFormatter/data/graphviz-expected.dot rename to tests/Supportive/OutputFormatter/data/graphviz-expected.dot diff --git a/tests/OutputFormatter/data/graphviz-groups-point.dot b/tests/Supportive/OutputFormatter/data/graphviz-groups-point.dot similarity index 100% rename from tests/OutputFormatter/data/graphviz-groups-point.dot rename to tests/Supportive/OutputFormatter/data/graphviz-groups-point.dot diff --git a/tests/OutputFormatter/data/graphviz-groups.dot b/tests/Supportive/OutputFormatter/data/graphviz-groups.dot similarity index 100% rename from tests/OutputFormatter/data/graphviz-groups.dot rename to tests/Supportive/OutputFormatter/data/graphviz-groups.dot diff --git a/tests/Exception/Configuration/ParsedYamlIsNotAnArrayExceptionTest.php b/tests/Supportive/ParsedYamlIsNotAnArrayExceptionTest.php similarity index 78% rename from tests/Exception/Configuration/ParsedYamlIsNotAnArrayExceptionTest.php rename to tests/Supportive/ParsedYamlIsNotAnArrayExceptionTest.php index b94226d92..ad5137a55 100644 --- a/tests/Exception/Configuration/ParsedYamlIsNotAnArrayExceptionTest.php +++ b/tests/Supportive/ParsedYamlIsNotAnArrayExceptionTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Exception\Configuration; +namespace Tests\Qossmic\Deptrac\Utils; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\File\Exception\ParsedYamlIsNotAnArrayException; +use Qossmic\Deptrac\Supportive\File\Exception\ParsedYamlIsNotAnArrayException; use RuntimeException; /** - * @covers \Qossmic\Deptrac\File\Exception\ParsedYamlIsNotAnArrayException + * @covers \Qossmic\Deptrac\Supportive\File\Exception\ParsedYamlIsNotAnArrayException */ final class ParsedYamlIsNotAnArrayExceptionTest extends TestCase { diff --git a/tests/Configuration/Loader/YmlFileLoaderTest.php b/tests/Supportive/YmlFileLoaderTest.php similarity index 69% rename from tests/Configuration/Loader/YmlFileLoaderTest.php rename to tests/Supportive/YmlFileLoaderTest.php index 5bcc9109b..c2b3b5e8c 100644 --- a/tests/Configuration/Loader/YmlFileLoaderTest.php +++ b/tests/Supportive/YmlFileLoaderTest.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace Tests\Qossmic\Deptrac\Configuration\Loader; +namespace Tests\Qossmic\Deptrac\Utils; use PHPUnit\Framework\TestCase; -use Qossmic\Deptrac\File\Exception\CouldNotReadFileException; -use Qossmic\Deptrac\File\Exception\FileCannotBeParsedAsYamlException; -use Qossmic\Deptrac\File\Exception\ParsedYamlIsNotAnArrayException; -use Qossmic\Deptrac\File\YmlFileLoader; +use Qossmic\Deptrac\Supportive\File\Exception\CouldNotReadFileException; +use Qossmic\Deptrac\Supportive\File\Exception\FileCannotBeParsedAsYamlException; +use Qossmic\Deptrac\Supportive\File\Exception\ParsedYamlIsNotAnArrayException; +use Qossmic\Deptrac\Supportive\File\YmlFileLoader; /** - * @covers \Qossmic\Deptrac\File\YmlFileLoader + * @covers \Qossmic\Deptrac\Supportive\File\YmlFileLoader */ final class YmlFileLoaderTest extends TestCase { public function testLoadThrowsFileDoesNotExistsExceptionWhenFileDoesNotExist(): void { - $file = __DIR__.'/../Fixtures/non-existent-file.yaml'; + $file = __DIR__.'/Fixtures/non-existent-file.yaml'; $loader = new YmlFileLoader(); @@ -39,7 +39,7 @@ public function testLoadThrowsFileCannotBeParsedAsYamlExceptionWhenFileDoesNotCo public function testSyntaxErrorDetailsPrinted(): void { - $file = __DIR__.'/../Fixtures/depfile-syntax-error.yaml'; + $file = __DIR__.'/Fixtures/depfile-syntax-error.yaml'; $loader = new YmlFileLoader(); @@ -51,7 +51,7 @@ public function testSyntaxErrorDetailsPrinted(): void public function testLoadThrowsParsedYamlIsNotAnArrayExceptionWhenFileDoesNotContainYamlThatCanBeParsedToAnArray(): void { - $file = __DIR__.'/../Fixtures/does-not-contain-array.yml'; + $file = __DIR__.'/Fixtures/does-not-contain-array.yml'; $loader = new YmlFileLoader();