Page MenuHomePhabricator

phpcs should enforce spacing in function signature
Closed, ResolvedPublic

Description

During code review we discovered a linting inconsistency
https://gerrit.wikimedia.org/r/#/c/319067/7/tests/phpunit/MobileFormatterTest.php,unified

private function makeSectionHeading( $heading, $innerHtml, $sectionNumber=1 ) {

VS

private function makeSectionHeading( $heading, $innerHtml, $sectionNumber = 1 ) {

We should enforce and standardise on one of these styles

Event Timeline

It is possible by adding to rules.xml following rule:

<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
        <properties>
                <property name="equalsSpacing" value="1" />
                <property name="requiredSpacesAfterOpen" value="1"/>
                <property name="requiredSpacesBeforeClose" value="1" />
        </properties>
</rule>

phpcs output after enabling Squiz.Functions.FunctionDeclarationArgumentSpacing can be found here: https://phabricator.wikimedia.org/P4433

Change 333831 had a related patch set uploaded (by Niedzielski):
Hygiene: add phpcs rule for function declaration equals spacing

https://gerrit.wikimedia.org/r/333831

Change 333831 merged by jenkins-bot:
Hygiene: add phpcs rule for function declaration equals spacing

https://gerrit.wikimedia.org/r/333831