cvs: pear /PHP_CodeSniffer package.xml /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions FunctionCallSignatureSniff.php
/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions FunctionCallSignatureUnitTest.inc
| From: | Greg Sherwood | Date: | Mon, 15 Jan 2007 22:33:07 +0000 |
| Subject: | cvs: pear /PHP_CodeSniffer package.xml /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions FunctionCallSignatureSniff.php /PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions FunctionCallSignatureUnitTest.inc |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44237@lists.php.net to get a copy of this message | ||
squiz Mon Jan 15 22:33:07 2007 UTC
Modified files:
/pear/PHP_CodeSniffer package.xml
/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions
FunctionCallSignatureSniff.php
/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions
FunctionCallSignatureUnitTest.inc
Log:
Fxed bug 9844 - error was being thrown on object creation even though it is a not a function call.
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/package.xml?r1=1.26&r2=1.27&diff_format=u
Index: pear/PHP_CodeSniffer/package.xml
diff -u pear/PHP_CodeSniffer/package.xml:1.26 pear/PHP_CodeSniffer/package.xml:1.27
--- pear/PHP_CodeSniffer/package.xml:1.26 Fri Jan 12 03:56:00 2007
+++ pear/PHP_CodeSniffer/package.xml Mon Jan 15 22:33:07 2007
@@ -23,8 +23,8 @@
<date>2007-01-12</date>
<time>08:53:28</time>
<version>
- <release>0.3.0</release>
- <api>0.3.0</api>
+ <release>0.3.1</release>
+ <api>0.3.1</api>
</version>
<stability>
<release>beta</release>
@@ -32,26 +32,7 @@
</stability>
<license>BSD License</license>
<notes>
- - Updated package.xml to version 2
- - Specifying coding standard on command line is now optional, even if you have multiple
standards installed
- - PHP_CodeSniffer uses the PEAR coding standard by default if no standard is specified
- - New command line option, --extensions, to specify a comma separated list of file extensions to
check
- - Converted all unit tests to PHPUnit 3 format
- - Added new coding standard, Squiz, that can be used as an alternative to PEAR
- - also contains more examples of sniffs
- - some may be moved into the Generic coding standard if required
- - Added MultipleStatementAlignmentSniff to Generic standard
- - Added ScopeIndentSniff to Generic standard
- - Added ForbiddenFunctionsSniff to Generic standard
- - Added FileCommentSniff to PEAR standard
- - Added ClassCommentSniff to PEAR standard
- - Added FunctionCommentSniff to PEAR standard
- - Change MultipleStatementSniff to MultipleStatementAlignmentSniff in PEAR standard
- - Replaced Methods directory with Functions directory in Generic and PEAR standards
- - also renamed some of the sniffs in those directories
- - Updated file, class and method comments for all files
- - Fixed bug #9274 : nested_parenthesis element not set for open and close parenthesis tokens
- - Fixed bug #9411 : too few pattern characters cause incorrect error report
+ - Fixed bug #9844 : throw new Exception(\n accidently reported as error but it ain't
</notes>
<contents>
<dir name="/">
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php?r1=1.2&r2=1.3&diff_format=u
Index:
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
diff -u
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php:1.2
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php:1.3
---
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php:1.2 Wed
Jan 10 03:14:43 2007
+++
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php Mon
Jan 15 22:33:07 2007
@@ -10,7 +10,7 @@
* @author Marc McIntyre <mmcintyre@squiz.net>
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence
BSD Licence
- * @version CVS: $Id: FunctionCallSignatureSniff.php,v 1.2 2007/01/10 03:14:43 squiz Exp $
+ * @version CVS: $Id: FunctionCallSignatureSniff.php,v 1.3 2007/01/15 22:33:07 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -76,6 +76,11 @@
// It's a function definition, not a function call.
return;
}
+
+ if ($tokens[$previous]['code'] === T_NEW) {
+ // We are creating an object, not calling a function.
+ return;
+ }
if (($stackPtr + 1) !== $next) {
// Checking this: $value = my_function[*](...).
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc?r1=1.2&r2=1.3&diff_format=u
Index:
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
diff -u
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc:1.2
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc:1.3
---
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc:1.2 Fri
Dec 29 05:47:42 2006
+++
pear/PHP_CodeSniffer/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc Mon
Jan 15 22:33:07 2007
@@ -32,4 +32,13 @@
make_foo($string /*the string*/, true /*test*/);
make_foo(/*the string*/$string, /*test*/true);
make_foo( /*the string*/$string, /*test*/true);
+
+// No errors should be throw here because
+// this is not a function call per se.
+throw new Exception(
+ 'Exception text'
+);
+
+// Or here.
+$obj = new TestClass( );
?>