Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 16, 2025
1 parent c426b8d commit 7907dcb
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/CodeCoverage/Generators/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function getSourceIterator(): \Iterator
return new \CallbackFilterIterator(
$iterator,
fn(\SplFileInfo $file): bool => $file->getBasename()[0] !== '.' // . or .. or .gitignore
&& in_array($file->getExtension(), $this->acceptFiles, true)
&& in_array($file->getExtension(), $this->acceptFiles, true),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Assert
'%f%' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', // floating point number
'%h%' => '[0-9a-fA-F]+', // one or more HEX digits
'%w%' => '[0-9a-zA-Z_]+', //one or more alphanumeric characters
'%ds%' => '[\\\\/]', // directory separator
'%ds%' => '[\\\/]', // directory separator
'%(\[.+\][+*?{},\d]*)%' => '$1', // range
];

Expand Down Expand Up @@ -517,7 +517,7 @@ public static function isMatching(string $pattern, string $actual, bool $strict
$utf8 = preg_match('#\x80-\x{10FFFF}]#u', $pattern) ? 'u' : '';
$suffix = ($strict ? '$#DsU' : '\s*$#sU') . $utf8;
$patterns = static::$patterns + [
'[.\\\\+*?[^$(){|\#]' => '\$0', // preg quoting
'[.\\\+*?[^$(){|\#]' => '\$0', // preg quoting
'\x00' => '\x00',
'[\t ]*\r?\n' => '[\t ]*\r?\n', // right trim
];
Expand Down
6 changes: 3 additions & 3 deletions src/Framework/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ private static function encodeStringPhp(string $s): string
];
$utf8 = preg_match('##u', $s);
$escaped = preg_replace_callback(
$utf8 ? '#[\p{C}\\\\]#u' : '#[\x00-\x1F\x7F-\xFF\\\\]#',
$utf8 ? '#[\p{C}\\\]#u' : '#[\x00-\x1F\x7F-\xFF\\\]#',
fn($m) => $special[$m[0]] ?? (strlen($m[0]) === 1
? '\x' . str_pad(strtoupper(dechex(ord($m[0]))), 2, '0', STR_PAD_LEFT) . ''
: '\u{' . strtoupper(ltrim(dechex(self::utf8Ord($m[0])), '0')) . '}'),
$s,
);
return $s === str_replace('\\\\', '\\', $escaped)
? "'" . preg_replace('#\'|\\\\(?=[\'\\\\]|$)#D', '\\\\$0', $s) . "'"
? "'" . preg_replace('#\'|\\\(?=[\'\\\]|$)#D', '\\\$0', $s) . "'"
: '"' . addcslashes($escaped, '"$') . '"';
}

Expand All @@ -255,7 +255,7 @@ private static function encodeStringLine(string $s): string
"\r" => "\\r\r",
"\n" => "\\n\n",
"\t" => "\\t\t",
"\e" => '\\e',
"\e" => '\e',
"'" => "'",
];
$utf8 = preg_match('##u', $s);
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Helpers
*/
public static function purge(string $dir): void
{
if (preg_match('#^(\w:)?[/\\\\]?$#', $dir)) {
if (preg_match('#^(\w:)?[/\\\]?$#', $dir)) {
throw new \InvalidArgumentException('Directory must not be an empty string or root path.');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Runner/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function run(): bool
if ($this->tempDir) {
usort(
$this->jobs,
fn(Job $a, Job $b): int => $this->getLastResult($a->getTest()) - $this->getLastResult($b->getTest())
fn(Job $a, Job $b): int => $this->getLastResult($a->getTest()) - $this->getLastResult($b->getTest()),
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Framework/Assert.match.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ $matches = [
['%f%', '-1e5'],
['%h%', 'aBcDeF01'],
['%w%', 'aBzZ_01'],
['%ds%%ds%', '\\/'],
['%ds%%ds%', '\/'],
['%[a-c]+%', 'abc'],
['%[]%', '%[]%'],
['.\\+*?[^]$(){}=!<>|:-#', '.\\+*?[^]$(){}=!<>|:-#'],
['.\+*?[^]$(){}=!<>|:-#', '.\+*?[^]$(){}=!<>|:-#'],
['~\d+~', '123'],
['#\d+#', '123'],
];
Expand Down
8 changes: 4 additions & 4 deletions tests/Framework/Dumper.toPhp.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Assert::match('0.1', Dumper::toPhp(0.1));
Assert::match("''", Dumper::toPhp(''));
Assert::match("' '", Dumper::toPhp(' '));
Assert::match("'0'", Dumper::toPhp('0'));
Assert::match('"\\x00"', Dumper::toPhp("\x00"));
Assert::match('"\x00"', Dumper::toPhp("\x00"));
Assert::match('"\u{FEFF}"', Dumper::toPhp("\xEF\xBB\xBF")); // BOM
Assert::match("' '", Dumper::toPhp("\t"));
Assert::match('"\\xFF"', Dumper::toPhp("\xFF"));
Assert::match('"\xFF"', Dumper::toPhp("\xFF"));
Assert::match('"multi\nline"', Dumper::toPhp("multi\nline"));
Assert::match("'Iñtërnâtiônàlizætiøn'", Dumper::toPhp("I\xc3\xb1t\xc3\xabrn\xc3\xa2ti\xc3\xb4n\xc3\xa0liz\xc3\xa6ti\xc3\xb8n"));
Assert::match(
Expand All @@ -48,8 +48,8 @@ Assert::match(
);

Assert::match('\'$"\\\\\'', Dumper::toPhp('$"\\'));
Assert::match('\'$"\\ \x00\'', Dumper::toPhp('$"\\ \x00'));
Assert::match('"\\$\\"\\\\ \x00"', Dumper::toPhp("$\"\\ \x00"));
Assert::match('\'$"\ \x00\'', Dumper::toPhp('$"\ \x00'));
Assert::match('"\$\"\\\ \x00"', Dumper::toPhp("$\"\\ \x00"));

Assert::match('/* resource stream */', Dumper::toPhp(fopen(__FILE__, 'r')));
Assert::match('(object) /* #%a% */ []', Dumper::toPhp((object) null));
Expand Down
2 changes: 1 addition & 1 deletion tests/Framework/TestCase.annotationThrows.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MyTest extends Tester\TestCase


/**
* @dataprovider dataProvider
* @dataProvider dataProvider
* @throws Exception
*/
public function testThrowsWithDataprovider($x)
Expand Down

0 comments on commit 7907dcb

Please sign in to comment.