Skip to content

Commit ed7a4bf

Browse files
committed
Merge branch 'master' into report-memory-improvements
2 parents 73dcaac + b2805c3 commit ed7a4bf

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,40 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
107107
}
108108

109109
// Check if this is a single line or multi-line function call.
110-
if ($tokens[$openBracket]['line'] === $tokens[$closeBracket]['line']) {
111-
$this->processSingleLineCall($phpcsFile, $stackPtr, $openBracket, $tokens);
112-
} else {
110+
if ($this->isMultiLineCall($phpcsFile, $stackPtr, $openBracket, $tokens) === true) {
113111
$this->processMultiLineCall($phpcsFile, $stackPtr, $openBracket, $tokens);
112+
} else {
113+
$this->processSingleLineCall($phpcsFile, $stackPtr, $openBracket, $tokens);
114114
}
115115

116116
}//end process()
117117

118118

119+
/**
120+
* Processes single-line calls.
121+
*
122+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
123+
* @param int $stackPtr The position of the current token
124+
* in the stack passed in $tokens.
125+
* @param int $openBracket The position of the opening bracket
126+
* in the stack passed in $tokens.
127+
* @param array $tokens The stack of tokens that make up
128+
* the file.
129+
*
130+
* @return void
131+
*/
132+
public function isMultiLineCall(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $openBracket, $tokens)
133+
{
134+
$closeBracket = $tokens[$openBracket]['parenthesis_closer'];
135+
if ($tokens[$openBracket]['line'] !== $tokens[$closeBracket]['line']) {
136+
return true;
137+
}
138+
139+
return false;
140+
141+
}//end isMultiLineCall();
142+
143+
119144
/**
120145
* Processes single-line calls.
121146
*

CodeSniffer/Standards/PSR2/ruleset.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
<property name="equalsSpacing" value="1"/>
116116
</properties>
117117
</rule>
118+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
119+
<severity>0</severity>
120+
</rule>
118121

119122
<!-- Method arguments with default values MUST go at the end of the argument list. -->
120123
<rule ref="PEAR.Functions.ValidDefaultValue"/>

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ You can also download the PHP\_CodeSniffer source and run the `phpcs` command di
4040
Documentation
4141
-------------
4242

43-
The documentation for PHP\_CodeSniffer is available in the [PEAR manual](http://pear.php.net/manual/en/package.php.php-codesniffer.php).
43+
The documentation for PHP\_CodeSniffer is available on the [Github wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki).
4444

4545
Information about upcoming features and releases is available on the [Squiz Labs blog](http://www.squizlabs.com/php-codesniffer).
4646

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
6060
- Squiz ClassFileNameSniff no longer throws errors when checking STDIN
6161
- Squiz CSS sniffs no longer generate errors for IE filters
6262
- Squiz LogicalOperatorSpacingSniff now ignores whitespace at the end of a line
63+
- The PSR2 standard no longer throws errors for additional spacing after a type hint
6364
- Fixed bug #20026 : Check for multi-line arrays that should be single-line is slightly wrong
6465
-- Adds new error message for single-line arrays that end with a comma
6566
- Fixed bug #20029 : ForbiddenFunction sniff incorrectly recognizes methods in USE clauses

0 commit comments

Comments
 (0)