|
30 | 30 | use Sabberworm\CSS\Value\URL; |
31 | 31 | use Sabberworm\CSS\Value\ValueList; |
32 | 32 |
|
| 33 | +use function Safe\file_get_contents; |
| 34 | +use function Safe\opendir; |
| 35 | + |
33 | 36 | /** |
34 | 37 | * @covers \Sabberworm\CSS\Parser |
35 | 38 | */ |
@@ -58,25 +61,26 @@ public function parseForOneDeclarationBlockReturnsDocumentWithOneDeclarationBloc |
58 | 61 | public function files(): void |
59 | 62 | { |
60 | 63 | $directory = __DIR__ . '/fixtures'; |
61 | | - if ($directoryHandle = \opendir($directory)) { |
62 | | - /* This is the correct way to loop over the directory. */ |
63 | | - while (false !== ($filename = \readdir($directoryHandle))) { |
64 | | - if (\strpos($filename, '.') === 0) { |
65 | | - continue; |
66 | | - } |
67 | | - if (\strrpos($filename, '.css') !== \strlen($filename) - \strlen('.css')) { |
68 | | - continue; |
69 | | - } |
70 | | - if (\strpos($filename, '-') === 0) { |
71 | | - // Either a file which SHOULD fail (at least in strict mode) |
72 | | - // or a future test of an as-of-now missing feature |
73 | | - continue; |
74 | | - } |
75 | | - $parser = new Parser(\file_get_contents($directory . '/' . $filename)); |
76 | | - self::assertNotSame('', $parser->parse()->render()); |
| 64 | + $directoryHandle = opendir($directory); |
| 65 | + |
| 66 | + /* This is the correct way to loop over the directory. */ |
| 67 | + while (false !== ($filename = \readdir($directoryHandle))) { |
| 68 | + if (\strpos($filename, '.') === 0) { |
| 69 | + continue; |
77 | 70 | } |
78 | | - \closedir($directoryHandle); |
| 71 | + if (\strrpos($filename, '.css') !== \strlen($filename) - \strlen('.css')) { |
| 72 | + continue; |
| 73 | + } |
| 74 | + if (\strpos($filename, '-') === 0) { |
| 75 | + // Either a file which SHOULD fail (at least in strict mode) |
| 76 | + // or a future test of an as-of-now missing feature |
| 77 | + continue; |
| 78 | + } |
| 79 | + $parser = new Parser(file_get_contents($directory . '/' . $filename)); |
| 80 | + self::assertNotSame('', $parser->parse()->render()); |
79 | 81 | } |
| 82 | + |
| 83 | + \closedir($directoryHandle); |
80 | 84 | } |
81 | 85 |
|
82 | 86 | /** |
@@ -943,7 +947,7 @@ public function missingPropertyValueLenient(): void |
943 | 947 | public static function parsedStructureForFile($filename, $settings = null): Document |
944 | 948 | { |
945 | 949 | $filename = __DIR__ . "/fixtures/$filename.css"; |
946 | | - $parser = new Parser(\file_get_contents($filename), $settings); |
| 950 | + $parser = new Parser(file_get_contents($filename), $settings); |
947 | 951 | return $parser->parse(); |
948 | 952 | } |
949 | 953 |
|
|
0 commit comments