Open innocenzi opened 6 months ago
Reverse problem with false negatives:
Suppose I have the models App\Models\Blog
and App\Models\BlogPost
, doing the following will not throw an error if App\Models\BlogPost
implements the ExampleContract
, even though it was not in the ignore list (because App\Models\BlogPost
also starts with App\Models\Blog
):
arch('models do not implement some contract', function () {
expect('App\Models')
->not->toImplement(ExampleContract::class)
->ignoring([
'App\Models\Blog',
]);
});
When testing with explicit classes instead of namespaces, this is rather unexpected behavior.
Versions
What Happened
When forbidding the usage of
Carbon\Carbon
, the architecture plugin also forbids the usage ofCarbon\CarbonImmutable
. This seems to be due to the check being a "starts with".How to Reproduce
The following test fails if
Carbon\CarbonImmutable
is used:Versions
Screenshots
Notes
Using
->ignoring('Carbon\\CarbonImmutable')
works around the issue.