parent
54d890d26c
commit
e6db5d896c
@ -1,8 +0,0 @@ |
||||
<?php |
||||
class MyClass {} |
||||
class YourClass {} |
||||
interface MyInterface {} |
||||
interface YourInterface {} |
||||
class MyClass {} |
||||
interface MyInterface {} |
||||
?> |
||||
@ -1,4 +0,0 @@ |
||||
<?php |
||||
class MyClass {} |
||||
interface MyInterface {} |
||||
?> |
||||
@ -1,82 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DuplicateClassName multi-file sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: DuplicateClassNameUnitTest.php 263478 2008-07-25 04:24:11Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DuplicateClassName multi-file sniff. |
||||
* |
||||
* A multi-file sniff unit test checks a .1.inc and a .2.inc file for expected violations |
||||
* of a single coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Classes_DuplicateClassNameUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList($testFile='') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'DuplicateClassNameUnitTest.1.inc': |
||||
return array( |
||||
6 => 1, |
||||
7 => 1, |
||||
); |
||||
break; |
||||
case 'DuplicateClassNameUnitTest.2.inc': |
||||
return array( |
||||
2 => 1, |
||||
3 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
}//end switch |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
|
||||
switch ($foo) { |
||||
// Empty switch statement body |
||||
} |
||||
|
||||
switch ($foo) { |
||||
case 'bar': |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
|
||||
if ($foo) { |
||||
// Just a comment |
||||
} elseif ($bar) { |
||||
// Yet another comment |
||||
} else { |
||||
|
||||
} |
||||
|
||||
if ($foo) { |
||||
$foo = 'bar'; |
||||
} else if ($bar) { |
||||
$bar = 'foo'; |
||||
} |
||||
|
||||
for ($i = 0; $i < 10; $i++) { |
||||
for ($j = 0; $j < 10; $j++) { |
||||
// Just a comment |
||||
} |
||||
} |
||||
|
||||
foreach ($foo as $bar) {} |
||||
|
||||
foreach ($foo as $bar) { |
||||
$bar *= 2; |
||||
} |
||||
|
||||
do { |
||||
// Just a comment |
||||
// Just another comment |
||||
} while ($foo); |
||||
|
||||
do { |
||||
while ($bar) { |
||||
|
||||
} |
||||
} while (true); |
||||
|
||||
while ($foo) { /* Comment in the same line */ } |
||||
|
||||
while ($foo) { |
||||
try { |
||||
|
||||
} catch (Exception $e) { |
||||
echo $e->getTraceAsString(); |
||||
} |
||||
} |
||||
|
||||
try { |
||||
throw Exception('Error...'); |
||||
} catch (Exception $e) {} |
||||
|
||||
try { |
||||
throw Exception('Error...'); |
||||
} catch (Exception $e) { |
||||
// TODO: Handle this exception later :-) |
||||
} |
||||
@ -1,81 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the EmptyStatement sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: EmptyStatementUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the EmptyStatement sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_EmptyStatementUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
64 => 1, |
||||
68 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
3 => 1, |
||||
15 => 1, |
||||
17 => 1, |
||||
19 => 1, |
||||
30 => 1, |
||||
35 => 1, |
||||
41 => 1, |
||||
47 => 1, |
||||
52 => 1, |
||||
55 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,13 +0,0 @@ |
||||
<?php |
||||
for ($i = 0; $i < 10; $i++) { |
||||
// Everything is fine |
||||
} |
||||
|
||||
for (; $it->valid();) { |
||||
$it->next(); |
||||
} |
||||
|
||||
for (;(($it1->valid() && $foo) || (!$it2->value && ($bar || false)));/*Could be ingored*/) { |
||||
$it1->next(); |
||||
$it2->next(); |
||||
} |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ForLoopShouldBeWhileLoop sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: ForLoopShouldBeWhileLoopUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ForLoopShouldBeWhileLoop sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_ForLoopShouldBeWhileLoopUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
6 => 1, |
||||
10 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,15 +0,0 @@ |
||||
<?php |
||||
|
||||
$a = array(1, 2, 3, 4); |
||||
for ($i = 0; $i < count($a); $i++) { |
||||
$a[$i] *= $i; |
||||
} |
||||
|
||||
for ($i = 0, $c = sizeof($a); $i < $c; ++$i) { |
||||
$a[$i] *= $i; |
||||
} |
||||
|
||||
$it = new ArrayIterator($a); |
||||
for ($it->rewind(); $it->valid(); $it->next()) { |
||||
echo $it->current(); |
||||
} |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ForLoopWithTestFunctionCall sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: ForLoopWithTestFunctionCallUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ForLoopWithTestFunctionCall sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_ForLoopWithTestFunctionCallUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
13 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,25 +0,0 @@ |
||||
<?php |
||||
|
||||
for ($i = 0; $i < 20; $i++) { |
||||
for ($j = 0; $j < 5; $i += 2) { |
||||
for ($k = 0; $k > 3; $i++) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
for ($i = 0; $i < 20; $i++) { |
||||
for ($j = 0; $j < 5; $j += 2) { |
||||
for ($k = 0; $k > 3; $k++) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
for ($i = 0; $i < 20; $i++) { |
||||
for ($j = 0; $j < 5; $j += 2) { |
||||
for ($k = 0; $k > 3; $j++) { |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -1,71 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the JumbledIncrementer sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: JumbledIncrementerUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the JumbledIncrementer sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_JumbledIncrementerUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
3 => 2, |
||||
4 => 1, |
||||
20 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,13 +0,0 @@ |
||||
<?php |
||||
|
||||
if (true) { |
||||
|
||||
} else if (false) { |
||||
|
||||
} elseif (true) { |
||||
|
||||
} |
||||
|
||||
if (file_exists(__FILE__) === true) { |
||||
|
||||
} |
||||
@ -1,71 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UnconditionalIfStatement sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: UnconditionalIfStatementUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UnconditionalIfStatement sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_UnconditionalIfStatementUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
3 => 1, |
||||
5 => 1, |
||||
7 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,24 +0,0 @@ |
||||
<?php |
||||
|
||||
class Foo { |
||||
public final $FOOBAR = 23; |
||||
protected final $FOO = 42; |
||||
private final $BAR = 17; |
||||
} |
||||
|
||||
final class Foo_Bar { |
||||
public $foobar; |
||||
public final $FOOBAR = 23; |
||||
|
||||
protected $foo; |
||||
protected final $FOO = 42; |
||||
|
||||
private $bar; |
||||
private final $BAR = 17; |
||||
} |
||||
|
||||
final class Bar_Foo { |
||||
public $foobar; |
||||
protected $foo; |
||||
private $bar; |
||||
} |
||||
@ -1,71 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UnnecessaryFinalModifier sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: UnnecessaryFinalModifierUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UnnecessaryFinalModifier sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_UnnecessaryFinalModifierUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
11 => 1, |
||||
14 => 1, |
||||
17 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,34 +0,0 @@ |
||||
<?php |
||||
|
||||
function foo($a, $b) { |
||||
return $a * 2; |
||||
} |
||||
|
||||
function baz($a, $b) { |
||||
echo "baz({$a});"; |
||||
} |
||||
|
||||
function bar($a, $b) { |
||||
$x = $b; |
||||
for ($i = 0; $i <$a; $i++) { |
||||
$x += $a * $i; |
||||
} |
||||
return $x; |
||||
} |
||||
|
||||
function foobar($a, &$b) { |
||||
return (preg_match('/foo/', $a, $b) !== 0); |
||||
} |
||||
|
||||
class Foo { |
||||
function barfoo($a, $b) { |
||||
// Empty body means interface method in many cases. |
||||
} |
||||
} |
||||
|
||||
function foo($bar) |
||||
{ |
||||
print <<<BAZ |
||||
$bar |
||||
BAZ |
||||
} |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UnusedFunctionParameter sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: UnusedFunctionParameterUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UnusedFunctionParameter sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_UnusedFunctionParameterUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
3 => 1, |
||||
7 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,25 +0,0 @@ |
||||
<?php |
||||
|
||||
class FooBar { |
||||
public function __construct($a, $b) { |
||||
parent::__construct($a, $b); |
||||
} |
||||
} |
||||
|
||||
class BarFoo { |
||||
public function __construct($a, $b) { |
||||
parent::__construct($a, 'XML', $b); |
||||
} |
||||
} |
||||
|
||||
class Foo { |
||||
public function export($a, $b = null) { |
||||
return parent::export($a, $b); |
||||
} |
||||
} |
||||
|
||||
class Bar { |
||||
public function export($a, $b = null) { |
||||
return parent::export($a); |
||||
} |
||||
} |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UselessOverridingMethod sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version CVS: $Id: UselessOverridingMethodUnitTest.php 252356 2008-02-06 02:38:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UselessOverridingMethod sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Manuel Pichler <mapi@manuel-pichler.de> |
||||
* @copyright 2007-2008 Manuel Pichler. All rights reserved. |
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||||
* @version Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_CodeAnalysis_UselessOverridingMethodUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
16 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,22 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* TODO: Write this comment |
||||
* |
||||
*/ |
||||
|
||||
// TODO: remove this. |
||||
error_log('test'); |
||||
|
||||
// TODO remove this. |
||||
Debug::bam('test'); |
||||
|
||||
// todo - remove this. |
||||
|
||||
// Extract info from the array. |
||||
// TODO: can this be done faster? |
||||
|
||||
// Extract info from the array (todo: make it faster) |
||||
// To do this, use a function! |
||||
// notodo! NOTODO! NOtodo! |
||||
//TODO. |
||||
?> |
||||
@ -1,22 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* TODO: Write this comment |
||||
* |
||||
*/ |
||||
|
||||
// TODO: remove this.
|
||||
alert('test'); |
||||
|
||||
// TODO remove this.
|
||||
alert('test'); |
||||
|
||||
// todo - remove this.
|
||||
|
||||
// Extract info from the array.
|
||||
// TODO: can this be done faster?
|
||||
|
||||
// Extract info from the array (todo: make it faster)
|
||||
// To do this, use a function!
|
||||
// notodo! NOTODO! NOtodo!
|
||||
//TODO.
|
||||
?> |
||||
@ -1,98 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the Todo sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: TodoUnitTest.php 265108 2008-08-19 05:26:35Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the Todo sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Commenting_TodoUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='TodoUnitTest.inc') |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList($testFile='TodoUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'TodoUnitTest.inc': |
||||
return array( |
||||
3 => 1, |
||||
7 => 1, |
||||
10 => 1, |
||||
13 => 1, |
||||
16 => 1, |
||||
18 => 1, |
||||
21 => 1, |
||||
); |
||||
break; |
||||
case 'TodoUnitTest.js': |
||||
return array( |
||||
3 => 1, |
||||
7 => 1, |
||||
10 => 1, |
||||
13 => 1, |
||||
16 => 1, |
||||
18 => 1, |
||||
21 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
}//end switch |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,26 +0,0 @@ |
||||
<?php |
||||
|
||||
if ($something) echo 'hello'; |
||||
|
||||
if ($something) { |
||||
echo 'hello'; |
||||
} else echo 'hi'; |
||||
|
||||
if ($something) { |
||||
echo 'hello'; |
||||
} else if ($else) echo 'hi'; |
||||
|
||||
foreach ($something as $thing) echo 'hello'; |
||||
|
||||
for ($i; $i > 0; $i--) echo 'hello'; |
||||
|
||||
while ($something) echo 'hello'; |
||||
|
||||
do { |
||||
$i--; |
||||
} while ($something); |
||||
|
||||
if(true) |
||||
$someObject->{$name}; |
||||
|
||||
?> |
||||
@ -1,21 +0,0 @@ |
||||
<?php |
||||
|
||||
if ($something) echo 'hello'; |
||||
|
||||
if ($something) { |
||||
echo 'hello'; |
||||
} else echo 'hi'; |
||||
|
||||
if ($something) { |
||||
echo 'hello'; |
||||
} else if ($else) echo 'hi'; |
||||
|
||||
for ($i; $i > 0; $i--) echo 'hello'; |
||||
|
||||
while ($something) echo 'hello'; |
||||
|
||||
do { |
||||
$i--; |
||||
} while ($something); |
||||
|
||||
?> |
||||
@ -1,94 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the InlineControlStructure sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: InlineControlStructureUnitTest.php 261815 2008-07-01 01:25:08Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the InlineControlStructure sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_ControlStructures_InlineControlStructureUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='InlineControlStructureUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'InlineControlStructureUnitTest.inc': |
||||
return array( |
||||
3 => 1, |
||||
7 => 1, |
||||
11 => 1, |
||||
13 => 1, |
||||
15 => 1, |
||||
17 => 1, |
||||
23 => 1, |
||||
); |
||||
break; |
||||
case 'InlineControlStructureUnitTest.js': |
||||
return array( |
||||
3 => 1, |
||||
7 => 1, |
||||
11 => 1, |
||||
13 => 1, |
||||
15 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
}//end switch |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,3 +0,0 @@ |
||||
#login-container { |
||||
margin-left: -225px; |
||||
} |
||||
@ -1,7 +0,0 @@ |
||||
<?php |
||||
echo 'hi'; |
||||
?> |
||||
|
||||
<?php |
||||
echo 'hi'; |
||||
?> |
||||
@ -1,2 +0,0 @@ |
||||
alert('hi'); |
||||
alert('hi'); |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the LineEndings sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: LineEndingsUnitTest.php 237136 2007-06-06 23:31:35Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the LineEndings sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Files_LineEndingsUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
1 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,55 +0,0 @@ |
||||
<?php |
||||
|
||||
// This line is okay... just! |
||||
if (($reallyLongVarName === true) || (is_array($anotherLongVarName) == false)) { |
||||
// Do something. |
||||
} |
||||
|
||||
// This line is not okay... just! |
||||
if (($reallyLongVarName === true) || (is_array($anotherLongVarName) === false)) { |
||||
// Do something. |
||||
} |
||||
|
||||
|
||||
// This line is is too long. |
||||
if (($anotherReallyLongVarName === true) || (is_array($anotherReallyLongVarName) === false)) { |
||||
// Do something. |
||||
} |
||||
|
||||
// This is a really really long comment that is going to go to exactly 80 chars. |
||||
|
||||
// This is another really really long comment that is going to go well over 80 characters. |
||||
|
||||
// And here is just a bunch of spaces that exceeds the line length. |
||||
|
||||
|
||||
// And here are some spaces exactly 80 chars long. |
||||
|
||||
|
||||
// This is a really really really really long long comment that is going to go to exactly 100 chars. |
||||
|
||||
// This is another really really really really really long comment that is going to go well over 100 characters. |
||||
|
||||
// And here is just a bunch of spaces that exceeds the max line length. |
||||
|
||||
|
||||
// And here are some spaces exactly 100 chars long. |
||||
|
||||
?> |
||||
<b>Hello</b>b> |
||||
<?php |
||||
echo 'hi'; |
||||
?> |
||||
|
||||
<?php |
||||
/** |
||||
* Comments contining CVS IDs can be long, but should be ignored because |
||||
* they cannot be changed by the developer. Same with license URLs. |
||||
* |
||||
* @version CVS: $Id: LineLengthUnitTest.inc 261688 2008-06-27 01:58:38Z squiz $ |
||||
* @license http://www.freebsd.org/copyright/freebsd-license.html BSD License (2 Clause) |
||||
*/ |
||||
?> |
||||
|
||||
<?php |
||||
// This is another really long comment that is going to go well over 100 characters, with no closing php tag after it. |
||||
@ -1,79 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the LineLength sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: LineLengthUnitTest.php 261688 2008-06-27 01:58:38Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the LineLength sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Files_LineLengthUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
31 => 1, |
||||
34 => 1, |
||||
55 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
9 => 1, |
||||
15 => 1, |
||||
21 => 1, |
||||
24 => 1, |
||||
29 => 1, |
||||
37 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,9 +0,0 @@ |
||||
<?php |
||||
$y = 2;; |
||||
echo $y; |
||||
for ($i = 1; $i < $length; $i++) {} |
||||
for (; $i < $length; $i++) {} |
||||
echo 'x'; echo $y; |
||||
$x = 10; echo $y; |
||||
$this->wizardid = 10; $this->paint(); echo 'x'; |
||||
?> |
||||
@ -1,73 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DisallowMultipleStatements sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: DisallowMultipleStatementsUnitTest.php 261566 2008-06-24 06:37:54Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DisallowMultipleStatements sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Formatting_DisallowMultipleStatementsUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
2 => 1, |
||||
6 => 1, |
||||
7 => 1, |
||||
8 => 2, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,203 +0,0 @@ |
||||
<?php |
||||
|
||||
// Valid |
||||
$var1 = 'var1'; |
||||
$var10 = 'var1'; |
||||
$var100 = 'var1'; |
||||
$var1000 = 'var1'; |
||||
|
||||
// Invalid |
||||
$var1 = 'var1'; |
||||
$var10 = 'var1'; |
||||
$var100 = 'var1'; |
||||
$var1000 = 'var1'; |
||||
|
||||
// Valid |
||||
$var1 = 'var1'; |
||||
$var10 = 'var1'; |
||||
|
||||
$var100 = 'var1'; |
||||
$var1000 = 'var1'; |
||||
|
||||
// Invalid |
||||
$var1 = 'var1'; |
||||
$var10 = 'var1'; |
||||
|
||||
$var100 = 'var1'; |
||||
$var1000 = 'var1'; |
||||
|
||||
// Valid |
||||
$var1 .= 'var1'; |
||||
$var10 .= 'var1'; |
||||
$var100 .= 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Invalid |
||||
$var1 .= 'var1'; |
||||
$var10 .= 'var1'; |
||||
$var100 .= 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Valid |
||||
$var1 = 'var1'; |
||||
$var10 .= 'var1'; |
||||
$var100 = 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Invalid |
||||
$var1 = 'var1'; |
||||
$var10 .= 'var1'; |
||||
$var100 = 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Valid |
||||
$var1 .= 'var1'; |
||||
$var10 .= 'var1'; |
||||
|
||||
$var100 .= 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Invalid |
||||
$var1 .= 'var1'; |
||||
$var10 .= 'var1'; |
||||
|
||||
$var100 .= 'var1'; |
||||
$var1000 .= 'var1'; |
||||
|
||||
// Valid |
||||
$var = 100; |
||||
|
||||
// InValid |
||||
$var = 100; |
||||
|
||||
$commentStart = $phpcsFile->findPrevious(); |
||||
$commentEnd = $this->_phpcsFile; |
||||
$expected .= '...'; |
||||
|
||||
// Invalid |
||||
$this->okButton = new Button(); |
||||
$content = new MyClass(); |
||||
|
||||
|
||||
$GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array(); |
||||
|
||||
class MyClass |
||||
{ |
||||
const MODE_DEBUG = 'debug'; |
||||
const MODE_DEBUG2 = 'debug'; |
||||
|
||||
$array[$test] = 'anything'; |
||||
$var = 'anything'; |
||||
|
||||
const MODE_DEBUG2 = 'debug'; |
||||
$array[$test] = 'anything'; |
||||
$var = 'anything'; |
||||
$array[($test + 1)] = 'anything'; |
||||
$array[($blah + (10 - $test))] = 'anything'; |
||||
} |
||||
|
||||
function myFunction($var=true) |
||||
{ |
||||
if ($strict === true) { |
||||
$length = strlen($string); |
||||
$lastCharWasCaps = ($classFormat === false) ? false : true; |
||||
|
||||
for ($i = 1; $i < $length; $i++) { |
||||
$isCaps = (strtoupper($string{$i}) === $string{$i}) ? true : false; |
||||
if ($isCaps === true && $lastCharWasCaps === true) { |
||||
return false; |
||||
} |
||||
|
||||
$lastCharWasCaps = $isCaps; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Valid |
||||
for ($i = 0; $i < 10; $i += 2) { |
||||
$i = ($i - 1); |
||||
} |
||||
|
||||
// Invalid |
||||
foreach ($files as $file) { |
||||
$saves[$file] = array(); |
||||
$contents = stripslashes(file_get_contents($file)); |
||||
list($assetid, $time, $content) = explode("\n", $contents); |
||||
$saves[$file]['assetid'] = $assetid; |
||||
} |
||||
|
||||
$i = ($i - 10); |
||||
$ip = ($i - 10); |
||||
for ($i = 0; $i < 10; $i += 2) { |
||||
$i = ($i - 10); |
||||
} |
||||
|
||||
// Valid |
||||
$variable = 12; |
||||
$var = a_very(long_line('that', 'contains'), |
||||
a_bunch('of long', 'parameters'), |
||||
'that_need to be aligned with the equal sign'); |
||||
$var2 = 12; |
||||
|
||||
// Valid |
||||
$variable = 12; |
||||
$var = 'a very long line of text that contains ' |
||||
.$someVar |
||||
.' and some other stuff that is too long to fit on one line'; |
||||
$var2 = 12; |
||||
|
||||
// Invalid |
||||
$variable = 12; |
||||
$var = a_very(long_line('that', 'contains'), |
||||
a_bunch('of long', 'parameters'), |
||||
'that_need to be aligned with the equal sign'); |
||||
$var2 = 12; |
||||
|
||||
// Invalid |
||||
$variable = 12; |
||||
$var = 'a very long line of text that contains ' |
||||
.$someVar |
||||
.' and some other stuff that is too long to fit on one line'; |
||||
$var2 = 12; |
||||
|
||||
// Valid |
||||
$variable = 12; |
||||
$var .= 'a very long line of text that contains ' |
||||
.$someVar |
||||
.' and some other stuff that is too long to fit on one line'; |
||||
$var2 = 12; |
||||
|
||||
// Valid |
||||
$variable += 12; |
||||
$var .= 'a very long line of text that contains ' |
||||
.$someVar |
||||
.' and some other stuff that is too long to fit on one line'; |
||||
$var2 = 12; |
||||
|
||||
// Invalid |
||||
$variable = 12; |
||||
$var .= 'a very long line of text that contains ' |
||||
.$someVar |
||||
.' and some other stuff that is too long to fit on one line'; |
||||
$var2 = 12; |
||||
|
||||
// Valid |
||||
$error = false; |
||||
while (list($h, $f) = each($handle)) { |
||||
$error = true; |
||||
} |
||||
|
||||
// Valid |
||||
$value = false; |
||||
function blah ($value = true) { |
||||
$value = false; |
||||
if ($value === true) { |
||||
$value = false; |
||||
} |
||||
} |
||||
|
||||
if (TRUE) { |
||||
$args = array('foo' => 'foo'); |
||||
$res = 'bar'; |
||||
} |
||||
?> |
||||
@ -1,93 +0,0 @@ |
||||
|
||||
|
||||
// Valid
|
||||
var1 = 'var1'; |
||||
var10 = 'var1'; |
||||
var100 = 'var1'; |
||||
var1000 = 'var1'; |
||||
|
||||
// Invalid
|
||||
var1 = 'var1'; |
||||
var10 = 'var1'; |
||||
var100 = 'var1'; |
||||
var1000 = 'var1'; |
||||
|
||||
// Valid
|
||||
var1 = 'var1'; |
||||
var10 = 'var1'; |
||||
|
||||
var100 = 'var1'; |
||||
var1000 = 'var1'; |
||||
|
||||
// Invalid
|
||||
var1 = 'var1'; |
||||
var10 = 'var1'; |
||||
|
||||
var100 = 'var1'; |
||||
var1000 = 'var1'; |
||||
|
||||
// Valid
|
||||
var1 += 'var1'; |
||||
var10 += 'var1'; |
||||
var100 += 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Invalid
|
||||
var1 += 'var1'; |
||||
var10 += 'var1'; |
||||
var100 += 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Valid
|
||||
var1 = 'var1'; |
||||
var10 += 'var1'; |
||||
var100 = 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Invalid
|
||||
var1 = 'var1'; |
||||
var10 += 'var1'; |
||||
var100 = 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Valid
|
||||
var1 += 'var1'; |
||||
var10 += 'var1'; |
||||
|
||||
var100 += 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Invalid
|
||||
var1 += 'var1'; |
||||
var10 += 'var1'; |
||||
|
||||
var100 += 'var1'; |
||||
var1000 += 'var1'; |
||||
|
||||
// Valid
|
||||
var test = 100; |
||||
|
||||
// InValid
|
||||
var test = 100; |
||||
|
||||
commentStart = phpcsFile.findPrevious(); |
||||
commentEnd = this._phpcsFile; |
||||
expected += '...'; |
||||
|
||||
// Invalid
|
||||
this.okButton = {}; |
||||
content = {}; |
||||
|
||||
var buttonid = [this.id, '-positionFormats-add'].join(''); |
||||
var buttonWidget = WidgetStore.get(buttonid); |
||||
var spinButtonid = [this.id, '-positionFormats-spinButton'].join(''); |
||||
var spinButtonWidget = WidgetStore.get(spinButtonid); |
||||
var position = spinButtonWidget.getValue(); |
||||
var posForamatsList = WidgetStore.get([self.id, '-positionFormats-list'].join('')); |
||||
|
||||
dfx.stripTags = function(content, allowedTags) |
||||
{ |
||||
var match; |
||||
var re = 'blah'; |
||||
}; |
||||
|
||||
@ -1,135 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the MultipleStatementAlignment sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: MultipleStatementAlignmentUnitTest.php 253383 2008-02-21 05:21:12Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the MultipleStatementAlignment sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Formatting_MultipleStatementAlignmentUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList($testFile='MultipleStatementAlignmentUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'MultipleStatementAlignmentUnitTest.inc': |
||||
return array( |
||||
11 => 1, |
||||
12 => 1, |
||||
23 => 1, |
||||
24 => 1, |
||||
26 => 1, |
||||
27 => 1, |
||||
37 => 1, |
||||
38 => 1, |
||||
48 => 1, |
||||
50 => 1, |
||||
61 => 1, |
||||
62 => 1, |
||||
64 => 1, |
||||
65 => 1, |
||||
71 => 1, |
||||
78 => 1, |
||||
79 => 1, |
||||
86 => 1, |
||||
92 => 1, |
||||
93 => 1, |
||||
94 => 1, |
||||
95 => 1, |
||||
123 => 1, |
||||
124 => 1, |
||||
126 => 1, |
||||
129 => 1, |
||||
154 => 1, |
||||
161 => 1, |
||||
178 => 1, |
||||
179 => 1, |
||||
182 => 1, |
||||
); |
||||
break; |
||||
case 'MultipleStatementAlignmentUnitTest.js': |
||||
return array( |
||||
11 => 1, |
||||
12 => 1, |
||||
23 => 1, |
||||
24 => 1, |
||||
26 => 1, |
||||
27 => 1, |
||||
37 => 1, |
||||
38 => 1, |
||||
48 => 1, |
||||
50 => 1, |
||||
61 => 1, |
||||
62 => 1, |
||||
64 => 1, |
||||
65 => 1, |
||||
71 => 1, |
||||
78 => 1, |
||||
79 => 1, |
||||
81 => 1, |
||||
82 => 1, |
||||
83 => 1, |
||||
85 => 1, |
||||
86 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
} |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,47 +0,0 @@ |
||||
<?php |
||||
|
||||
$var = (int) $var2; |
||||
$var = (int)$var2; |
||||
$var = (int) $var2; |
||||
|
||||
$var = (integer) $var2; |
||||
$var = (integer)$var2; |
||||
$var = (integer) $var2; |
||||
|
||||
$var = (string) $var2; |
||||
$var = (string)$var2; |
||||
$var = (string) $var2; |
||||
|
||||
$var = (float) $var2; |
||||
$var = (float)$var2; |
||||
$var = (float) $var2; |
||||
|
||||
$var = (double) $var2; |
||||
$var = (double)$var2; |
||||
$var = (double) $var2; |
||||
|
||||
$var = (real) $var2; |
||||
$var = (real)$var2; |
||||
$var = (real) $var2; |
||||
|
||||
$var = (array) $var2; |
||||
$var = (array)$var2; |
||||
$var = (array) $var2; |
||||
|
||||
$var = (bool) $var2; |
||||
$var = (bool)$var2; |
||||
$var = (bool) $var2; |
||||
|
||||
$var = (boolean) $var2; |
||||
$var = (boolean)$var2; |
||||
$var = (boolean) $var2; |
||||
|
||||
$var = (object) $var2; |
||||
$var = (object)$var2; |
||||
$var = (object) $var2; |
||||
|
||||
$var = (unset) $var2; |
||||
$var = (unset)$var2; |
||||
$var = (unset) $var2; |
||||
|
||||
?> |
||||
@ -1,91 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the NoSpaceAfterCast sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: NoSpaceAfterCastUnitTest.php 238831 2007-06-29 00:57:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the NoSpaceAfterCast sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Formatting_NoSpaceAfterCastUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
3 => 1, |
||||
5 => 1, |
||||
7 => 1, |
||||
9 => 1, |
||||
11 => 1, |
||||
13 => 1, |
||||
15 => 1, |
||||
17 => 1, |
||||
19 => 1, |
||||
21 => 1, |
||||
23 => 1, |
||||
25 => 1, |
||||
27 => 1, |
||||
29 => 1, |
||||
31 => 1, |
||||
33 => 1, |
||||
35 => 1, |
||||
37 => 1, |
||||
39 => 1, |
||||
41 => 1, |
||||
43 => 1, |
||||
45 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,47 +0,0 @@ |
||||
<?php |
||||
|
||||
$var = (int) $var2; |
||||
$var = (int)$var2; |
||||
$var = (int) $var2; |
||||
|
||||
$var = (integer) $var2; |
||||
$var = (integer)$var2; |
||||
$var = (integer) $var2; |
||||
|
||||
$var = (string) $var2; |
||||
$var = (string)$var2; |
||||
$var = (string) $var2; |
||||
|
||||
$var = (float) $var2; |
||||
$var = (float)$var2; |
||||
$var = (float) $var2; |
||||
|
||||
$var = (double) $var2; |
||||
$var = (double)$var2; |
||||
$var = (double) $var2; |
||||
|
||||
$var = (real) $var2; |
||||
$var = (real)$var2; |
||||
$var = (real) $var2; |
||||
|
||||
$var = (array) $var2; |
||||
$var = (array)$var2; |
||||
$var = (array) $var2; |
||||
|
||||
$var = (bool) $var2; |
||||
$var = (bool)$var2; |
||||
$var = (bool) $var2; |
||||
|
||||
$var = (boolean) $var2; |
||||
$var = (boolean)$var2; |
||||
$var = (boolean) $var2; |
||||
|
||||
$var = (object) $var2; |
||||
$var = (object)$var2; |
||||
$var = (object) $var2; |
||||
|
||||
$var = (unset) $var2; |
||||
$var = (unset)$var2; |
||||
$var = (unset) $var2; |
||||
|
||||
?> |
||||
@ -1,91 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the SpaceAfterCast sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: SpaceAfterCastUnitTest.php 238831 2007-06-29 00:57:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the SpaceAfterCast sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Formatting_SpaceAfterCastUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
5 => 1, |
||||
8 => 1, |
||||
9 => 1, |
||||
12 => 1, |
||||
13 => 1, |
||||
16 => 1, |
||||
17 => 1, |
||||
20 => 1, |
||||
21 => 1, |
||||
24 => 1, |
||||
25 => 1, |
||||
28 => 1, |
||||
29 => 1, |
||||
32 => 1, |
||||
33 => 1, |
||||
36 => 1, |
||||
37 => 1, |
||||
40 => 1, |
||||
41 => 1, |
||||
44 => 1, |
||||
45 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,20 +0,0 @@ |
||||
<?php |
||||
class myclass extends yourclass implements someint { |
||||
function myfunc($var) { |
||||
echo $var; |
||||
} |
||||
} |
||||
|
||||
$myvar = true; |
||||
myfunc(&$myvar); |
||||
myfunc($myvar); |
||||
|
||||
$this->myfunc(&$myvar); |
||||
$this->myfunc($myvar); |
||||
|
||||
myclass::myfunc(&$myvar); |
||||
myclass::myfunc($myvar); |
||||
|
||||
while(testfunc($var1, &$var2, $var3, &$var4) === false) { |
||||
} |
||||
?> |
||||
@ -1,73 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the CallTimePassByReference sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: OpeningFunctionBraceKernighanRitchieUnitTest.php 247623 2007-12-04 23:24:33Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the CallTimePassByReference sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Functions_CallTimePassByReferenceUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
9 => 1, |
||||
12 => 1, |
||||
15 => 1, |
||||
18 => 2, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,54 +0,0 @@ |
||||
<?php |
||||
|
||||
$result = myFunction(); |
||||
$result = myFunction($arg1, $arg2); |
||||
$result = myFunction($arg1,$arg2); |
||||
$result = myFunction($arg1 , $arg2); |
||||
$result = myFunction($arg1 , $arg2); |
||||
$result = myFunction($arg1, $arg2, $arg3,$arg4, $arg5); |
||||
$result = myFunction($arg1, $arg2, $arg3, $arg4, $arg5); |
||||
$result = myFunction($arg1, $arg2 = array()); |
||||
$result = myFunction($arg1 , $arg2 =array()); |
||||
$result = myFunction($arg1 , $arg2= array()); |
||||
$result = myFunction($arg1 , $arg2=array()); |
||||
|
||||
$result = myFunction($arg1, |
||||
$arg2 = array(), |
||||
$arg3, |
||||
$arg4, |
||||
$arg5); |
||||
|
||||
throw new Exception("This is some massive string for a message", |
||||
$cause); |
||||
|
||||
// Function definitions are ignored |
||||
function myFunction($arg1,$arg2) |
||||
{ |
||||
} |
||||
|
||||
function myFunction ($arg1,$arg2) |
||||
{ |
||||
} |
||||
|
||||
function myFunction($arg1=1,$arg2=2) |
||||
{ |
||||
} |
||||
|
||||
|
||||
function myFunction($arg1 = 1,$arg2 = 2) |
||||
{ |
||||
} |
||||
|
||||
$key = array_search($this->getArray($one, $two,$three),$this->arrayMap); |
||||
$this->error($obj->getCode(),$obj->getMessage(),$obj->getFile(),$obj->getLine()); |
||||
|
||||
make_foo($string /*the string*/ , true /*test*/); |
||||
make_foo($string/*the string*/ , /*test*/ true); |
||||
make_foo($string /*the string*/, /*test*/ true); |
||||
|
||||
class MyClass { |
||||
function myFunction() { |
||||
blah($foo, "{{$config['host']}}", "{$config}", "hi there{}{}{{{}{}{}}"); |
||||
} |
||||
} |
||||
?> |
||||
@ -1,80 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the FunctionCallArgumentSpacing sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: FunctionCallArgumentSpacingUnitTest.php 226877 2007-01-10 03:14:44Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the FunctionCallArgumentSpacing sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Functions_FunctionCallArgumentSpacingUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
5 => 1, |
||||
6 => 1, |
||||
7 => 2, |
||||
8 => 1, |
||||
11 => 2, |
||||
12 => 2, |
||||
13 => 3, |
||||
42 => 3, |
||||
43 => 3, |
||||
45 => 1, |
||||
46 => 2, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,157 +0,0 @@ |
||||
<?php |
||||
|
||||
// Brace should be on new line. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Good. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Too many newlines. |
||||
function myFunction() |
||||
|
||||
{ |
||||
} |
||||
|
||||
// Space before brace. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
class myClass() |
||||
{ |
||||
// Brace should be on new line. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Good. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
// No aligned correctly. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Too many newlines. |
||||
function myFunction() |
||||
|
||||
{ |
||||
} |
||||
|
||||
// Space before brace. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/* Multi-line declarations */ |
||||
|
||||
|
||||
|
||||
// Brace should be on new line. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Good. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Too many newlines. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
|
||||
{ |
||||
} |
||||
|
||||
// Space before brace. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
class myClass() |
||||
{ |
||||
// Brace should be on new line. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Good. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
// No aligned correctly. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Too many newlines. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
|
||||
{ |
||||
} |
||||
|
||||
// Space before brace. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
} |
||||
|
||||
interface MyInterface() |
||||
{ |
||||
function myFunction(); |
||||
} |
||||
|
||||
function myFunction( |
||||
$arg1, |
||||
$arg2, |
||||
$arg3, |
||||
$arg4, |
||||
$arg5, |
||||
$arg6 |
||||
) |
||||
{ |
||||
} |
||||
|
||||
function myFunction( |
||||
$arg1, |
||||
$arg2, |
||||
$arg3, |
||||
$arg4, |
||||
$arg5, |
||||
$arg6 |
||||
) { |
||||
} |
||||
?> |
||||
@ -1,88 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the OpeningFunctionBraceBsdAllman sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: OpeningFunctionBraceBsdAllmanUnitTest.php 247623 2007-12-04 23:24:33Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the OpeningFunctionBraceBsdAllman sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Functions_OpeningFunctionBraceBsdAllmanUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
13 => 1, |
||||
19 => 1, |
||||
24 => 1, |
||||
30 => 1, |
||||
40 => 1, |
||||
44 => 1, |
||||
50 => 1, |
||||
55 => 1, |
||||
67 => 1, |
||||
78 => 1, |
||||
85 => 1, |
||||
91 => 1, |
||||
98 => 1, |
||||
110 => 1, |
||||
115 => 1, |
||||
122 => 1, |
||||
128 => 1, |
||||
155 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,117 +0,0 @@ |
||||
<?php |
||||
|
||||
// Good. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Brace should be on same line. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Uses tab. |
||||
function myFunction() { |
||||
} |
||||
|
||||
|
||||
class myClass() |
||||
{ |
||||
// Good. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Brace should be on same line. |
||||
function myFunction() |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction() { |
||||
} |
||||
|
||||
// Uses tab. |
||||
function myFunction() { |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/* Multi-line declarations */ |
||||
|
||||
// Good. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Brace should be on same line. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Uses tab. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
|
||||
class myClass() |
||||
{ |
||||
// Good. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Brace should be on same line. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) |
||||
{ |
||||
} |
||||
|
||||
// Too many spaces. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
|
||||
// Uses tab. |
||||
function myFunction($variable1, $variable2, |
||||
$variable3, $variable4) { |
||||
} |
||||
} |
||||
|
||||
interface MyInterface() |
||||
{ |
||||
function myFunction(); |
||||
} |
||||
|
||||
function myFunction( |
||||
$arg1, |
||||
$arg2, |
||||
$arg3, |
||||
$arg4, |
||||
$arg5, |
||||
$arg6 |
||||
) |
||||
{ |
||||
} |
||||
|
||||
function myFunction( |
||||
$arg1, |
||||
$arg2, |
||||
$arg3, |
||||
$arg4, |
||||
$arg5, |
||||
$arg6 |
||||
) { |
||||
} |
||||
|
||||
?> |
||||
@ -1,82 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the OpeningFunctionBraceKernighanRitchie sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: OpeningFunctionBraceKernighanRitchieUnitTest.php 247623 2007-12-04 23:24:33Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the OpeningFunctionBraceKernighanRitchie sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Functions_OpeningFunctionBraceKernighanRitchieUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
9 => 1, |
||||
13 => 1, |
||||
17 => 1, |
||||
29 => 1, |
||||
33 => 1, |
||||
37 => 1, |
||||
53 => 1, |
||||
58 => 1, |
||||
63 => 1, |
||||
77 => 1, |
||||
82 => 1, |
||||
87 => 1, |
||||
104 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,160 +0,0 @@ |
||||
<?php |
||||
|
||||
function complexityOne() { } |
||||
|
||||
function comlexityFive() |
||||
{ |
||||
if ($condition) { |
||||
} |
||||
|
||||
switch ($condition) { |
||||
case '1': |
||||
break; |
||||
case '2': |
||||
break; |
||||
case '3': |
||||
break; |
||||
} |
||||
} |
||||
|
||||
function comlexityTen() |
||||
{ |
||||
while ($condition === true) { |
||||
if ($condition) { |
||||
} |
||||
} |
||||
|
||||
switch ($condition) { |
||||
case '1': |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
break; |
||||
case '2': |
||||
while ($cond) { |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
case '3': |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
|
||||
function comlexityEleven() |
||||
{ |
||||
while ($condition === true) { |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
} |
||||
|
||||
switch ($condition) { |
||||
case '1': |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
break; |
||||
case '2': |
||||
while ($cond) { |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
case '3': |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
function comlexityTwenty() |
||||
{ |
||||
while ($condition === true) { |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
} |
||||
|
||||
switch ($condition) { |
||||
case '1': |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
break; |
||||
case '2': |
||||
while ($cond) { |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
case '3': |
||||
switch ($cond) { |
||||
case '1': |
||||
break; |
||||
case '2': |
||||
break; |
||||
} |
||||
break; |
||||
case '4': |
||||
do { |
||||
if ($condition) { |
||||
if ($cond) { |
||||
} else if ($con) { |
||||
} |
||||
} |
||||
} while ($cond); |
||||
break; |
||||
default: |
||||
if ($condition) { |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
function comlexityTwentyOne() |
||||
{ |
||||
while ($condition === true) { |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
} |
||||
|
||||
switch ($condition) { |
||||
case '1': |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
break; |
||||
case '2': |
||||
while ($cond) { |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
case '3': |
||||
switch ($cond) { |
||||
case '1': |
||||
break; |
||||
case '2': |
||||
break; |
||||
} |
||||
break; |
||||
case '4': |
||||
do { |
||||
if ($condition) { |
||||
if ($cond) { |
||||
} else if ($con) { |
||||
} |
||||
} |
||||
} while ($cond); |
||||
break; |
||||
default: |
||||
if ($condition) { |
||||
} else if ($cond) { |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
?> |
||||
@ -1,73 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the CyclomaticComplexity sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: CyclomaticComplexityUnitTest.php 240469 2007-07-30 04:55:35Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the CyclomaticComplexity sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Metrics_CyclomaticComplexityUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
116 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
45 => 1, |
||||
72 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,102 +0,0 @@ |
||||
<?php |
||||
|
||||
function nestingOne() |
||||
{ |
||||
if ($condition) { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
|
||||
function nestingFive() |
||||
{ |
||||
if ($condition) { |
||||
echo 'hi'; |
||||
switch ($condition) |
||||
{ |
||||
case '1': |
||||
if ($condition === '1') { |
||||
if ($cond) { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function nestingSix() |
||||
{ |
||||
if ($condition) { |
||||
echo 'hi'; |
||||
switch ($condition) |
||||
{ |
||||
case '1': |
||||
if ($condition === '1') { |
||||
if ($cond) { |
||||
foreach ($conds as $cond) { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function nestingTen() |
||||
{ |
||||
if ($condition) { |
||||
echo 'hi'; |
||||
switch ($condition) |
||||
{ |
||||
case '1': |
||||
if ($condition === '1') { |
||||
if ($cond) { |
||||
switch ($cond) { |
||||
case '1': |
||||
if ($cond === '1') { |
||||
foreach ($conds as $cond) { |
||||
if ($cond === 'hi') { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function nestingEleven() |
||||
{ |
||||
if ($condition) { |
||||
echo 'hi'; |
||||
switch ($condition) |
||||
{ |
||||
case '1': |
||||
if ($condition === '1') { |
||||
if ($cond) { |
||||
switch ($cond) { |
||||
case '1': |
||||
if ($cond === '1') { |
||||
foreach ($conds as $cond) { |
||||
if ($cond === 'hi') { |
||||
if ($cond !== 'bye') { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
?> |
||||
@ -1,73 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the NestingLevel sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: NestingLevelUnitTest.php 240469 2007-07-30 04:55:35Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the NestingLevel sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Metrics_NestingLevelUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
73 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
27 => 1, |
||||
46 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,31 +0,0 @@ |
||||
<?php |
||||
class TestClass extends MyClass |
||||
{ |
||||
|
||||
function TestClass() { |
||||
parent::MyClass(); |
||||
parent::__construct(); |
||||
} |
||||
|
||||
function __construct() { |
||||
parent::MyClass(); |
||||
parent::__construct(); |
||||
} |
||||
|
||||
} |
||||
|
||||
class MyClass |
||||
{ |
||||
|
||||
function MyClass() { |
||||
parent::YourClass(); |
||||
parent::__construct(); |
||||
} |
||||
|
||||
function __construct() { |
||||
parent::YourClass(); |
||||
parent::__construct(); |
||||
} |
||||
|
||||
} |
||||
?> |
||||
@ -1,71 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ConstructorName sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: ConstructorNameUnitTest.php 276279 2009-02-23 05:16:22Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ConstructorName sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_NamingConventions_ConstructorNameUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
5 => 1, |
||||
6 => 1, |
||||
11 => 1, |
||||
20 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,95 +0,0 @@ |
||||
<?php |
||||
use Exception; |
||||
namespace foo; |
||||
namespace foo\bar; |
||||
namespace bar\foo\baz; |
||||
|
||||
define('VALID_NAME', true); |
||||
define('invalidName', true); |
||||
define("VALID_NAME", true); |
||||
define("invalidName", true); |
||||
|
||||
class TestClass extends MyClass, YourClass |
||||
{ |
||||
|
||||
const const1 = 'hello'; |
||||
const CONST2 = 'hello'; |
||||
|
||||
function test() |
||||
{ |
||||
echo constant('VALID_NAME'); |
||||
echo VALID_NAME; |
||||
print VALID_NAME; |
||||
echo(VALID_NAME); |
||||
print(VALID_NAME); |
||||
echo constant('invalidName'); |
||||
echo invalidName; |
||||
print invalidName; |
||||
echo(invalidName); |
||||
print(invalidName); |
||||
|
||||
echo constant("VALID_NAME"); |
||||
echo constant("invalidName"); |
||||
|
||||
echo 'Hello', VALID_NAME; |
||||
echo 'Hello', invalidName; |
||||
|
||||
// These might look like constants to |
||||
// poorly written code. |
||||
echo 'Hello there'; |
||||
echo "HELLO"; |
||||
echo 'HELLO'; |
||||
print 'Hello there'; |
||||
print "HELLO"; |
||||
print 'HELLO'; |
||||
} |
||||
|
||||
function myFunc(PHP_CodeSniffer &$blah) {} |
||||
function myFunc(PHP_CodeSniffer $blah) {} |
||||
|
||||
} |
||||
|
||||
interface MyInterface |
||||
{ |
||||
} |
||||
|
||||
if (($object instanceof Some_Class) === false) { |
||||
$var = <<<EOF |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
|
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
EOF; |
||||
} |
||||
|
||||
$var = <<<EOF |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
|
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
This is some heredoc text. |
||||
EOF; |
||||
|
||||
throw new InvalidSomethingException; |
||||
|
||||
declare(ticks = 1) { |
||||
foreach ($var as $bit) { |
||||
echo $bit; |
||||
} |
||||
} |
||||
|
||||
$binary = (binary) $string; |
||||
|
||||
$foo->define('bar'); |
||||
$foo->getBar()->define('foo'); |
||||
|
||||
// This is allowed as it is required for PHPUnit. |
||||
if (PHPUnit_MAIN_METHOD == 'PHP_Shell_AllTests::main') { |
||||
PHP_Shell_AllTests::main(); |
||||
} |
||||
?> |
||||
@ -1,79 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ValidConstantName sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: UpperCaseConstantNameUnitTest.php 295617 2010-03-01 03:40:05Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ValidConstantName sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_NamingConventions_UpperCaseConstantNameUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
8 => 1, |
||||
10 => 1, |
||||
15 => 1, |
||||
25 => 1, |
||||
26 => 1, |
||||
27 => 1, |
||||
28 => 1, |
||||
29 => 1, |
||||
32 => 1, |
||||
35 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,6 +0,0 @@ |
||||
<div> |
||||
<?php echo $var; ?> |
||||
Some content here. |
||||
<?= $var; ?> |
||||
<? echo $var; ?> |
||||
</div> |
||||
@ -1,77 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DisallowShortOpenTag sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: DisallowShortOpenTagUnitTest.php 224867 2006-12-12 02:31:20Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DisallowShortOpenTag sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_PHP_DisallowShortOpenTagUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
$option = (boolean) ini_get('short_open_tag'); |
||||
|
||||
if ($option === false) { |
||||
return array(); |
||||
} |
||||
|
||||
return array( |
||||
4 => 1, |
||||
5 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,22 +0,0 @@ |
||||
<?php |
||||
$size = sizeof($array); |
||||
$size = count($array); |
||||
delete($filepath); |
||||
unset($filepath); |
||||
|
||||
// No errors thrown for class methods. |
||||
$size = MyClass::sizeof($array); |
||||
$size = MyClass::count($array); |
||||
MyClass::delete($filepath); |
||||
MyClass::unset($filepath); |
||||
|
||||
$size = $class->sizeof($array); |
||||
$size = $class->count($array); |
||||
$class->delete($filepath); |
||||
$class->unset($filepath); |
||||
|
||||
function delete() {} |
||||
function unset() {} |
||||
function sizeof() {} |
||||
function count() {} |
||||
?> |
||||
@ -1,71 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ForbiddenFunctions sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: ForbiddenFunctionsUnitTest.php 225921 2006-12-28 06:01:17Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ForbiddenFunctions sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_PHP_ForbiddenFunctionsUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
2 => 1, |
||||
4 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,50 +0,0 @@ |
||||
<?php |
||||
|
||||
// True |
||||
function myFunction($arg1, $arg2=true) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=TRUE) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=True) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === true) { } |
||||
if ($variable === TRUE) { } |
||||
if ($variable === True) { } |
||||
|
||||
|
||||
// False |
||||
function myFunction($arg1, $arg2=false) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=FALSE) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=False) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === false) { } |
||||
if ($variable === FALSE) { } |
||||
if ($variable === False) { } |
||||
|
||||
|
||||
// Null |
||||
function myFunction($arg1, $arg2=null) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=NULL) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=Null) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === null) { } |
||||
if ($variable === NULL) { } |
||||
if ($variable === Null) { } |
||||
|
||||
?> |
||||
@ -1,14 +0,0 @@ |
||||
if (variable === true) { } |
||||
if (variable === TRUE) { } |
||||
if (variable === True) { } |
||||
variable = True; |
||||
|
||||
if (variable === false) { } |
||||
if (variable === FALSE) { } |
||||
if (variable === False) { } |
||||
variable = false; |
||||
|
||||
if (variable === null) { } |
||||
if (variable === NULL) { } |
||||
if (variable === Null) { } |
||||
variable = NULL; |
||||
@ -1,102 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the LowerCaseConstant sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: LowerCaseConstantUnitTest.php 253114 2008-02-18 00:01:06Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the LowerCaseConstant sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_PHP_LowerCaseConstantUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='LowerCaseConstantUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'LowerCaseConstantUnitTest.inc': |
||||
return array( |
||||
7 => 1, |
||||
10 => 1, |
||||
15 => 1, |
||||
16 => 1, |
||||
23 => 1, |
||||
26 => 1, |
||||
31 => 1, |
||||
32 => 1, |
||||
39 => 1, |
||||
42 => 1, |
||||
47 => 1, |
||||
48 => 1, |
||||
); |
||||
break; |
||||
case 'LowerCaseConstantUnitTest.js': |
||||
return array( |
||||
2 => 1, |
||||
3 => 1, |
||||
4 => 1, |
||||
7 => 1, |
||||
8 => 1, |
||||
12 => 1, |
||||
13 => 1, |
||||
14 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
} |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,9 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* @see something |
||||
*/ |
||||
if (@in_array($array, $needle)) |
||||
{ |
||||
echo '@'; |
||||
} |
||||
?> |
||||
@ -1,68 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the NoSilencedErrors sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: NoSilencedErrorsUnitTest.php 270342 2008-12-03 04:42:07Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the NoSilencedErrors sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_PHP_NoSilencedErrorsUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
5 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,50 +0,0 @@ |
||||
<?php |
||||
|
||||
// True |
||||
function myFunction($arg1, $arg2=TRUE) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=true) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=True) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === TRUE) { } |
||||
if ($variable === true) { } |
||||
if ($variable === True) { } |
||||
|
||||
|
||||
// False |
||||
function myFunction($arg1, $arg2=FALSE) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=false) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=False) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === FALSE) { } |
||||
if ($variable === false) { } |
||||
if ($variable === False) { } |
||||
|
||||
|
||||
// Null |
||||
function myFunction($arg1, $arg2=NULL) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=null) |
||||
{ |
||||
} |
||||
function myFunction($arg1, $arg2=Null) |
||||
{ |
||||
} |
||||
|
||||
if ($variable === NULL) { } |
||||
if ($variable === null) { } |
||||
if ($variable === Null) { } |
||||
|
||||
?> |
||||
@ -1,81 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UpperCaseConstant sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: UpperCaseConstantUnitTest.php 226877 2007-01-10 03:14:44Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UpperCaseConstant sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_PHP_UpperCaseConstantUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
7 => 1, |
||||
10 => 1, |
||||
15 => 1, |
||||
16 => 1, |
||||
23 => 1, |
||||
26 => 1, |
||||
31 => 1, |
||||
32 => 1, |
||||
39 => 1, |
||||
42 => 1, |
||||
47 => 1, |
||||
48 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,13 +0,0 @@ |
||||
<?php |
||||
$x = 'My '.'string'; |
||||
$x = 'My '.1234; |
||||
$x = 'My '.$y.' test'; |
||||
|
||||
echo $data['my'.'index']; |
||||
echo $data['my'.4]; |
||||
echo $data['my'.$x]; |
||||
echo $data[$x.$y.'My'.'String']; |
||||
|
||||
$code = '$actions = array();'."\n"; |
||||
$code = "$actions = array();"."\n"; |
||||
?> |
||||
@ -1,11 +0,0 @@ |
||||
var x = 'My ' + 'string'; |
||||
var x = 'My ' + 1234; |
||||
var x = 'My ' + y + ' test'; |
||||
|
||||
this.errors['test'] = x; |
||||
this.errors['test' + 10] = x; |
||||
this.errors['test' + y] = x; |
||||
this.errors['test' + 'blah'] = x; |
||||
this.errors[y] = x; |
||||
this.errors[y + z] = x; |
||||
this.errors[y + z + 'My' + 'String'] = x; |
||||
@ -1,87 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UnnecessaryStringConcat sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: UnnecessaryStringConcatUnitTest.php 287523 2009-08-21 04:20:07Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UnnecessaryStringConcat sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_Strings_UnnecessaryStringConcatUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'UnnecessaryStringConcatUnitTest.inc': |
||||
return array( |
||||
2 => 1, |
||||
6 => 1, |
||||
9 => 1, |
||||
12 => 1, |
||||
); |
||||
break; |
||||
case 'UnnecessaryStringConcatUnitTest.js': |
||||
return array( |
||||
1 => 1, |
||||
8 => 1, |
||||
11 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
} |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,5 +0,0 @@ |
||||
#login-container { |
||||
margin-left: -225px; |
||||
width: 450px; |
||||
} |
||||
|
||||
@ -1,17 +0,0 @@ |
||||
<?php |
||||
|
||||
class ExampleClass |
||||
{ |
||||
function exampleFunction() {} |
||||
|
||||
} |
||||
|
||||
$o = <<<EOF |
||||
this is some text |
||||
this is some text |
||||
EOF; |
||||
|
||||
$correctVar = true; |
||||
$correctVar = false; |
||||
|
||||
?> |
||||
@ -1,9 +0,0 @@ |
||||
var x = { |
||||
abc: 1, |
||||
zyz: 2, |
||||
abc: 5, |
||||
mno: { |
||||
abc: 4 |
||||
}, |
||||
abc: 5 |
||||
} |
||||
@ -1,92 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DisallowTabIndent sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: DisallowTabIndentUnitTest.php 267906 2008-10-28 04:43:57Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DisallowTabIndent sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_WhiteSpace_DisallowTabIndentUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
||||
{ |
||||
switch ($testFile) { |
||||
case 'DisallowTabIndentUnitTest.inc': |
||||
return array( |
||||
5 => 1, |
||||
9 => 1, |
||||
15 => 1, |
||||
); |
||||
break; |
||||
case 'DisallowTabIndentUnitTest.js': |
||||
return array( |
||||
3 => 1, |
||||
6 => 1, |
||||
); |
||||
break; |
||||
case 'DisallowTabIndentUnitTest.css': |
||||
return array( |
||||
2 => 1, |
||||
); |
||||
break; |
||||
default: |
||||
return array(); |
||||
break; |
||||
}//end switch |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,364 +0,0 @@ |
||||
<?php |
||||
|
||||
class Test |
||||
{ |
||||
function __construct() |
||||
{ |
||||
$this->hello(); // error here |
||||
} |
||||
|
||||
function hello() // error here |
||||
{ // no error here as brackets can be put anywhere in the pear standard |
||||
echo 'hello'; |
||||
} |
||||
|
||||
function hello2() |
||||
{ |
||||
if (TRUE) { // error here |
||||
echo 'hello'; // no error here as its more than 4 spaces. |
||||
} else { |
||||
echo 'bye'; // error here |
||||
} |
||||
|
||||
while (TRUE) { |
||||
echo 'hello'; // error here |
||||
}// no error here as its handled by another test. |
||||
|
||||
do { // error here |
||||
echo 'hello'; // error here |
||||
} while (TRUE); // no error here as its aligned with the do. |
||||
}// no error here as its handled by another test. |
||||
|
||||
function hello3() |
||||
{ |
||||
switch ($hello) { |
||||
case 'hello': |
||||
break; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
?> |
||||
<pre> |
||||
</head> |
||||
<body> |
||||
<?php |
||||
if ($form->validate()) { |
||||
$safe = $form->getSubmitValues(); |
||||
} |
||||
?> |
||||
</pre> |
||||
<?php |
||||
|
||||
class Test2 |
||||
{ |
||||
function __construct() |
||||
{ |
||||
// $this->open(); // error here |
||||
} |
||||
|
||||
public function open() |
||||
{ |
||||
// Some inline stuff that shouldn't error |
||||
if (TRUE) echo 'hello'; |
||||
foreach ($tokens as $token) echo $token; |
||||
} |
||||
|
||||
/** |
||||
* This is a comment 1. |
||||
* This is a comment 2. |
||||
* This is a comment 3. |
||||
* This is a comment 4. |
||||
*/ |
||||
public function close() |
||||
{ |
||||
// All ok. |
||||
if (TRUE) { |
||||
if (TRUE) { |
||||
} else if (FALSE) { |
||||
foreach ($tokens as $token) { |
||||
switch ($token) { |
||||
case '1': |
||||
case '2': |
||||
if (true) { |
||||
if (false) { |
||||
if (false) { |
||||
if (false) { |
||||
echo 'hello'; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
case '5': |
||||
break; |
||||
} |
||||
do { |
||||
while (true) { |
||||
foreach ($tokens as $token) { |
||||
for ($i = 0; $i < $token; $i++) { |
||||
echo 'hello'; |
||||
} |
||||
} |
||||
} |
||||
} while (true); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
This is another c style comment 1. |
||||
This is another c style comment 2. |
||||
This is another c style comment 3. |
||||
This is another c style comment 4. |
||||
This is another c style comment 5. |
||||
*/ |
||||
|
||||
/* |
||||
* |
||||
* |
||||
* |
||||
*/ |
||||
|
||||
/** |
||||
*/ |
||||
|
||||
/* |
||||
This comment has a newline in it. |
||||
|
||||
*/ |
||||
|
||||
public function read() |
||||
{ |
||||
echo 'hello'; |
||||
|
||||
// no errors below. |
||||
$array = array( |
||||
'this', |
||||
'that' => array( |
||||
'hello', |
||||
'hello again' => array( |
||||
'hello', |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
||||
|
||||
abstract class Test3 |
||||
{ |
||||
public function parse() |
||||
{ |
||||
|
||||
foreach ($t as $ndx => $token) { |
||||
if (is_array($token)) { |
||||
echo 'here'; |
||||
} else { |
||||
$ts[] = array("token" => $token, "value" => ''); |
||||
|
||||
$last = count($ts) - 1; |
||||
|
||||
switch ($token) { |
||||
case '(': |
||||
|
||||
if ($last >= 3 && |
||||
$ts[0]['token'] != T_CLASS && |
||||
$ts[$last - 2]['token'] == T_OBJECT_OPERATOR && |
||||
$ts[$last - 3]['token'] == T_VARIABLE ) { |
||||
|
||||
|
||||
if (true) { |
||||
echo 'hello'; |
||||
} |
||||
} |
||||
array_push($braces, $token); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public function test() |
||||
{ |
||||
$o = <<<EOF |
||||
this is some text |
||||
this is some text |
||||
this is some text |
||||
this is some text |
||||
this is some text |
||||
this is some text |
||||
EOF; |
||||
|
||||
return $o; |
||||
} |
||||
|
||||
if ($a === true || $a === true || $a === true || $a === true || |
||||
$a === true || $a === true || $a === true || $a === true) { |
||||
|
||||
echo 'hello'; |
||||
} |
||||
|
||||
if ($true) { |
||||
/* First comment line |
||||
* |
||||
* Comment test here |
||||
* Comment test here |
||||
* |
||||
*/ |
||||
|
||||
/* First comment line |
||||
* |
||||
* Comment test here |
||||
* Comment test here |
||||
* |
||||
this si something */ |
||||
} |
||||
|
||||
function test() |
||||
{ |
||||
/* taken from http://de3.php.net/manual/en/reserved.php */ |
||||
# $m[] = 'declare'; |
||||
/* taken from http://de3.php.net/manual/en/reserved.php */ |
||||
# $m[] = 'declare'; |
||||
} |
||||
|
||||
foreach ($elements as $element) { |
||||
if ($something) { |
||||
// Do IF. |
||||
} else if ($somethingElse) { |
||||
// Do ELSE. |
||||
} |
||||
} |
||||
|
||||
if ($condition) { |
||||
echo "This is a long |
||||
string that spans $numLines lines |
||||
without indenting. |
||||
"; |
||||
} |
||||
|
||||
if ($condition) { |
||||
echo 'This is a long |
||||
string that spans nultiple lines |
||||
with indenting. |
||||
'; |
||||
} |
||||
|
||||
if ($condition) { |
||||
echo 'This is a long |
||||
string that spans nultiple lines |
||||
with indenting.'; |
||||
} |
||||
|
||||
switch ($foo) { |
||||
case 1: |
||||
switch ($bar) { |
||||
default: |
||||
echo $string{1}; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
function temp($foo, $bar) { |
||||
switch ($foo) { |
||||
case 1: |
||||
switch ($bar) { |
||||
default: |
||||
return $foo; |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
switch ($foo) { |
||||
case 1: |
||||
switch ($bar) { |
||||
default: |
||||
if ($something) { |
||||
echo $string{1}; |
||||
} else if ($else) { |
||||
switch ($else) { |
||||
default: |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
|
||||
switch ($name) { |
||||
case "1": |
||||
case "2": |
||||
case "3": |
||||
return true; |
||||
} |
||||
|
||||
switch ($name) { |
||||
case "1": |
||||
case "2": |
||||
case "3": |
||||
default : |
||||
return true; |
||||
} |
||||
|
||||
function myFunction() |
||||
{ |
||||
?> |
||||
<dynamic_content> |
||||
|
||||
</dynamic_content> |
||||
<?php |
||||
|
||||
} |
||||
|
||||
switch ($name) { |
||||
case "1": |
||||
switch ($name2) { |
||||
case "1": |
||||
break; |
||||
case "2": |
||||
break; |
||||
} |
||||
break; |
||||
case "2": |
||||
break; |
||||
} |
||||
|
||||
switch (true) { |
||||
case true: { |
||||
} |
||||
echo 'hi'; |
||||
break; |
||||
case false: |
||||
case null:{ |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
switch (true) { |
||||
case true: { |
||||
echo 'hi'; |
||||
} |
||||
// No break here. |
||||
case false: |
||||
case true: |
||||
case null:{ |
||||
echo 'hi'; |
||||
echo 'hi'; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
switch (true) { |
||||
case true: { |
||||
if (true) { |
||||
echo 'hi'; |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
|
||||
?> |
||||
@ -1,90 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the ScopeIndent sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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: ScopeIndentUnitTest.php 293533 2010-01-14 05:55:31Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the ScopeIndent sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@squiz.net> |
||||
* @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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class Generic_Tests_WhiteSpace_ScopeIndentUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
7 => 1, |
||||
10 => 1, |
||||
17 => 1, |
||||
20 => 1, |
||||
24 => 1, |
||||
27 => 1, |
||||
28 => 1, |
||||
58 => 1, |
||||
123 => 1, |
||||
126 => 1, |
||||
224 => 1, |
||||
225 => 1, |
||||
279 => 1, |
||||
280 => 1, |
||||
281 => 1, |
||||
282 => 1, |
||||
283 => 1, |
||||
284 => 1, |
||||
311 => 1, |
||||
336 => 1, |
||||
349 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,13 +0,0 @@ |
||||
.SettingsTabPaneWidgetType-tab-mid { |
||||
background: transparent url(tab_inact_mid.png) repeat-x; |
||||
line-height: -25px; |
||||
cursor: pointer; |
||||
-moz-user-select: none; |
||||
} |
||||
|
||||
.AssetLineageWidgetType-item { |
||||
float: left; |
||||
list-style: none; |
||||
height: 22px; |
||||
cursor: pointer; |
||||
} |
||||
@ -1,67 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the BrowserSpecificStyles sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: ForbiddenStylesUnitTest.php 268254 2008-11-04 05:08:07Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the BrowserSpecificStyles sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_CSS_BrowserSpecificStylesUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
5 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,49 +0,0 @@ |
||||
<?php |
||||
class SomethingActions |
||||
{ |
||||
|
||||
private static function _x() |
||||
{ |
||||
} |
||||
|
||||
|
||||
public static function y() |
||||
{ |
||||
self::z(); |
||||
SomethingActions::z(); |
||||
self::_x(); |
||||
self::a(); |
||||
} |
||||
|
||||
|
||||
public static function z() |
||||
{ |
||||
} |
||||
|
||||
protected static function a() |
||||
{ |
||||
self::a(); // recursion, yay! |
||||
self::z(); |
||||
self::y(); |
||||
self::b(); |
||||
echo self::$_myVar; |
||||
echo self::$yourVar; |
||||
} |
||||
} |
||||
|
||||
abstract class AbstractEditingScreenModeWidgetActions extends AbstractEditingModeWidgetActions { |
||||
|
||||
public static function getScreens($systemName) |
||||
{ |
||||
|
||||
}//end getScreens() |
||||
|
||||
public static function setHelpScreenTitle() |
||||
{ |
||||
// This is allowed because we are in an abstract class. |
||||
$screens = self::getScreens(''); |
||||
|
||||
}//end setHelpScreenTitle() |
||||
|
||||
}//end class |
||||
?> |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DisallowSelfActionsUnitTest sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: DisallowSelfActionsUnitTest.php 265572 2008-08-28 03:43:37Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DisallowSelfActionsUnitTest sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Channels_DisallowSelfActionsUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
12 => 1, |
||||
26 => 1, |
||||
27 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,107 +0,0 @@ |
||||
<?php |
||||
Channels::includeSystem('MySystem'); |
||||
Channels::includeAsset('Page'); |
||||
require_once 'libs/FileSystem2.inc'; |
||||
|
||||
function one() { |
||||
Channels::includeSystem('MySystem2'); |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
Page::create(); |
||||
PageAssetType::create(); |
||||
} |
||||
|
||||
function two() { |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
$parserFiles = FileSystem2::listDirectory(); |
||||
} |
||||
|
||||
function three() { |
||||
include 'libs/FileSystem.inc'; |
||||
$siteid = MySystem::getCurrentSiteId(); |
||||
$parserFiles = FileSystem::listDirectory(); |
||||
} |
||||
|
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
$parserFiles = FileSystem2::listDirectory(); |
||||
$siteid = MySystem::getCurrentSiteId(); |
||||
$parserFiles = FileSystem::listDirectory(); |
||||
Page::create(); |
||||
PageAssetType::create(); |
||||
|
||||
class AssetListingAssetType extends AssetAssetType |
||||
{ |
||||
function one() { |
||||
Channels::includeSystem('MySystem2'); |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
Page::create(); |
||||
PageAssetType::create(); |
||||
} |
||||
|
||||
function two() { |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
$parserFiles = FileSystem2::listDirectory(); |
||||
return parent::two(); |
||||
} |
||||
|
||||
function three() { |
||||
include 'libs/FileSystem.inc'; |
||||
$siteid = MySystem::getCurrentSiteId(); |
||||
$parserFiles = FileSystem::listDirectory(); |
||||
echo self::two(); |
||||
} |
||||
} |
||||
|
||||
echo Init::ROOT_DIR; |
||||
|
||||
Channels::includeSystem('AssetType'); |
||||
AssetType::includeAsset('User'); |
||||
AssetType::includeAsset('FolderAsset'); |
||||
UserAssetType::create(); |
||||
FolderAssetType::create(); |
||||
$query->fetch(PDO::FETCH_NUM) |
||||
BaseSystem::getDataDir(); |
||||
Util::getArrayIndex(array(), ''); |
||||
|
||||
|
||||
Channels::includeSystem('Widget'); |
||||
Widget::includeWidget('AbstractContainer'); |
||||
class MyWidget extends AbstractContainerWidgetType {} |
||||
class MyOtherWidget extends BookWidgetType {} |
||||
|
||||
$zip = new ZipArchive(); |
||||
$res = $zip->open($path, ZipArchive::CREATE); |
||||
|
||||
class AssetListingUnitTest extends AbstractMySourceUnitTest |
||||
{ |
||||
function setUp() { |
||||
parent::setUp(); |
||||
Channels::includeSystem('MySystem2'); |
||||
include_once 'Libs/FileSystem.inc'; |
||||
} |
||||
|
||||
function two() { |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
$parserFiles = FileSystem::listDirectory(); |
||||
} |
||||
|
||||
function three() { |
||||
$siteid = MySystem3::getCurrentSiteId(); |
||||
$parserFiles = FileSystem::listDirectory(); |
||||
} |
||||
} |
||||
|
||||
if (Channels::systemExists('Log') === TRUE) { |
||||
Channels::includeSystem('Log'); |
||||
} else { |
||||
return; |
||||
} |
||||
|
||||
Log::addProjectLog('metadata.field.update', $msg); |
||||
|
||||
function two() { |
||||
Widget::includeWidget('CacheAdminScreen'); |
||||
$barChart = CacheAdminScreenWidgetType::constructBarchart($data); |
||||
} |
||||
|
||||
$adjustDialog->setOrientation(AbstractWidgetWidgetType::CENTER); |
||||
?> |
||||
@ -1,78 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the IncludeSystem sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: IncludeSystemUnitTest.php 283091 2009-06-30 02:08:55Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the IncludeSystem sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Channels_IncludeSystemUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
9 => 1, |
||||
14 => 1, |
||||
24 => 1, |
||||
27 => 1, |
||||
28 => 1, |
||||
31 => 1, |
||||
36 => 1, |
||||
41 => 1, |
||||
60 => 1, |
||||
69 => 1, |
||||
88 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,67 +0,0 @@ |
||||
<?php |
||||
Channels::includeSystem('OurSystem'); |
||||
Channels::includeSystem('Page'); |
||||
Channels::includeAsset('Page2'); |
||||
Channels::includeAsset('Folder'); |
||||
|
||||
function one() { |
||||
Channels::includeSystem('MySystem'); |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
Page::create(); |
||||
PageAssetType::create(); |
||||
} |
||||
|
||||
function two() { |
||||
Page2AssetType::create(); |
||||
Folder::getFolder(); |
||||
} |
||||
|
||||
Channels::includeAsset('Asset'); |
||||
class AssetListingAssetType extends AssetAssetType |
||||
{ |
||||
function one() { |
||||
Channels::includeSystem('MySystem2'); |
||||
Channels::includeSystem('Page2'); |
||||
$siteid = MySystem2::getCurrentSiteId(); |
||||
} |
||||
|
||||
function two() { |
||||
$siteid = Page2::getCurrentSiteId(); |
||||
} |
||||
} |
||||
|
||||
Channels::includeSystem('Log'); |
||||
Channels::includeSystem('Log4'); |
||||
class MyLog implements Dog, Log extends LogMe {} |
||||
|
||||
Channels::includeSystem('Log1'); |
||||
class MyLog implements Dog, Log1 extends LogMe {} |
||||
|
||||
class MyLog implements Log2 {} |
||||
|
||||
Channels::includeSystem('Log3'); |
||||
class MyLog implements Log3 {} |
||||
|
||||
if (self::systemExists($systemName) === FALSE) { |
||||
return $actions; |
||||
} else { |
||||
// Shouldnt throw an error because we dont know the system name. |
||||
self::includeSystem($systemName); |
||||
self::includeSystem($systemNames['log']); |
||||
} |
||||
|
||||
Channels::includeSystem('Widget'); |
||||
Widget::includeWidget('AbstractContainer'); |
||||
class MyOtherWidget extends BookWidgetType {} |
||||
|
||||
function myFunction() |
||||
{ |
||||
if (Channels::systemExists('Log5') === TRUE) { |
||||
Channels::includeSystem('Log5'); |
||||
} else { |
||||
return; |
||||
} |
||||
|
||||
Log5::addProjectLog('metadata.field.update', $msg); |
||||
} |
||||
?> |
||||
@ -1,73 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the UnusedSystem sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: UnusedSystemUnitTest.php 252279 2008-02-05 00:34:19Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the UnusedSystem sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Channels_UnusedSystemUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
2 => 1, |
||||
5 => 1, |
||||
8 => 1, |
||||
24 => 1, |
||||
34 => 1, |
||||
54 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,101 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
* @api-privilege asset.read.content |
||||
* @api-mustlock false |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @api read |
||||
* |
||||
* @return void |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api-privilege asset.read.content |
||||
* @api read |
||||
* @api-mustlock false |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
* |
||||
* @api-privilege asset.read.content |
||||
* @api-mustlock false |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* @api read |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Test unknown tags. |
||||
* |
||||
* @return void |
||||
* @since read |
||||
* @hello hello |
||||
* @package Test |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
* @api-privilege asset.read.content |
||||
* @api-mustlock false |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
* @api-mustlock false |
||||
*/ |
||||
private function functionCall() {} |
||||
|
||||
/** |
||||
* Short content. |
||||
* |
||||
* @return void |
||||
* |
||||
* @api read |
||||
*/ |
||||
private function functionCall() {} |
||||
?> |
||||
@ -1,75 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for FunctionCommentSniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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: FunctionCommentUnitTest.php 292513 2009-12-23 00:41:20Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for FunctionCommentSniff. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Commenting_FunctionCommentUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
28 => 1, |
||||
36 => 1, |
||||
37 => 2, |
||||
49 => 1, |
||||
58 => 1, |
||||
65 => 1, |
||||
77 => 1, |
||||
79 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
67 => 1, |
||||
68 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,4 +0,0 @@ |
||||
<?php |
||||
Debug::bam('test'); |
||||
Debug::minbam($variable); |
||||
?> |
||||
@ -1,69 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DebugCode sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: DebugCodeUnitTest.php 265159 2008-08-20 05:37:21Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DebugCode sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Debug_DebugCodeUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
2 => 1, |
||||
3 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,8 +0,0 @@ |
||||
console.info(); |
||||
console.warn(); |
||||
console.test(); |
||||
con.sole(); |
||||
var console = { |
||||
console: 'string'; |
||||
}; |
||||
function console() {} |
||||
@ -1,79 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the FirebugConsole sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: FirebugConsoleUnitTest.php 253189 2008-02-19 03:35:31Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the FirebugConsole sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Debug_FirebugConsoleUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='FirebugConsoleUnitTest.js') |
||||
{ |
||||
if ($testFile !== 'FirebugConsoleUnitTest.js') { |
||||
return array(); |
||||
} |
||||
|
||||
return array( |
||||
1 => 1, |
||||
2 => 1, |
||||
3 => 1, |
||||
5 => 1, |
||||
6 => 1, |
||||
8 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,18 +0,0 @@ |
||||
var self = this; |
||||
buttonWidget.addClickEvent(function() { |
||||
self.addDynamicSouce(); |
||||
}); |
||||
|
||||
var x = self; |
||||
var y = this; |
||||
|
||||
var test = ''; |
||||
if (true) { |
||||
test = this |
||||
} |
||||
|
||||
var itemid = this.items[i].getAttribute('itemid'); |
||||
|
||||
for (var x = this; y < 10; y++) { |
||||
var x = this + 1; |
||||
} |
||||
@ -1,76 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the AssignThis sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: AssignThisUnitTest.php 253717 2008-02-25 03:25:05Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the AssignThis sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Objects_AssignThisUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='AssignThisUnitTest.js') |
||||
{ |
||||
if ($testFile !== 'AssignThisUnitTest.js') { |
||||
return array(); |
||||
} |
||||
|
||||
return array( |
||||
7 => 1, |
||||
11 => 1, |
||||
16 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,186 +0,0 @@ |
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
if (x === 1) { |
||||
return; |
||||
} |
||||
|
||||
if (y === 1) { |
||||
callback.call(this); |
||||
// A comment here to explain the return is okay.
|
||||
return; |
||||
} |
||||
|
||||
if (a === 1) { |
||||
// Cant return value even after calling callback.
|
||||
callback.call(this); |
||||
return something; |
||||
} |
||||
|
||||
if (a === 1) { |
||||
// Need to pass self or this to callback function.
|
||||
callback.call(a); |
||||
} |
||||
|
||||
callback.call(self); |
||||
|
||||
var self = this; |
||||
this.createChildren(null, function() { |
||||
callback.call(self, div); |
||||
}); |
||||
|
||||
// Never good to return a vaue.
|
||||
return something; |
||||
|
||||
callback.call(self); |
||||
} |
||||
|
||||
}; |
||||
|
||||
AnotherSampleWidgetType.prototype = { |
||||
|
||||
create: function(input) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
getSomething: function(input) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
}; |
||||
|
||||
|
||||
NoCreateWidgetType.prototype = { |
||||
|
||||
getSomething: function(input) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
}; |
||||
|
||||
|
||||
SomeRandom.prototype = { |
||||
|
||||
create: function(input) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
if (a === 1) { |
||||
// This is ok because it is the last statement,
|
||||
// even though it is conditional.
|
||||
callback.call(self); |
||||
} |
||||
|
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
var something = callback; |
||||
|
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
// Also valid because we are passing the callback to
|
||||
// someone else to call.
|
||||
if (y === 1) { |
||||
this.something(callback); |
||||
return; |
||||
} |
||||
|
||||
this.init(callback); |
||||
|
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
// Also valid because we are passing the callback to
|
||||
// someone else to call.
|
||||
if (y === 1) { |
||||
this.something(callback); |
||||
} |
||||
|
||||
this.init(callback); |
||||
|
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
if (a === 1) { |
||||
// This is ok because it is the last statement,
|
||||
// even though it is conditional.
|
||||
this.something(callback); |
||||
} |
||||
|
||||
} |
||||
|
||||
}; |
||||
|
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
if (dfx.isFn(callback) === true) { |
||||
callback.call(this, cont); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
}; |
||||
|
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
dfx.foreach(items, function(item) { |
||||
return true; |
||||
}); |
||||
|
||||
if (dfx.isFn(callback) === true) { |
||||
callback.call(this); |
||||
} |
||||
} |
||||
|
||||
}; |
||||
|
||||
SampleWidgetType.prototype = { |
||||
|
||||
create: function(callback) |
||||
{ |
||||
var self = this; |
||||
this.createChildren(null, function() { |
||||
callback.call(self, div); |
||||
return; |
||||
}); |
||||
} |
||||
|
||||
}; |
||||
@ -1,81 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the CreateWidgetTypeCallback sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: CreateWidgetTypeCallbackUnitTest.php 287794 2009-08-27 06:08:58Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the CreateWidgetTypeCallback sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Objects_CreateWidgetTypeCallbackUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @param string $testFile The name of the file being tested. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList($testFile='CreateWidgetTypeCallbackUnitTest.js') |
||||
{ |
||||
if ($testFile !== 'CreateWidgetTypeCallbackUnitTest.js') { |
||||
return array(); |
||||
} |
||||
|
||||
return array( |
||||
18 => 1, |
||||
23 => 2, |
||||
26 => 1, |
||||
30 => 1, |
||||
34 => 1, |
||||
43 => 2, |
||||
91 => 1, |
||||
123 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,6 +0,0 @@ |
||||
<?php |
||||
Channels::includeSystem('Widget'); |
||||
Widget::includeWidget('PasswordField'); |
||||
$blah = new PasswordFieldWidgetType(); |
||||
Widget::getWidget('PasswordField'); |
||||
?> |
||||
@ -1,68 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the DisallowNewWidget sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: DisallowNewWidgetUnitTest.php 253718 2008-02-25 03:48:52Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the DisallowNewWidget sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_Objects_DisallowNewWidgetUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,26 +0,0 @@ |
||||
<?php |
||||
function getWidget($type) |
||||
{ |
||||
eval('$obj = new '.$type.'();'); |
||||
return $obj; |
||||
|
||||
}//end getWidget() |
||||
|
||||
function getWidget2($type) |
||||
{ |
||||
$string = '$obj = new '.$type.'();'; |
||||
eval($string); |
||||
eval('$string = "";'); |
||||
return $obj; |
||||
|
||||
}//end getWidget2() |
||||
|
||||
function getWidget3($type) |
||||
{ |
||||
$string = '$obj = new '; |
||||
eval($string.$type.'();'); |
||||
return $obj; |
||||
|
||||
}//end getWidget3() |
||||
|
||||
?> |
||||
@ -1,70 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the EvalObjectFactory sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: EvalObjectFactoryUnitTest.php 238112 2007-06-20 05:52:41Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the EvalObjectFactory sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_PHP_EvalObjectFactoryUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array( |
||||
4 => 1, |
||||
12 => 1, |
||||
21 => 1, |
||||
); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
@ -1,30 +0,0 @@ |
||||
<?php |
||||
echo $_REQUEST['action']; |
||||
Security::getRequestData('action'); |
||||
|
||||
echo $_POST['action']; |
||||
Security::getRequestData('action', 'post'); |
||||
|
||||
echo $_GET[$action]; |
||||
Security::getRequestData($action, 'get'); |
||||
|
||||
class Security |
||||
{ |
||||
function getRequestData($var) { |
||||
echo $_REQUEST[$var]; |
||||
} |
||||
} |
||||
|
||||
class Insecurity |
||||
{ |
||||
function getRequestData($var) { |
||||
unset($_REQUEST[$var]); |
||||
echo 'OMGHAX!'; |
||||
} |
||||
} |
||||
|
||||
$sample = Util::getArrayIndex($_REQUEST, 'sample', ''); |
||||
$syntax = Util::getArrayIndex($_REQUEST, 'syntax', ''); |
||||
$value = Util::getArrayIndex($_FILES, $key, $default); |
||||
|
||||
?> |
||||
@ -1,74 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Unit test class for the GetRequestData sniff. |
||||
* |
||||
* PHP version 5 |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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: GetRequestDataUnitTest.php 292098 2009-12-14 00:36:04Z squiz $ |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
|
||||
/** |
||||
* Unit test class for the GetRequestData sniff. |
||||
* |
||||
* A sniff unit test checks a .inc file for expected violations of a single |
||||
* coding standard. Expected errors and warnings are stored in this class. |
||||
* |
||||
* @category PHP |
||||
* @package PHP_CodeSniffer_MySource |
||||
* @author Greg Sherwood <gsherwood@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 Release: 1.3.0RC1 |
||||
* @link http://pear.php.net/package/PHP_CodeSniffer |
||||
*/ |
||||
class MySource_Tests_PHP_GetRequestDataUnitTest extends AbstractSniffUnitTest |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where errors should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of errors that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getErrorList() |
||||
{ |
||||
return array( |
||||
2 => 1, |
||||
5 => 1, |
||||
8 => 1, |
||||
21 => 1, |
||||
26 => 1, |
||||
27 => 1, |
||||
28 => 1, |
||||
); |
||||
|
||||
}//end getErrorList() |
||||
|
||||
|
||||
/** |
||||
* Returns the lines where warnings should occur. |
||||
* |
||||
* The key of the array should represent the line number and the value |
||||
* should represent the number of warnings that should occur on that line. |
||||
* |
||||
* @return array(int => int) |
||||
*/ |
||||
public function getWarningList() |
||||
{ |
||||
return array(); |
||||
|
||||
}//end getWarningList() |
||||
|
||||
|
||||
}//end class |
||||
|
||||
?> |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue