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

PSR12 and Object Calisthenics #1161

Merged

Conversation

viniciuseneas
Copy link
Contributor

PSR12 - Blank lines may be added to improve readability and to indicate related blocks of code
Object Calisthenics - Don’t use “Else” keyword

empty - Determines whether the variable is empty or null.

PSR12 - Blank lines may be added to improve readability and to indicate related blocks of code
Object Calisthenics - Don’t use “Else” keyword

empty - Determines whether the variable is empty or null.
@codecov
Copy link

codecov bot commented Oct 18, 2019

Codecov Report

Merging #1161 into master will not change coverage.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1161   +/-   ##
=========================================
  Coverage     46.06%   46.06%           
  Complexity     9968     9968           
=========================================
  Files           505      505           
  Lines         24475    24475           
=========================================
  Hits          11274    11274           
  Misses        13201    13201
Impacted Files Coverage Δ Complexity Δ
classes/phing/listener/DefaultLogger.php 34.61% <80%> (ø) 36 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e43139e...52c6575. Read the comment docs.

Copy link
Member

@kenguest kenguest left a comment

Choose a reason for hiding this comment

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

There is a difference between strict type comparison using === and calling the empty() function - using empty() is more "forgiving" and would equate $error being an empty string. and other such equivalent values to null.

Given that the BuildEvent exception property is going to be either null or an exception, there is no need for using empty(), and the extra function call makes means the code is less efficient.

For that reason, would you revert those portions of your changes, please?

Great job otherwise :-)

Revert empty function for strict type comparison
@viniciuseneas
Copy link
Contributor Author

Ok, I understand your point. The comparison is more performative.

classes/phing/listener/DefaultLogger.php Outdated Show resolved Hide resolved
classes/phing/listener/DefaultLogger.php Outdated Show resolved Hide resolved
@siad007 siad007 added this to the 3.0.0-alpha4 milestone Oct 18, 2019
siad007 added a commit that referenced this pull request Oct 19, 2019
@siad007 siad007 added cleanup code cleanup core and removed needs tests labels Oct 19, 2019
siad007 added a commit that referenced this pull request Oct 19, 2019
@siad007 siad007 merged commit b88e5a5 into phingofficial:master Oct 19, 2019
@siad007
Copy link
Member

siad007 commented Oct 19, 2019

@viniciuseneas thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup code cleanup core
Development

Successfully merging this pull request may close these issues.

None yet

3 participants