-
Notifications
You must be signed in to change notification settings - Fork 21
Contract propagation for subclasses #10
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
Conversation
throw new DomainException($errorMessage); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace found at end of line
{ | ||
$this->value += $variable; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace found at end of line
Hello! Thank your for this PR, I'll review it when I will be free ) Great job! |
throw new ContractViolation($invocation, $annotation->value, $e); | ||
} | ||
} | ||
(new PreconditionContract($this->reader))->check($invocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like, that we create new instances of PreconditionContract on every method call. This is very expensive. You should avoid unnecessary object initialization and method calls for better performance.
One more suggest: if you want to separate this logic into smaller classes, then it will be better to define 3 separate aspects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, we can move object initialization to ContractCheckerAspect::construct
Looks good! Thank you! 👍 However I will polish several things to keep core simple and fast. Don't you mind? |
@lisachenko No problem, thanks 👍 |
Enhancement releated to #9, with next pull request we can add support for interfaces.
Little reorganization of classes into smaller ones