Skip to content

Commit 98067f3

Browse files
committed
no need to return $this if preceding method call returns $this
1 parent ad99e50 commit 98067f3

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

VerbalExpressions.php

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ public function endOfLine($enable = true)
116116
*/
117117
public function then($value)
118118
{
119-
$this->add("(".$this->sanitize($value).")");
120-
return $this;
119+
return $this->add("(".$this->sanitize($value).")");
121120
}
122121

123122
/**
@@ -140,8 +139,7 @@ public function find($value)
140139
*/
141140
public function maybe($value)
142141
{
143-
$this->add("(".$this->sanitize($value).")?");
144-
return $this;
142+
return $this->add("(".$this->sanitize($value).")?");
145143
}
146144

147145
/**
@@ -154,8 +152,7 @@ public function maybe($value)
154152
*/
155153
public function anything()
156154
{
157-
$this->add("(.*)");
158-
return $this;
155+
return $this->add("(.*)");
159156
}
160157

161158
/**
@@ -169,8 +166,7 @@ public function anything()
169166
*/
170167
public function anythingBut($value)
171168
{
172-
$this->add("([^". $this->sanitize($value) ."]*)");
173-
return $this;
169+
return $this->add("([^". $this->sanitize($value) ."]*)");
174170
}
175171

176172
/**
@@ -183,8 +179,7 @@ public function anythingBut($value)
183179
*/
184180
public function something()
185181
{
186-
$this->add("(.+)");
187-
return $this;
182+
return $this->add("(.+)");
188183
}
189184

190185
/**
@@ -198,8 +193,7 @@ public function something()
198193
*/
199194
public function somethingBut($value)
200195
{
201-
$this->add("([^". $this->sanitize($value) ."]+)");
202-
return $this;
196+
return $this->add("([^". $this->sanitize($value) ."]+)");
203197
}
204198

205199
/**
@@ -233,8 +227,7 @@ public function replace($source, $value)
233227
*/
234228
public function lineBreak()
235229
{
236-
$this->add("(\\n|(\\r\\n))");
237-
return $this;
230+
return $this->add("(\\n|(\\r\\n))");
238231
}
239232

240233
/**
@@ -260,8 +253,7 @@ public function br()
260253
*/
261254
public function tab()
262255
{
263-
$this->add("\\t");
264-
return $this;
256+
return $this->add("\\t");
265257
}
266258

267259
/**
@@ -274,8 +266,7 @@ public function tab()
274266
*/
275267
public function word()
276268
{
277-
$this->add("\\w+");
278-
return $this;
269+
return $this->add("\\w+");
279270
}
280271

281272
/**
@@ -289,8 +280,7 @@ public function word()
289280
*/
290281
public function anyOf($value)
291282
{
292-
$this->add("[". $value ."]");
293-
return $this;
283+
return $this->add("[". $value ."]");
294284
}
295285

296286
/**
@@ -334,9 +324,7 @@ public function range()
334324

335325
$value .= "]";
336326

337-
$this->add($value);
338-
339-
return $this;
327+
return $this->add($value);
340328
}
341329

342330
/**
@@ -460,9 +448,7 @@ public function multiple($value)
460448
break;
461449
}
462450

463-
$this->add($value);
464-
465-
return $this;
451+
return $this->add($value);
466452
}
467453

468454
/**

0 commit comments

Comments
 (0)