Open
Conversation
noelma
reviewed
Jun 21, 2023
|
|
||
| public function evaluate(ClassDescription $theClass, Violations $violations, string $because): void | ||
| { | ||
| foreach ($this->expressions as $expression) { |
There was a problem hiding this comment.
question: Could we throw a logicalException or violation if none or only one expression is used? And if so, add a test method 🙏
Contributor
There was a problem hiding this comment.
I'm actually not sure this is a good idea.
If we want to build automations on top of this, we will want to instantiate this with a list of expressions that are somehow inferred.
This list might have something or might be empty, in which case I think it should be irrelevant and therefore should not fail, essentially being ignored.
WDYT?
hgraca
reviewed
Jul 27, 2023
| /** @var Expression[] */ | ||
| private $expressions; | ||
|
|
||
| public function __construct(array $expressions) |
Contributor
There was a problem hiding this comment.
Could we do public function __construct(Expression ...$expressions)?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Allow to define logical expressions which will help with more advanced or complex expressions. Class name is not perfect but
Oris keyword hence can't be used directly as class name.Orxwas inspired by doctrine project.If we are fine with that approach then I can implement more (like
and).