Page MenuHomePhabricator

phpcs should enforce spacing in function signature
Closed, ResolvedPublic


During code review we discovered a linting inconsistency,unified

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


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

We should enforce and standardise on one of these styles

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 3 2016, 10:45 AM
pmiazga added a subscriber: pmiazga.EditedNov 14 2016, 7:09 PM

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

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

phpcs output after enabling Squiz.Functions.FunctionDeclarationArgumentSpacing can be found here:

jhobs triaged this task as Low priority.Nov 15 2016, 6:40 PM

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

Niedzielski added a subscriber: Niedzielski.

I just tried to copy @pmiazga's comment :]

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

yup, I'll check it

Works really nice! @Niedzielski good job !

pmiazga closed this task as Resolved.Jan 26 2017, 1:18 AM