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

Simplify conditions #630

Merged
merged 5 commits into from Oct 8, 2018
Merged

Simplify conditions #630

merged 5 commits into from Oct 8, 2018

Conversation

omarkdev
Copy link
Contributor

@omarkdev omarkdev commented Oct 3, 2018

This PR is intended to simplify conditions, either by applying an early return or apply ternary operations in if and else conditions

Copy link
Member

@mnapoli mnapoli left a comment

Choose a reason for hiding this comment

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

👍 some nice changes! I've added a comment inline.

}
$value = $parameter->isOptional() && ! $this->definitionResolver->isResolvable($value)
? $this->getParameterDefaultValue($parameter, $method)
: $this->definitionResolver->resolve($value);
Copy link
Member

Choose a reason for hiding this comment

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

While the rest are great improvements I don't feel this one is more readable with the change, could you revert this?

@omarkdev
Copy link
Contributor Author

omarkdev commented Oct 7, 2018

Done, @mnapoli, I reversed the change in the file

@@ -71,7 +71,6 @@ public function resolveParameters(

// Nested definitions
if ($value instanceof Definition) {
// If the container cannot produce the entry, we can use the default parameter value
Copy link
Member

Choose a reason for hiding this comment

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

I just notice this removal: why remove the comment?

@omarkdev
Copy link
Contributor Author

omarkdev commented Oct 8, 2018

@mnapoli I removed the comments by mistake, now I revert the remove of comment

@mnapoli
Copy link
Member

mnapoli commented Oct 8, 2018

Thanks

@mnapoli mnapoli merged commit 66ecb4f into PHP-DI:master Oct 8, 2018
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.

None yet

2 participants