Skip to content

Commit 0943af7

Browse files
committed
linter
1 parent 65e065c commit 0943af7

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

src/ast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ AST.prototype.prepare = function(kind, docs, parser) {
279279
};
280280
/**
281281
* Helper to change a node kind
282-
* @param {String} newKind
282+
* @param {String} newKind
283283
*/
284284
result.setKind = function(newKind) {
285-
kind = newKind;
285+
kind = newKind;
286286
};
287287
return result;
288288
};

src/ast/array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const KIND = "array";
2525
* "kind": "entry",
2626
* "key": {"kind": "string", "value": "foo", "isDoubleQuote": false},
2727
* "value": {"kind": "string", "value": "bar", "isDoubleQuote": false}
28-
* },
28+
* },
2929
* {"kind": "number", "value": "3"}
3030
* ]
3131
* }

src/ast/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Node = function Node(kind, docs, location) {
2525

2626
/**
2727
* Includes current token position of the parser
28-
* @param {*} parser
28+
* @param {*} parser
2929
*/
3030
Node.prototype.includeToken = function(parser) {
3131
if (this.loc) {

src/parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ parser.prototype.expectEndOfStatement = function(node) {
361361
if (this.token === ";") {
362362
// include only real ';' statements
363363
// https://github.com/glayzzle/php-parser/issues/164
364-
if (node && this.lexer.yytext === ';') {
364+
if (node && this.lexer.yytext === ";") {
365365
node.includeToken(this);
366366
}
367367
} else if (this.token !== this.tok.T_INLINE_HTML && this.token !== this.EOF) {
@@ -442,7 +442,7 @@ parser.prototype.text = function() {
442442
/** consume the next token **/
443443
parser.prototype.next = function() {
444444
// prepare the back command
445-
if (this.token !== ';' || this.lexer.yytext === ';') {
445+
if (this.token !== ";" || this.lexer.yytext === ";") {
446446
// ignore '?>' from automated resolution
447447
// https://github.com/glayzzle/php-parser/issues/168
448448
this.prev = [

src/parser/array.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454
const self = this;
5555
return this.read_list(
5656
function() {
57-
return self.read_array_pair(shortForm)
57+
return self.read_array_pair(shortForm);
5858
},
5959
",",
6060
true
@@ -85,10 +85,7 @@ module.exports = {
8585
const expr = this.read_expr();
8686
if (this.token === this.tok.T_DOUBLE_ARROW) {
8787
if (this.next().token === "&") {
88-
return entry(
89-
expr,
90-
this.next().read_variable(true, false, true)
91-
);
88+
return entry(expr, this.next().read_variable(true, false, true));
9289
} else {
9390
return entry(expr, this.read_expr());
9491
}

src/parser/expr.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ module.exports = {
168168
this.innerList = false;
169169
if (this.expect("=")) {
170170
return assign(
171-
result(assignList, false),
172-
this.next().read_expr(),
171+
result(assignList, false),
172+
this.next().read_expr(),
173173
"="
174174
);
175175
} else {
@@ -414,9 +414,9 @@ module.exports = {
414414
} else if (this.is("SCALAR")) {
415415
result = this.node();
416416
expr = this.read_scalar();
417-
if (expr.kind === 'array' && expr.shortForm && this.token === '=') {
417+
if (expr.kind === "array" && expr.shortForm && this.token === "=") {
418418
// list assign
419-
let list = this.node('list')(expr.items, true);
419+
let list = this.node("list")(expr.items, true);
420420
if (expr.loc) list.loc = expr.loc;
421421
let right = this.next().read_expr();
422422
return result("assign", list, right, "=");

src/parser/loops.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,8 @@ module.exports = {
122122
}
123123

124124
// grammatically correct but not supported by PHP
125-
if (key && key.kind === 'list') {
126-
this.raiseError(
127-
"Fatal Error : Cannot use list as key element"
128-
);
125+
if (key && key.kind === "list") {
126+
this.raiseError("Fatal Error : Cannot use list as key element");
129127
}
130128

131129
if (this.expect(")")) this.next();
@@ -141,7 +139,7 @@ module.exports = {
141139
/**
142140
* Reads a foreach variable statement
143141
* ```ebnf
144-
* foreach_variable =
142+
* foreach_variable =
145143
* variable |
146144
* '&' variable |
147145
* T_LIST '(' assignment_list ')' |
@@ -157,7 +155,7 @@ module.exports = {
157155
this.next();
158156
if (!isShort && this.expect("(")) this.next();
159157
const assignList = this.read_array_pair_list(isShort);
160-
if (this.expect(isShort ? "]": ")")) this.next();
158+
if (this.expect(isShort ? "]" : ")")) this.next();
161159
return result(assignList, isShort);
162160
} else {
163161
return this.read_variable(false, false, false);

0 commit comments

Comments
 (0)