Skip to content

Commit 44ba53e

Browse files
authored
CS Fixes & additional validation during tests (#145)
* CS Fixes & additional validation during tests * Added php 7.3
1 parent fc2a8be commit 44ba53e

File tree

7 files changed

+8
-7
lines changed

7 files changed

+8
-7
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ matrix:
1212
env: DEPENDENCIES='low'
1313
- php: 7.1
1414
- php: 7.2
15+
- php: 7.3
1516

1617
before_install:
1718
- composer self-update
@@ -23,3 +24,4 @@ install:
2324

2425
script:
2526
- ./bin/phpunit
27+
- ./bin/php-cs-fixer fix -v --dry-run

src/Matcher/Pattern/Expander/After.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class After implements PatternExpander
1717

1818

1919
public function __construct($boundary)
20-
{
20+
{
2121
if (false === \is_string($boundary)) {
2222
$this->error = \sprintf('After expander require "string", got "%s".', new StringConverter($boundary));
2323
return false;

src/Matcher/Pattern/Expander/Before.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function is(string $name) : bool
3535
}
3636

3737
public function match($value) : bool
38-
{
38+
{
3939
if (!\is_string($value)) {
4040
$this->error = \sprintf('Before expander require "string", got "%s".', new StringConverter($value));
4141
return false;

src/Matcher/Pattern/Expander/NotContains.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function match($value) : bool
4040
: \mb_strpos($value, $this->string);
4141

4242
if ($contains !== false) {
43-
$this->error = \sprintf("String \"%s\" contains \"%s\".", $value, $this->string);
43+
$this->error = \sprintf('String "%s" contains "%s".', $value, $this->string);
4444

4545
return false;
4646
}

src/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function parse(string $pattern) : Pattern\TypePattern
4646

4747
public function getAST(string $pattern) : AST\Pattern
4848
{
49-
if($pattern === '') {
49+
if ($pattern === '') {
5050
return new AST\Pattern(new AST\Type(''));
5151
}
5252

tests/Matcher/Pattern/Expander/NotContainsTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander;
66

7-
use Coduo\PHPMatcher\Matcher\Pattern\Expander\Contains;
87
use Coduo\PHPMatcher\Matcher\Pattern\Expander\NotContains;
98
use PHPUnit\Framework\TestCase;
109

@@ -61,7 +60,7 @@ public function test_error_when_matching_fail($string, $value, $errorMessage)
6160
public static function invalidCasesProvider()
6261
{
6362
return [
64-
['ipsum', 'lorem ipsum', "String \"lorem ipsum\" contains \"ipsum\"."],
63+
['ipsum', 'lorem ipsum', 'String "lorem ipsum" contains "ipsum".'],
6564
['lorem', new \DateTime(), 'Not contains expander require "string", got "\\DateTime".'],
6665
];
6766
}

tests/MatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public static function expanderExamples()
360360
['lorem ipsum', '@[email protected]()', false],
361361
['2014-08-19', '@[email protected]()', true],
362362
['3014-08-19', '@[email protected]("today")', false],
363-
['1014-08-19', '@[email protected]("+ 1day")', true],
363+
['1014-08-19', '@[email protected]("+ 1day")', true],
364364
['3014-08-19', '@[email protected]("today")', true],
365365
['1014-08-19', '@[email protected]("+ 1day")', false],
366366
[100, '@[email protected](101).greaterThan(10)', true],

0 commit comments

Comments
 (0)