Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Implements ArchitectureViolationException to display right collision editor on violation #1

Merged
merged 1 commit into from Apr 1, 2023

Conversation

fabio-ivona
Copy link
Contributor

This PR finalizes the work started with nunomaduro/collision#266, nunomaduro/collision@932776f and pestphp/pest#754

it defines a new ArchitectureViolationException that implements collision's RenderableOnCollisionEditor allowing to display the exact code snippet where an architecture violation occurred:

https://user-images.githubusercontent.com/8792274/227603858-318d96c0-7220-4c72-ac3a-a3b9491e88d4.png

After this is merged, there are a couple of todos I'd like to implement:

  • fix violation file path by removing vendor/composer/../../
  • adding the ability to RenderableOnCollisionEditor to not display a custom editor, this will allow to use ArchitectureViolationException everywhere, even where a violation snippet is not needed (eg. in toBeUsedIn() expectations)

src/Blueprint.php Show resolved Hide resolved

/** @var array<int, Name> $names */
/** @phpstan-ignore-next-line */
$names = array_values(array_filter($names, static fn (Name $name): bool => $name->toString() === $target));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I have a strange phpstan error, can't manage to remove this ignore, any clue?

@nunomaduro nunomaduro merged commit 5b865ae into pestphp:2.x Apr 1, 2023
0 of 26 checks passed
@fabio-ivona fabio-ivona deleted the violation-file-and-lines branch April 2, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants