Skip to content

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

Merged
merged 19 commits into from
Apr 2, 2016
Merged

Conversation

pdaw
Copy link
Member

@pdaw pdaw commented Mar 30, 2016

Enhancement releated to #9, with next pull request we can add support for interfaces.

Little reorganization of classes into smaller ones

throw new DomainException($errorMessage);
}
}
}

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;
}
}

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

@lisachenko
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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

@lisachenko lisachenko merged commit bde278b into php-deal:master Apr 2, 2016
@lisachenko
Copy link
Member

Looks good! Thank you! 👍

However I will polish several things to keep core simple and fast. Don't you mind?

@lisachenko lisachenko mentioned this pull request Apr 2, 2016
@lisachenko lisachenko added this to the 0.4.0 milestone Apr 2, 2016
@pdaw
Copy link
Member Author

pdaw commented Apr 2, 2016

@lisachenko No problem, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants