diff --git a/.travis.yml b/.travis.yml index f2a60e2c..bf48be80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ matrix: env: DEPENDENCIES='low' - php: 7.1 - php: 7.2 + - php: 7.3 before_install: - composer self-update @@ -23,3 +24,4 @@ install: script: - ./bin/phpunit + - ./bin/php-cs-fixer fix -v --dry-run diff --git a/src/Matcher/Pattern/Expander/After.php b/src/Matcher/Pattern/Expander/After.php index 8369f68a..2cddeb9d 100644 --- a/src/Matcher/Pattern/Expander/After.php +++ b/src/Matcher/Pattern/Expander/After.php @@ -17,7 +17,7 @@ final class After implements PatternExpander public function __construct($boundary) - { + { if (false === \is_string($boundary)) { $this->error = \sprintf('After expander require "string", got "%s".', new StringConverter($boundary)); return false; diff --git a/src/Matcher/Pattern/Expander/Before.php b/src/Matcher/Pattern/Expander/Before.php index 5803d576..a0a10332 100644 --- a/src/Matcher/Pattern/Expander/Before.php +++ b/src/Matcher/Pattern/Expander/Before.php @@ -35,7 +35,7 @@ public static function is(string $name) : bool } public function match($value) : bool - { + { if (!\is_string($value)) { $this->error = \sprintf('Before expander require "string", got "%s".', new StringConverter($value)); return false; diff --git a/src/Matcher/Pattern/Expander/NotContains.php b/src/Matcher/Pattern/Expander/NotContains.php index ccdb36b8..d9f12b05 100644 --- a/src/Matcher/Pattern/Expander/NotContains.php +++ b/src/Matcher/Pattern/Expander/NotContains.php @@ -40,7 +40,7 @@ public function match($value) : bool : \mb_strpos($value, $this->string); if ($contains !== false) { - $this->error = \sprintf("String \"%s\" contains \"%s\".", $value, $this->string); + $this->error = \sprintf('String "%s" contains "%s".', $value, $this->string); return false; } diff --git a/src/Parser.php b/src/Parser.php index f3199b6e..c43e3e09 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -46,7 +46,7 @@ public function parse(string $pattern) : Pattern\TypePattern public function getAST(string $pattern) : AST\Pattern { - if($pattern === '') { + if ($pattern === '') { return new AST\Pattern(new AST\Type('')); } diff --git a/tests/Matcher/Pattern/Expander/NotContainsTest.php b/tests/Matcher/Pattern/Expander/NotContainsTest.php index 1dfdfef4..5bfe42b0 100644 --- a/tests/Matcher/Pattern/Expander/NotContainsTest.php +++ b/tests/Matcher/Pattern/Expander/NotContainsTest.php @@ -4,7 +4,6 @@ namespace Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander; -use Coduo\PHPMatcher\Matcher\Pattern\Expander\Contains; use Coduo\PHPMatcher\Matcher\Pattern\Expander\NotContains; use PHPUnit\Framework\TestCase; @@ -61,7 +60,7 @@ public function test_error_when_matching_fail($string, $value, $errorMessage) public static function invalidCasesProvider() { return [ - ['ipsum', 'lorem ipsum', "String \"lorem ipsum\" contains \"ipsum\"."], + ['ipsum', 'lorem ipsum', 'String "lorem ipsum" contains "ipsum".'], ['lorem', new \DateTime(), 'Not contains expander require "string", got "\\DateTime".'], ]; } diff --git a/tests/MatcherTest.php b/tests/MatcherTest.php index 449a1015..7998e0d0 100644 --- a/tests/MatcherTest.php +++ b/tests/MatcherTest.php @@ -360,7 +360,7 @@ public static function expanderExamples() ['lorem ipsum', '@string@.isUrl()', false], ['2014-08-19', '@string@.isDateTime()', true], ['3014-08-19', '@string@.before("today")', false], - ['1014-08-19', '@string@.before("+ 1day")', true], + ['1014-08-19', '@string@.before("+ 1day")', true], ['3014-08-19', '@string@.after("today")', true], ['1014-08-19', '@string@.after("+ 1day")', false], [100, '@integer@.lowerThan(101).greaterThan(10)', true],