joomla / coding-standards

Joomla Coding Standards Definition
https://developer.joomla.org/coding-standards/basic-guidelines.html
GNU General Public License v2.0
128 stars 129 forks source link

Fix closure indent issue and add tests #218

Closed photodude closed 6 years ago

photodude commented 6 years ago

This adds tests and fixes the closure indent issue in #206

Simple solution to check if the current token has a condition of being inside of a closure or anonymous class.

photodude commented 6 years ago

@mbabker @wilsonge, This now solves the closure issue and works with anonymous classes

wilsonge commented 6 years ago

Nice one!

photodude commented 6 years ago

Thanks, I couldn't have done it if the PHPCS owner hadn't pointed me to the right function to figure out when we were in a closure so we could add more to the indent. I don't want to think about how many hours I spent over the past 20 vacation days to figure this out. I'm just glad it's done and we can move forward with preparing a stable release.

On a side note: PHPCS said they would consider a PR to add this control structure brackets sniff to the General standard since it's a common thing to put brackets on their own line.

wilsonge commented 6 years ago

On a side note: PHPCS said they would consider a PR to add this control structure brackets sniff to the General standard since it's a common thing to put brackets on their own line.

Nice if you're up for that would be really good to not have to maintain it ourselves :P

photodude commented 6 years ago

@wilsonge see https://github.com/squizlabs/PHP_CodeSniffer/pull/1847 for the PR