Skip to content

Compliance with commonly used phpmd rules #3854

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 1 commit into from
Aug 5, 2016

Conversation

jhoff
Copy link

@jhoff jhoff commented Aug 3, 2016

This is a totally extraneous PR that just fixes a few things that we commonly see with our usage of Laravel and phpmd.

Php Mess Detector (phpmd) takes a given PHP source code base and looks for several potential problems within that source. Including possible bugs, suboptimal code, overcomplicated expressions, unused parameters, methods, properties, etc.

This PR fixes a few minor things that phpmd complains about with every new project we make. Specifically this replaces variable names that are too short ($e) and removes an extraneous else statement.

@morloderex
Copy link

morloderex commented Aug 3, 2016

You should really instruct phpmd to allow use $e instead of this pr.

👍 for the else statement tho :)

@jhoff
Copy link
Author

jhoff commented Aug 3, 2016

This is the only file in the app folder that uses a short variable name. Personally, I feel like $exception is better as it's more descriptive, but I guess thats a decision for the approver. I'm happy to pull those out and just leave the else fix.

@slashequip
Copy link

I believe @taylorotwell wanted to leave that if/else in place as he preferred the indentation, showing a clearer path through that method. It was quashed in a previous PR, IIRC.

@GrahamCampbell
Copy link
Member

It's generally accepted and preferred to use $e as an exception. It's one of those special cases where a short variable name is already very clear.

@bbashy
Copy link
Contributor

bbashy commented Aug 3, 2016

Have to modify that file every time :P

@taylorotwell taylorotwell merged commit de80aad into laravel:develop Aug 5, 2016
@GrahamCampbell
Copy link
Member

phpmd needs fixing then

@bbashy
Copy link
Contributor

bbashy commented Aug 5, 2016

Thanks for the merge. Be good for some option to ignore $e when used for exceptions within phpmd, didn't see one myself. There's one for ignoring e on short variables but could be in the code anywhere as that.

scrubmx added a commit to scrubmx/lumen that referenced this pull request Feb 9, 2018
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.

6 participants