Skip to content

Commit be27879

Browse files
committed
Merge branch 'master' into report-memory-improvements
Conflicts: CodeSniffer.php
2 parents 38b1e3b + bf5993d commit be27879

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

CodeSniffer/File.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,12 +2848,21 @@ public function findExtendedClassName($stackPtr)
28482848
return false;
28492849
}
28502850

2851-
$stringIndex = $this->findNext(T_STRING, $extendsIndex, $classCloserIndex);
2852-
if (false === $stringIndex) {
2851+
$find = array(
2852+
T_NS_SEPARATOR,
2853+
T_STRING,
2854+
T_WHITESPACE,
2855+
);
2856+
2857+
$end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
2858+
$name = $this->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
2859+
$name = trim($name);
2860+
2861+
if ($name === '') {
28532862
return false;
28542863
}
28552864

2856-
return $this->_tokens[$stringIndex]['content'];
2865+
return $name;
28572866

28582867
}//end findExtendedClassName()
28592868

CodeSniffer/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
126126
switch ($tokens[$tokenBefore]['code']) {
127127
case T_VARIABLE:
128128
case T_CLOSE_PARENTHESIS:
129+
case T_LNUMBER:
129130
// In these cases T_BITWISE_AND represents
130131
// the bitwise and operator.
131132
continue;

CodeSniffer/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ myclass::myfunc($myvar);
1717

1818
while(testfunc($var1, &$var2, $var3, &$var4) === false) {
1919
}
20+
21+
sprintf("0%o", 0777 & $p);
2022
?>

CodeSniffer/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ class MyClass
2828
}
2929

3030
}
31-
?>
31+
32+
class MyClass extends \MyNamespace\SomeClass
33+
{
34+
function __construct() {
35+
something::MyNamespace();
36+
}
37+
38+
}
39+
?>

CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
216216

217217
// Check that the lines before and after this comment are blank.
218218
$contentBefore = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
219-
if (isset($tokens[$contentBefore]['scope_closer']) === true) {
219+
if (isset($tokens[$contentBefore]['scope_closer']) === true
220+
&& $tokens[$contentBefore]['scope_opener'] === $contentBefore
221+
) {
220222
if (($tokens[$stackPtr]['line'] - $tokens[$contentBefore]['line']) !== 1) {
221223
$error = 'Empty line not required before block comment';
222224
$phpcsFile->addError($error, $stackPtr, 'HasEmptyLineBefore');

package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
5858
-- This allows you to create wrapper scripts for PHPCS more easily
5959
- PSR2 MethodDeclarationSniff no longer generates a notice for methods named "_"
6060
-- Thanks to Bart S for the patch
61+
- Squiz BlockCommentSniff no longer reports that a blank line between a scope closer and block comment is invalid
6162
- Generic DuplicateClassNameSniff no longer reports an invalid error if multiple PHP open tags exist in a file
6263
- Generic DuplicateClassNameSniff no longer reports duplicate errors if multiple PHP open tags exist in a file
6364
- Fixed bug #19819 : Freeze with syntax error in use statement
6465
- Fixed bug #19820 : Wrong message level in Generic_Sniffs_CodeAnalysis_EmptyStatementSniff
6566
- Fixed bug #19859 : CodeSniffer::setIgnorePatterns API changed
67+
- Fixed bug #19871 : findExtendedClassName doesn't return FQCN on namespaced classes
68+
- Fixed bug #19879 : bitwise and operator interpreted as reference by value
6669
</notes>
6770
<contents>
6871
<dir name="/">

0 commit comments

Comments
 (0)