Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/structarmed/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"boundwize/structarmed": "^0.19.0"
"boundwize/structarmed": "^0.20.0"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Boundwize\StructArmed\Analyser\ClassNode;
use Boundwize\StructArmed\Rule\RuleInterface;
use Boundwize\StructArmed\Rule\RuleViolation;
use Testo\Tools\StructArmed\Support\ClassAnnotations;

/**
* Every class-like must state its audience: @api (part of the public contract) or
Expand All @@ -27,10 +26,7 @@ public function appliesTo(ClassNode $classNode): bool

public function evaluate(ClassNode $classNode): ?RuleViolation
{
if (
ClassAnnotations::hasApi($classNode->file, $classNode->shortName())
|| ClassAnnotations::hasInternal($classNode->file, $classNode->shortName())
) {
if ($classNode->isApi || $classNode->isInternal) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Boundwize\StructArmed\Analyser\ClassNode;
use Boundwize\StructArmed\Rule\ExtendedClassAwareRuleInterface;
use Boundwize\StructArmed\Rule\RuleViolation;
use Testo\Tools\StructArmed\Support\ClassAnnotations;

/**
* An @internal class with no subclasses must be final: nothing outside the package
Expand All @@ -25,7 +24,7 @@ public function appliesTo(ClassNode $classNode): bool
return $classNode->isClass()
&& ! $classNode->isAbstract
&& $classNode->isInLayer($this->layer)
&& ClassAnnotations::hasInternal($classNode->file, $classNode->shortName());
&& $classNode->isInternal;
}

public function evaluate(ClassNode $classNode): ?RuleViolation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Boundwize\StructArmed\Rule\MultipleRuleViolationInterface;
use Boundwize\StructArmed\Rule\RuleInterface;
use Boundwize\StructArmed\Rule\RuleViolation;
use Testo\Tools\StructArmed\Support\ClassAnnotations;
use Testo\Tools\StructArmed\Support\ClassSignatures;

/**
Expand Down Expand Up @@ -69,6 +68,6 @@ className: $classNode->className,
private function isInternal(ClassNode $classNode): bool
{
return \str_contains($classNode->className, self::SEGMENT)
|| ClassAnnotations::hasInternal($classNode->file, $classNode->shortName());
|| $classNode->isInternal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Boundwize\StructArmed\Analyser\ClassNode;
use Boundwize\StructArmed\Rule\RuleInterface;
use Boundwize\StructArmed\Rule\RuleViolation;
use Testo\Tools\StructArmed\Support\ClassAnnotations;

/**
* Anything living under an `Internal` namespace segment is implementation detail and
Expand All @@ -27,7 +26,7 @@ public function appliesTo(ClassNode $classNode): bool

public function evaluate(ClassNode $classNode): ?RuleViolation
{
return ClassAnnotations::hasInternal($classNode->file, $classNode->shortName()) ? null : new RuleViolation(
return $classNode->isInternal ? null : new RuleViolation(
message: \sprintf('%s [%s] lives under an Internal namespace and must be annotated @internal', $classNode->getType(), $classNode->className),
file: $classNode->file,
line: $classNode->line,
Expand Down
68 changes: 0 additions & 68 deletions tools/structarmed/src/Support/ClassAnnotations.php

This file was deleted.

Loading