Skip to content

Commit fb88c73

Browse files
committed
Converted double to single quotes in simple strings
1 parent 5da0bcb commit fb88c73

Some content is hidden

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

66 files changed

+428
-426
lines changed

.php_cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ return PhpCsFixer\Config::create()
66
'array_syntax' => ['syntax' => 'short'],
77
'blank_line_after_opening_tag' => true,
88
'single_blank_line_before_namespace' => true,
9-
'no_unused_imports' => true
9+
'no_unused_imports' => true,
10+
'single_quote' => true
1011
])
1112
->setFinder(
1213
PhpCsFixer\Finder::create()

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/coduo/php-matcher/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/coduo/php-matcher/?branch=master)
66

7-
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg)](https://travis-ci.org/coduo/php-matcher) - master (3.0.*)
7+
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg)](https://travis-ci.org/coduo/php-matcher) - master (3.1.*)
8+
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg?branch=3.0)](https://travis-ci.org/coduo/php-matcher) - 3.0.*
89
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg?branch=2.2)](https://travis-ci.org/coduo/php-matcher) - 2.2.*
910
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg?branch=2.1)](https://travis-ci.org/coduo/php-matcher) - 2.1.*
1011
* [![Build Status](https://travis-ci.org/coduo/php-matcher.svg?branch=2.0)](https://travis-ci.org/coduo/php-matcher) - 2.0.*
1112

12-
[Readme for master (3.0) version](https://github.com/coduo/php-matcher/tree/master/README.md)
13+
[Readme for master (3.1) version](https://github.com/coduo/php-matcher/tree/master/README.md)
14+
[Readme for 3.0 version](https://github.com/coduo/php-matcher/tree/3.0/README.md)
1315
[Readme for 2.2 version](https://github.com/coduo/php-matcher/tree/2.2/README.md)
1416
[Readme for 2.1 version](https://github.com/coduo/php-matcher/tree/2.1/README.md)
1517
[Readme for 2.0 version](https://github.com/coduo/php-matcher/tree/2.0/README.md)
@@ -100,7 +102,7 @@ $factory = new SimpleFactory();
100102
$matcher = $factory->createMatcher();
101103

102104
$matcher->match(1, 1);
103-
$matcher->match('string', 'string')
105+
$matcher->match('string', 'string');
104106
```
105107

106108
### String matching
@@ -114,7 +116,7 @@ $factory = new SimpleFactory();
114116
$matcher = $factory->createMatcher();
115117

116118
$matcher->match('Norbert', '@string@');
117-
$matcher->match("lorem ipsum dolor", "@[email protected]('lorem').contains('ipsum').endsWith('dolor')")
119+
$matcher->match("lorem ipsum dolor", "@[email protected]('lorem').contains('ipsum').endsWith('dolor')");
118120

119121
```
120122

@@ -188,12 +190,12 @@ use Coduo\PHPMatcher\Factory\SimpleFactory;
188190
$factory = new SimpleFactory();
189191
$matcher = $factory->createMatcher();
190192

191-
$matcher->match("@integer@", "@*@"),
192-
$matcher->match("foobar", "@*@"),
193-
$matcher->match(true, "@*@"),
194-
$matcher->match(6.66, "@*@"),
195-
$matcher->match(array("bar"), "@wildcard@"),
196-
$matcher->match(new \stdClass, "@wildcard@"),
193+
$matcher->match("@integer@", "@*@");
194+
$matcher->match("foobar", "@*@");
195+
$matcher->match(true, "@*@");
196+
$matcher->match(6.66, "@*@");
197+
$matcher->match(array("bar"), "@wildcard@");
198+
$matcher->match(new \stdClass, "@wildcard@");
197199
```
198200

199201
### Expression matching
@@ -279,7 +281,7 @@ $matcher->match(
279281
'@boolean@',
280282
'@double@'
281283
)
282-
)
284+
);
283285
```
284286

285287
### Json matching
@@ -313,8 +315,7 @@ $matcher->match(
313315
}
314316
]
315317
}'
316-
)
317-
318+
);
318319
```
319320

320321
### Xml matching

src/Exception/UnknownTypeException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class UnknownTypeException extends Exception
1010

1111
public function __construct(string $type)
1212
{
13-
$this->type = "@" . $type . "@";
14-
parent::__construct(sprintf("Type pattern \"%s\" is not supported.", $this->type), 0, null);
13+
$this->type = '@' . $type . '@';
14+
parent::__construct(sprintf('Type pattern "%s" is not supported.', $this->type), 0, null);
1515
}
1616

1717
public function getType() : string

src/Lexer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ final class Lexer extends AbstractLexer
2727
protected function getCatchablePatterns() : array
2828
{
2929
return [
30-
"\\.?[a-zA-Z0-9_]+\\(", // expander name
31-
"[a-zA-Z0-9.]*", // words
32-
"\\-?[0-9]*\\.?[0-9]*", // numbers
30+
'\\.?[a-zA-Z0-9_]+\\(', // expander name
31+
'[a-zA-Z0-9.]*', // words
32+
'\\-?[0-9]*\\.?[0-9]*', // numbers
3333
"'(?:[^']|'')*'", // string between ' character
34-
"\"(?:[^\"]|\"\")*\"", // string between " character,
35-
"@[a-zA-Z0-9\\*]+@", // type pattern
34+
'"(?:[^"]|"")*"', // string between " character,
35+
'@[a-zA-Z0-9\\*]+@', // type pattern
3636
];
3737
}
3838

@@ -42,7 +42,7 @@ protected function getCatchablePatterns() : array
4242
protected function getNonCatchablePatterns() : array
4343
{
4444
return [
45-
"\\s+",
45+
'\\s+',
4646
];
4747
}
4848

@@ -107,7 +107,7 @@ protected function getType(&$value) : int
107107

108108
protected function isStringToken(string $value) : bool
109109
{
110-
return in_array(substr($value, 0, 1), ["\"", "'"]);
110+
return in_array(substr($value, 0, 1), ['"', "'"]);
111111
}
112112

113113
protected function isBooleanToken(string $value) : bool

src/Matcher/ArrayMatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function match($value, $pattern) : bool
3535
}
3636

3737
if (!is_array($value)) {
38-
$this->error = sprintf("%s \"%s\" is not a valid array.", gettype($value), new StringConverter($value));
38+
$this->error = sprintf('%s "%s" is not a valid array.', gettype($value), new StringConverter($value));
3939
return false;
4040
}
4141

@@ -64,7 +64,7 @@ private function isArrayPattern($pattern) : bool
6464
return $this->parser->hasValidSyntax($pattern) && $this->parser->parse($pattern)->is(self::PATTERN);
6565
}
6666

67-
private function iterateMatch(array $values, array $patterns, string $parentPath = "") : bool
67+
private function iterateMatch(array $values, array $patterns, string $parentPath = '') : bool
6868
{
6969
$pattern = null;
7070
foreach ($values as $key => $value) {
@@ -222,12 +222,12 @@ private function setMissingElementInError(string $place, string $path)
222222

223223
private function formatAccessPath($key) : string
224224
{
225-
return sprintf("[%s]", $key);
225+
return sprintf('[%s]', $key);
226226
}
227227

228228
private function formatFullPath(string $parentPath, string $path) : string
229229
{
230-
return sprintf("%s%s", $parentPath, $path);
230+
return sprintf('%s%s', $parentPath, $path);
231231
}
232232

233233
private function shouldSkippValueMatchingFor($lastPattern) : bool

src/Matcher/BooleanMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(Parser $parser)
2121
public function match($value, $pattern) : bool
2222
{
2323
if (!is_bool($value)) {
24-
$this->error = sprintf("%s \"%s\" is not a valid boolean.", gettype($value), new StringConverter($value));
24+
$this->error = sprintf('%s "%s" is not a valid boolean.', gettype($value), new StringConverter($value));
2525
return false;
2626
}
2727

src/Matcher/DoubleMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(Parser $parser)
2121
public function match($value, $pattern) : bool
2222
{
2323
if (!is_double($value)) {
24-
$this->error = sprintf("%s \"%s\" is not a valid double.", gettype($value), new StringConverter($value));
24+
$this->error = sprintf('%s "%s" is not a valid double.', gettype($value), new StringConverter($value));
2525
return false;
2626
}
2727

src/Matcher/ExpressionMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function match($value, $pattern) : bool
1818
$expressionResult = $language->evaluate($matches[1], ['value' => $value]);
1919

2020
if (!$expressionResult) {
21-
$this->error = sprintf("\"%s\" expression fails for value \"%s\".", $pattern, new StringConverter($value));
21+
$this->error = sprintf('"%s" expression fails for value "%s".', $pattern, new StringConverter($value));
2222
}
2323

2424
return (bool) $expressionResult;

src/Matcher/IntegerMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(Parser $parser)
2121
public function match($value, $pattern) : bool
2222
{
2323
if (!is_integer($value)) {
24-
$this->error = sprintf("%s \"%s\" is not a valid integer.", gettype($value), new StringConverter($value));
24+
$this->error = sprintf('%s "%s" is not a valid integer.', gettype($value), new StringConverter($value));
2525
return false;
2626
}
2727

src/Matcher/JsonMatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public function match($value, $pattern) : bool
2222
}
2323

2424
if (!Json::isValid($value)) {
25-
$this->error = sprintf("Invalid given JSON of value. %s", $this->getErrorMessage());
25+
$this->error = sprintf('Invalid given JSON of value. %s', $this->getErrorMessage());
2626
return false;
2727
}
2828

2929
if (!Json::isValidPattern($pattern)) {
30-
$this->error = sprintf("Invalid given JSON of pattern. %s", $this->getErrorMessage());
30+
$this->error = sprintf('Invalid given JSON of pattern. %s', $this->getErrorMessage());
3131
return false;
3232
}
3333

0 commit comments

Comments
 (0)