Skip to content

Make sure $stack is null or Stack. Never boolean. #164

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 2 commits into from
May 11, 2017
Merged

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented May 11, 2017

Q A
Bug fix? yes
New feature? no
BC breaks? yes, but they are not released yet
Deprecations? no
Related tickets fixes issues from scrutinizer
Documentation
License MIT

This is just a minor change in the return value of getCurrentStack

@Nyholm Nyholm added this to the Version 1.5.0 milestone May 11, 2017
@fbourigault
Copy link
Contributor

Since #133 is really fixed, maybe we could go back to code there was before #134?

@Nyholm
Copy link
Member Author

Nyholm commented May 11, 2017

Are we sure we do always have a stack? Can we remove all these checks if $stack === null?

@fbourigault
Copy link
Contributor

Now, the only case I see to not having the stack is a user which use by himself the ProfilePlugin decorator without the StackPlugin.

@@ -58,7 +58,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
{
$profile = new Profile($this->pluginName, $this->formatter->formatRequest($request));

if ($stack = $this->collector->getCurrentStack()) {
if (null !== $stack = $this->collector->getCurrentStack()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this line will be easier to read if the assignation is moved out of the condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are correct, It is me that really like this syntax

@Nyholm
Copy link
Member Author

Nyholm commented May 11, 2017

Thank you for the review.

@Nyholm Nyholm merged commit b059ce0 into master May 11, 2017
@Nyholm Nyholm deleted the Nyholm-patch-32 branch May 11, 2017 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants