~ubuntu-branches/ubuntu/utopic/php-codesniffer/utopic-proposed

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.5.0RC2/CodeSniffer/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2014-07-21 14:42:41 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140721144241-g4orlcuk4jzn9mhs
Tags: 1.5.3-1
* Team upload
* Focus on stable release
* Update copyright
* Bump standards version to 3.9.5
* Update Homepage
* Use ${phppear:…} instead of hardcoding them
* Run tests in dh_auto_test
* Update patch with gbp pq
* Simplify configuration installation
* Edit package.xml to move script
* Add DEP-8 tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
use Exception as My_Exception, foo\bar, baz;
3
 
namespace foo;
4
 
namespace foo\bar;
5
 
namespace bar\foo\baz;
6
 
 
7
 
define('VALID_NAME', true);
8
 
define('invalidName', true);
9
 
define("VALID_NAME", true);
10
 
define("invalidName", true);
11
 
 
12
 
class TestClass extends MyClass, YourClass
13
 
{
14
 
 
15
 
    const const1 = 'hello';
16
 
    const CONST2 = 'hello';
17
 
 
18
 
    function test()
19
 
    {
20
 
        echo constant('VALID_NAME');
21
 
        echo VALID_NAME;
22
 
        print VALID_NAME;
23
 
        echo(VALID_NAME);
24
 
        print(VALID_NAME);
25
 
        echo constant('invalidName');
26
 
        echo invalidName;
27
 
        print invalidName;
28
 
        echo(invalidName);
29
 
        print(invalidName);
30
 
 
31
 
        echo constant("VALID_NAME");
32
 
        echo constant("invalidName");
33
 
 
34
 
        echo 'Hello', VALID_NAME;
35
 
        echo 'Hello', invalidName;
36
 
 
37
 
        // These might look like constants to
38
 
        // poorly written code.
39
 
        echo 'Hello there';
40
 
        echo "HELLO";
41
 
        echo 'HELLO';
42
 
        print 'Hello there';
43
 
        print "HELLO";
44
 
        print 'HELLO';
45
 
    }
46
 
 
47
 
    function myFunc(PHP_CodeSniffer &$blah) {}
48
 
    function myFunc(PHP_CodeSniffer $blah) {}
49
 
 
50
 
}
51
 
 
52
 
interface MyInterface
53
 
{
54
 
}
55
 
 
56
 
if (($object instanceof Some_Class) === false) {
57
 
    $var = <<<EOF
58
 
This is some heredoc text.
59
 
This is some heredoc text.
60
 
This is some heredoc text.
61
 
 
62
 
This is some heredoc text.
63
 
This is some heredoc text.
64
 
This is some heredoc text.
65
 
EOF;
66
 
}
67
 
 
68
 
$var = <<<EOF
69
 
This is some heredoc text.
70
 
This is some heredoc text.
71
 
This is some heredoc text.
72
 
 
73
 
This is some heredoc text.
74
 
This is some heredoc text.
75
 
This is some heredoc text.
76
 
EOF;
77
 
 
78
 
throw new InvalidSomethingException;
79
 
 
80
 
declare(ticks = 1) {
81
 
    foreach ($var as $bit) {
82
 
        echo $bit;
83
 
    }
84
 
}
85
 
 
86
 
$binary = (binary) $string;
87
 
 
88
 
$foo->define('bar');
89
 
$foo->getBar()->define('foo');
90
 
 
91
 
// This is allowed as it is required for PHPUnit.
92
 
if (PHPUnit_MAIN_METHOD == 'PHP_Shell_AllTests::main') {
93
 
    PHP_Shell_AllTests::main();
94
 
}
95
 
 
96
 
class ConstTest {
97
 
    const TESTER = '1';
98
 
    public function __construct() {
99
 
        echo constant('self::TESTER');
100
 
        echo constant('self::tester');
101
 
    }
102
 
}
103
 
 
104
 
class A {
105
 
    public static function constant($x) {}
106
 
}
107
 
 
108
 
A::constant('anything-not-in-uppercase');
109
 
 
110
 
// goto
111
 
goto gotolabel;
112
 
 
113
 
gototarget1:
114
 
 
115
 
function ConstTest() {
116
 
    gototarget2:
117
 
}
118
 
 
119
 
switch($foo)
120
 
{
121
 
    case $bar:
122
 
    gototarget3:
123
 
}
124
 
 
125
 
$a = 2 * ${x} - ${minus};
126
 
 
127
 
class Object implements IObject
128
 
{
129
 
    use TProperties;
130
 
    use TReflected {
131
 
        TReflected::reflect insteadof TProperties;
132
 
    }
133
 
}
134
 
?>