~ubuntu-branches/ubuntu/vivid/php-codesniffer/vivid

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.5.4/CodeSniffer/Standards/MySource/Tests/Objects/CreateWidgetTypeCallbackUnitTest.js

  • Committer: Package Import Robot
  • Author(s): David Prévot, Greg Sherwood, Alexey, Emily, David Prévot
  • Date: 2014-09-26 13:44:35 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140926134435-wvjq16miqq4d60y0
Tags: 1.5.5-1
[ Greg Sherwood ]
* Improved closure support in Generic ScopeIndentSniff
* Improved indented PHP tag support in Generic ScopeIndentSniff
* Standards can now be located within hidden directories
 (further fix for bug #20323)
* Fixed bug #20373 : Inline comment sniff tab handling way
* Fixed bug #20378 : Report appended to existing file if no errors
  found in run
* Fixed bug #20381 : Invalid "Comment closer must be on a new line"
* PHP tokenizer no longer converts class/function names to special
  tokens types
* Fixed bug #20386 : Squiz.Commenting.ClassComment.SpacingBefore
  thrown if first block comment
* Squiz and PEAR FunctionCommentSnif now support _()
* PEAR ValidFunctionNameSniff no longer throws an error for _()
* Fixed bug #248 : FunctionCommentSniff expects ampersand on param name
* Fixed bug #248 in Squiz sniff as well
* Fixed bug #265 : False positives with type hints in ForbiddenFunctionsSniff
* Prepare for 1.5.5 release

[ Alexey ]
* Allowed single undersored methods and functions

[ Emily ]
* Added var_dump to discouraged functions sniff

[ David Prévot ]
* Revert "Add XS-Testsuite still needed for ci.d.n"
* Add self to uploaders
* Bump standards version to 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
SampleWidgetType.prototype = {
2
 
 
3
 
    create: function(callback)
4
 
    {
5
 
        if (x === 1) {
6
 
            return;
7
 
        }
8
 
 
9
 
        if (y === 1) {
10
 
            callback.call(this);
11
 
            // A comment here to explain the return is okay.
12
 
            return;
13
 
        }
14
 
 
15
 
        if (a === 1) {
16
 
            // Cant return value even after calling callback.
17
 
            callback.call(this);
18
 
            return something;
19
 
        }
20
 
 
21
 
        if (a === 1) {
22
 
            // Need to pass self or this to callback function.
23
 
            callback.call(a);
24
 
        }
25
 
 
26
 
        callback.call(self);
27
 
 
28
 
        var self = this;
29
 
        this.createChildren(null, function() {
30
 
            callback.call(self, div);
31
 
        });
32
 
 
33
 
        // Never good to return a vaue.
34
 
        return something;
35
 
 
36
 
        callback.call(self);
37
 
    }
38
 
 
39
 
};
40
 
 
41
 
AnotherSampleWidgetType.prototype = {
42
 
 
43
 
    create: function(input)
44
 
    {
45
 
        return;
46
 
    }
47
 
 
48
 
    getSomething: function(input)
49
 
    {
50
 
        return 1;
51
 
    }
52
 
 
53
 
};
54
 
 
55
 
 
56
 
NoCreateWidgetType.prototype = {
57
 
 
58
 
    getSomething: function(input)
59
 
    {
60
 
        return;
61
 
    }
62
 
 
63
 
};
64
 
 
65
 
 
66
 
SomeRandom.prototype = {
67
 
 
68
 
    create: function(input)
69
 
    {
70
 
        return;
71
 
    }
72
 
 
73
 
};
74
 
 
75
 
SampleWidgetType.prototype = {
76
 
 
77
 
    create: function(callback)
78
 
    {
79
 
        if (a === 1) {
80
 
            // This is ok because it is the last statement,
81
 
            // even though it is conditional.
82
 
            callback.call(self);
83
 
        }
84
 
 
85
 
    }
86
 
 
87
 
};
88
 
 
89
 
SampleWidgetType.prototype = {
90
 
 
91
 
    create: function(callback)
92
 
    {
93
 
        var something = callback;
94
 
 
95
 
    }
96
 
 
97
 
};
98
 
 
99
 
SampleWidgetType.prototype = {
100
 
 
101
 
    create: function(callback)
102
 
    {
103
 
        // Also valid because we are passing the callback to
104
 
        // someone else to call.
105
 
        if (y === 1) {
106
 
            this.something(callback);
107
 
            return;
108
 
        }
109
 
 
110
 
        this.init(callback);
111
 
 
112
 
    }
113
 
 
114
 
};
115
 
 
116
 
SampleWidgetType.prototype = {
117
 
 
118
 
    create: function(callback)
119
 
    {
120
 
        // Also valid because we are passing the callback to
121
 
        // someone else to call.
122
 
        if (y === 1) {
123
 
            this.something(callback);
124
 
        }
125
 
 
126
 
        this.init(callback);
127
 
 
128
 
    }
129
 
 
130
 
};
131
 
 
132
 
SampleWidgetType.prototype = {
133
 
 
134
 
    create: function(callback)
135
 
    {
136
 
        if (a === 1) {
137
 
            // This is ok because it is the last statement,
138
 
            // even though it is conditional.
139
 
            this.something(callback);
140
 
        }
141
 
 
142
 
    }
143
 
 
144
 
};
145
 
 
146
 
 
147
 
SampleWidgetType.prototype = {
148
 
 
149
 
    create: function(callback)
150
 
    {
151
 
        if (dfx.isFn(callback) === true) {
152
 
            callback.call(this, cont);
153
 
            return;
154
 
        }
155
 
    }
156
 
 
157
 
};
158
 
 
159
 
 
160
 
SampleWidgetType.prototype = {
161
 
 
162
 
    create: function(callback)
163
 
    {
164
 
        dfx.foreach(items, function(item) {
165
 
            return true;
166
 
        });
167
 
 
168
 
        if (dfx.isFn(callback) === true) {
169
 
            callback.call(this);
170
 
        }
171
 
    }
172
 
 
173
 
};
174
 
 
175
 
SampleWidgetType.prototype = {
176
 
 
177
 
    create: function(callback)
178
 
    {
179
 
        var self = this;
180
 
        this.createChildren(null, function() {
181
 
            callback.call(self, div);
182
 
            return;
183
 
        });
184
 
    }
185
 
 
186
 
};
 
 
b'\\ No newline at end of file'