Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 96c2873

Browse files
authored
Applied fixes from StyleCI (#39)
1 parent dd2f5f3 commit 96c2873

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+64
-73
lines changed

examples/builder/capture_group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
echo 'color: ' . $match->get('color') . "\n";
3030
}
3131
// color: green
32-
// color: yellow
32+
// color: yellow

examples/builder/email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
var_dump($regex->isMatching('email@example.com'));
2626
var_dump($regex->isMatching('invalid email@example.com'));
2727

28-
var_dump(preg_match($regex, 'sample@with.new.tlds'));
28+
var_dump(preg_match($regex, 'sample@with.new.tlds'));

examples/language/capture_group.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
use SRL\Builder;
43
use SRL\SRL;
54

65
require_once __DIR__ . '/../../vendor/autoload.php';
@@ -17,4 +16,4 @@
1716
echo 'color: ' . $match->get('color') . "\n";
1817
}
1918
// color: green
20-
// color: yellow
19+
// color: yellow

examples/language/email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
var_dump($regex->isMatching('email@example.com'));
1212
var_dump($regex->isMatching('invalid email@example.com'));
1313

14-
var_dump(preg_match($regex, 'sample@with.new.tlds'));
14+
var_dump(preg_match($regex, 'sample@with.new.tlds'));

src/Builder.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace SRL;
44

55
use Closure;
6-
use SRL\Builder\EitherOf;
76
use SRL\Builder\Capture;
7+
use SRL\Builder\EitherOf;
88
use SRL\Builder\NegativeLookahead;
99
use SRL\Builder\NegativeLookbehind;
1010
use SRL\Builder\NonCapture;
@@ -184,7 +184,6 @@ public function literally(string $chars) : self
184184
return $this->add('(?:' . implode('', array_map([$this, 'escape'], str_split($chars))) . ')');
185185
}
186186

187-
188187
/**
189188
* Match any digit (in given span). Default will be a digit between 0 and 9.
190189
*
@@ -288,11 +287,11 @@ public function group($conditions) : self
288287
* @param Closure|Builder|string $conditions Anonymous function with its Builder as a first parameter.
289288
* @return Builder
290289
*/
291-
public function and ($conditions) : self
290+
public function and($conditions) : self
292291
{
293292
$this->validateAndAddMethodType(self::METHOD_TYPE_GROUP, self::METHOD_TYPES_ALLOWED_FOR_CHARACTERS);
294293

295-
return $this->addClosure(new Builder, $conditions);
294+
return $this->addClosure(new self, $conditions);
296295
}
297296

298297
/**
@@ -469,8 +468,8 @@ public function lazy() : self
469468
/**
470469
* Apply laziness to last match.
471470
*
472-
* @return Builder
473471
* @throws ImplementationException
472+
* @return Builder
474473
*/
475474
public function firstMatch() : self
476475
{
@@ -599,8 +598,8 @@ protected function validateAndAddMethodType(int $type, int $allowed, string $met
599598
* Add the value from the simple mapper array to the regular expression.
600599
*
601600
* @param string $name
602-
* @return Builder
603601
* @throws BuilderException
602+
* @return Builder
604603
*/
605604
protected function addFromMapper(string $name) : self
606605
{
@@ -644,7 +643,7 @@ protected function addClosure(Builder $builder, $conditions) : self
644643
if (is_string($conditions)) {
645644
// Assuming literal characters if conditions are of type string
646645
$builder->literally($conditions);
647-
} elseif ($conditions instanceof Builder) {
646+
} elseif ($conditions instanceof self) {
648647
$builder->raw($conditions->get(''));
649648
} else {
650649
$conditions($builder);
@@ -664,7 +663,7 @@ protected function revertLast()
664663
}
665664

666665
/**
667-
* @inheritdoc
666+
* {@inheritdoc}
668667
*/
669668
public function get(string $delimiter = '/', bool $ignoreInvalid = false) : string
670669
{
@@ -687,8 +686,6 @@ public function get(string $delimiter = '/', bool $ignoreInvalid = false) : stri
687686
return $regEx;
688687
}
689688

690-
691-
692689
/**********************************************************/
693690
/* MAGIC METHODS */
694691
/**********************************************************/
@@ -698,8 +695,8 @@ public function get(string $delimiter = '/', bool $ignoreInvalid = false) : stri
698695
*
699696
* @param $name
700697
* @param $arguments
701-
* @return Builder
702698
* @throws ImplementationException
699+
* @return Builder
703700
*/
704701
public function __call($name, $arguments) : self
705702
{
@@ -730,4 +727,4 @@ public function __toString() : string
730727
{
731728
return $this->get();
732729
}
733-
}
730+
}

src/Builder/Capture.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function setName(string $name)
1818
{
1919
$this->group = "(?<$name>%s)";
2020
}
21-
}
21+
}

src/Builder/EitherOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class EitherOf extends Builder
1111

1212
/** @var string String to implode with. */
1313
protected $implodeString = '|';
14-
}
14+
}

src/Builder/NegativeLookahead.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class NegativeLookahead extends Builder
88
{
99
/** @var string Desired lookahead group. */
1010
protected $group = '(?!%s)';
11-
}
11+
}

src/Builder/NegativeLookbehind.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class NegativeLookbehind extends Builder
88
{
99
/** @var string Desired lookbehind group. */
1010
protected $group = '(?<!%s)';
11-
}
11+
}

src/Builder/NonCapture.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class NonCapture extends Builder
88
{
99
/** @var string Desired non capture group. */
1010
protected $group = '(?:%s)';
11-
}
11+
}

0 commit comments

Comments
 (0)