Skip to content

Commit

Permalink
cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smoench committed Feb 28, 2020
1 parent 3fcff20 commit 4d7b157
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/AstRunner/AstMap/AstFileReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(string $filepath)
}

/**
* @param AstInherit[] $inherits
* @param AstInherit[] $inherits
* @param AstDependency[] $dependencies
*/
public function addClassReference(ClassLikeName $className, array $inherits = [], array $dependencies = []): AstClassReference
Expand Down
4 changes: 2 additions & 2 deletions src/OutputFormatter/XMLOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ private function addRule(string $type, \DOMElement $rootEntry, \DOMDocument $xml
$entry->appendChild($xmlDoc->createElement('LayerB', $rule->getLayerB()));

$dependency = $rule->getDependency();
$entry->appendChild($xmlDoc->createElement('ClassA', $dependency->getClassA()));
$entry->appendChild($xmlDoc->createElement('ClassB', $dependency->getClassB()));
$entry->appendChild($xmlDoc->createElement('ClassA', $dependency->getClassLikeNameA()->toString()));
$entry->appendChild($xmlDoc->createElement('ClassB', $dependency->getClassLikeNameB()->toString()));

$fileOccurrence = $dependency->getFileOccurrence();
$occurrence = $xmlDoc->createElement('occurrence');
Expand Down
45 changes: 23 additions & 22 deletions tests/OutputFormatter/XMLOutputFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPUnit\Framework\TestCase;
use SensioLabs\Deptrac\AstRunner\AstMap\AstFileReference;
use SensioLabs\Deptrac\AstRunner\AstMap\AstInherit;
use SensioLabs\Deptrac\AstRunner\AstMap\ClassLikeName;
use SensioLabs\Deptrac\AstRunner\AstMap\FileOccurrence;
use SensioLabs\Deptrac\Dependency\Dependency;
use SensioLabs\Deptrac\Dependency\InheritDependency;
Expand Down Expand Up @@ -40,13 +41,13 @@ public function basicDataProvider(): iterable
[
new Violation(
new InheritDependency(
'ClassA',
'ClassB',
new Dependency('OriginalA', 'OriginalB', new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends('ClassInheritA', new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends('ClassInheritB', new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends('ClassInheritC', new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends('ClassInheritD', new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
ClassLikeName::fromFQCN('ClassA'),
ClassLikeName::fromFQCN('ClassB'),
new Dependency(ClassLikeName::fromFQCN('OriginalA'), ClassLikeName::fromFQCN('OriginalB'), new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritA'), new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritB'), new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritC'), new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritD'), new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
])
),
'LayerA',
Expand All @@ -59,7 +60,7 @@ public function basicDataProvider(): iterable
yield [
[
new Violation(
new Dependency('OriginalA', 'OriginalB', new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
new Dependency(ClassLikeName::fromFQCN('OriginalA'), ClassLikeName::fromFQCN('OriginalB'), new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
'LayerA',
'LayerB'
),
Expand All @@ -76,27 +77,27 @@ public function basicDataProvider(): iterable
[
$violations = new SkippedViolation(
new InheritDependency(
'ClassA',
'ClassB',
new Dependency('OriginalA', 'OriginalB', new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends('ClassInheritA', new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends('ClassInheritB', new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends('ClassInheritC', new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends('ClassInheritD', new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
ClassLikeName::fromFQCN('ClassA'),
ClassLikeName::fromFQCN('ClassB'),
new Dependency(ClassLikeName::fromFQCN('OriginalA'), ClassLikeName::fromFQCN('OriginalB'), new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritA'), new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritB'), new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritC'), new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritD'), new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
])
),
'LayerA',
'LayerB'
),
new SkippedViolation(
new InheritDependency(
'ClassC',
'ClassD',
new Dependency('OriginalA', 'OriginalB', new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends('ClassInheritA', new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends('ClassInheritB', new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends('ClassInheritC', new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends('ClassInheritD', new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
ClassLikeName::fromFQCN('ClassC'),
ClassLikeName::fromFQCN('ClassD'),
new Dependency(ClassLikeName::fromFQCN('OriginalA'), ClassLikeName::fromFQCN('OriginalB'), new FileOccurrence(new AstFileReference('ClassA.php'), 12)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritA'), new FileOccurrence(new AstFileReference('ClassA.php'), 3))->withPath([
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritB'), new FileOccurrence(new AstFileReference('ClassInheritA.php'), 4)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritC'), new FileOccurrence(new AstFileReference('ClassInheritB.php'), 5)),
AstInherit::newExtends(ClassLikeName::fromFQCN('ClassInheritD'), new FileOccurrence(new AstFileReference('ClassInheritC.php'), 6)),
])
),
'LayerA',
Expand Down

0 comments on commit 4d7b157

Please sign in to comment.