-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #499 from qossmic/classes-in-two-or-more-layers
[POC] report warnings about classes are in two or more layers
- Loading branch information
Showing
13 changed files
with
260 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Qossmic\Deptrac\RulesetEngine; | ||
|
||
use Qossmic\Deptrac\AstRunner\AstMap\ClassLikeName; | ||
|
||
final class Warning | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $message; | ||
|
||
private function __construct(string $message) | ||
{ | ||
$this->message = $message; | ||
} | ||
|
||
/** | ||
* @param string[] $layerNames | ||
*/ | ||
public static function classLikeIsInMoreThanOneLayer( | ||
ClassLikeName $getClassLikeNameA, | ||
array $layerNames | ||
): self { | ||
return new self(sprintf( | ||
'%s is in more than one layer ["%s"]. It is recommended that one class should only be in one layer.', | ||
$getClassLikeNameA->toString(), | ||
implode('", "', $layerNames) | ||
)); | ||
} | ||
|
||
public function toString(): string | ||
{ | ||
return $this->message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.