diff --git a/src/CodeCoverage/Generators/AbstractGenerator.php b/src/CodeCoverage/Generators/AbstractGenerator.php index 3a0d1cb0..e40aaa34 100644 --- a/src/CodeCoverage/Generators/AbstractGenerator.php +++ b/src/CodeCoverage/Generators/AbstractGenerator.php @@ -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), ); } diff --git a/src/Framework/Assert.php b/src/Framework/Assert.php index d8410cb6..9340fbba 100644 --- a/src/Framework/Assert.php +++ b/src/Framework/Assert.php @@ -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 ]; @@ -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 ]; diff --git a/src/Framework/Dumper.php b/src/Framework/Dumper.php index 17700edd..83d4b255 100644 --- a/src/Framework/Dumper.php +++ b/src/Framework/Dumper.php @@ -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, '"$') . '"'; } @@ -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); diff --git a/src/Framework/Helpers.php b/src/Framework/Helpers.php index 9d4c0376..0092fce8 100644 --- a/src/Framework/Helpers.php +++ b/src/Framework/Helpers.php @@ -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.'); } diff --git a/src/Runner/Runner.php b/src/Runner/Runner.php index 9a768063..3a82e337 100644 --- a/src/Runner/Runner.php +++ b/src/Runner/Runner.php @@ -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()), ); } diff --git a/tests/Framework/Assert.match.phpt b/tests/Framework/Assert.match.phpt index d26da522..582b1717 100644 --- a/tests/Framework/Assert.match.phpt +++ b/tests/Framework/Assert.match.phpt @@ -40,10 +40,10 @@ $matches = [ ['%f%', '-1e5'], ['%h%', 'aBcDeF01'], ['%w%', 'aBzZ_01'], - ['%ds%%ds%', '\\/'], + ['%ds%%ds%', '\/'], ['%[a-c]+%', 'abc'], ['%[]%', '%[]%'], - ['.\\+*?[^]$(){}=!<>|:-#', '.\\+*?[^]$(){}=!<>|:-#'], + ['.\+*?[^]$(){}=!<>|:-#', '.\+*?[^]$(){}=!<>|:-#'], ['~\d+~', '123'], ['#\d+#', '123'], ]; diff --git a/tests/Framework/Dumper.toPhp.phpt b/tests/Framework/Dumper.toPhp.phpt index 364e4f7f..e0525d40 100644 --- a/tests/Framework/Dumper.toPhp.phpt +++ b/tests/Framework/Dumper.toPhp.phpt @@ -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( @@ -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)); diff --git a/tests/Framework/TestCase.annotationThrows.phpt b/tests/Framework/TestCase.annotationThrows.phpt index 2b88b923..625f9556 100644 --- a/tests/Framework/TestCase.annotationThrows.phpt +++ b/tests/Framework/TestCase.annotationThrows.phpt @@ -96,7 +96,7 @@ class MyTest extends Tester\TestCase /** - * @dataprovider dataProvider + * @dataProvider dataProvider * @throws Exception */ public function testThrowsWithDataprovider($x)