Skip to content

Commit c2190bd

Browse files
committed
Automated code cleanup
1 parent 901bc94 commit c2190bd

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/DotNotationParser.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
class DotNotationParser {
1313

1414
/**
15-
* @param string $path
1615
* @return string[]
1716
*/
1817
public function parse( string $path ) : array {
1918
$out = [];
2019
$chars = preg_split('/(?<!^)(?!$)/u', $path, -1, PREG_SPLIT_NO_EMPTY) ?: [];
2120

22-
for( ; ; ) {
21+
for(;;) {
2322
$token = current($chars);
2423
if( $token === false ) {
2524
break;
@@ -49,7 +48,7 @@ public function parse( string $path ) : array {
4948
*/
5049
private function scanString( array &$chars ) : string {
5150
$buff = '';
52-
for( ; ; ) {
51+
for(;;) {
5352
$token = current($chars);
5453
if( $token === false || $token === '.' ) {
5554
next($chars);
@@ -71,7 +70,7 @@ private function scanQuotedString( array &$chars ) : string {
7170
$buff = '';
7271

7372
next($chars);
74-
for( ; ; ) {
73+
for(;;) {
7574
$token = current($chars);
7675
if( $token === false ) {
7776
throw new ParseException(
@@ -80,6 +79,7 @@ private function scanQuotedString( array &$chars ) : string {
8079
ParseException::CODE_UNEXPECTED_EOF
8180
);
8281
}
82+
8383
if( $token === '"' ) {
8484
$next = next($chars);
8585
if( $next === false || $next === '.' ) {

src/Exceptions/ParseException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParseException extends \InvalidArgumentException {
99

1010
private $charIndex;
1111

12-
public function __construct( $message, int $charIndex, $code, \Throwable $previous = null ) {
12+
public function __construct( $message, int $charIndex, $code, ?\Throwable $previous = null ) {
1313
parent::__construct($message, $code, $previous);
1414

1515
$this->charIndex = $charIndex;

test/Quorum/DotNotation/DotNotationParserTest.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class DotNotationParserTest extends TestCase {
99

1010
/**
1111
* @dataProvider parseProvider
12-
* @param string $path
1312
* @param string[] $result
1413
*/
1514
public function testParse( string $path, array $result ) : void {
@@ -23,9 +22,13 @@ public function testParse( string $path, array $result ) : void {
2322

2423
public function parseProvider() : \Generator {
2524
yield [ 'foo.bar.baz', [ 'foo', 'bar', 'baz' ] ];
25+
2626
yield [ 'foo."bar.baz"', [ 'foo', 'bar.baz' ] ];
27+
2728
yield [ 'foo.bar"baz".2', [ 'foo', 'bar"baz"', '2' ] ];
29+
2830
yield [ 'foo.bar.baz.', [ 'foo', 'bar', 'baz' ] ];
31+
2932
yield [ '日.本.語', [ '', '', '' ] ];
3033
}
3134

@@ -47,8 +50,12 @@ public function testUnexpectedCharacters( string $path, int $pos ) : void {
4750

4851
public function unexpectedCharacterProvider() : \Generator {
4952
yield [ 'foo."bar', 8 ];
53+
5054
yield [ 'a.foo."bar"baz', 11 ];
55+
5156
yield [ '.foo', 0 ];
57+
5258
yield [ '.', 0 ];
5359
}
60+
5461
}

0 commit comments

Comments
 (0)