Skip to content

Commit f2583a1

Browse files
[TASK] Fix codestyle according to updated PHP-CS-Fixer ruleset
1 parent a86b7c6 commit f2583a1

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

src/Filesystem/Directory.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
namespace TYPO3\Tailor\Filesystem;
1414

15-
use FilesystemIterator;
16-
use RecursiveDirectoryIterator;
17-
use RecursiveIteratorIterator;
18-
1915
/**
2016
* Provide functionality for handling directories on the filesystem
2117
*/
@@ -42,9 +38,9 @@ public function create(string $path, int $mode = 0777): bool
4238
public function remove(string $directory): bool
4339
{
4440
$directory = realpath($directory);
45-
$iterator = new RecursiveIteratorIterator(
46-
new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS),
47-
RecursiveIteratorIterator::CHILD_FIRST
41+
$iterator = new \RecursiveIteratorIterator(
42+
new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS),
43+
\RecursiveIteratorIterator::CHILD_FIRST
4844
);
4945

5046
foreach ($iterator as $file) {

src/Filesystem/VersionReplacer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function setVersion(string $filePath, string $pattern, int $versionPartsT
4343
if ($fileContents === false) {
4444
throw new \InvalidArgumentException('The file ' . $filePath . ' could not be opened', 1605741968);
4545
}
46-
$updatedFileContents = preg_replace_callback('/' . $pattern . '/u', static function($matches) use ($newVersion) {
46+
$updatedFileContents = preg_replace_callback('/' . $pattern . '/u', static function ($matches) use ($newVersion) {
4747
return str_replace($matches[1], $newVersion, $matches[0]);
4848
}, $fileContents);
4949
file_put_contents($filePath, $updatedFileContents);

src/Service/VersionService.php

+7-11
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
namespace TYPO3\Tailor\Service;
1414

15-
use FilesystemIterator;
16-
use RecursiveCallbackFilterIterator;
17-
use RecursiveDirectoryIterator;
18-
use RecursiveIteratorIterator;
1915
use TYPO3\Tailor\Environment\Variables;
2016
use TYPO3\Tailor\Exception\FormDataProcessingException;
2117
use TYPO3\Tailor\Exception\RequiredConfigurationMissing;
@@ -64,14 +60,14 @@ public function createZipArchiveFromPath(string $path): string
6460
throw new FormDataProcessingException('Path is not valid.', 1605562741);
6561
}
6662

67-
$zipArchive = new ZipArchive();
68-
$zipArchive->open($this->getVersionFilename(), ZipArchive::CREATE | ZipArchive::OVERWRITE);
63+
$zipArchive = new \ZipArchive();
64+
$zipArchive->open($this->getVersionFilename(), \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
6965

7066
$emConfValid = false;
7167

72-
$iterator = new RecursiveDirectoryIterator($fullPath, FilesystemIterator::SKIP_DOTS);
73-
$files = new RecursiveIteratorIterator(
74-
new RecursiveCallbackFilterIterator($iterator, function($current) use ($fullPath) {
68+
$iterator = new \RecursiveDirectoryIterator($fullPath, \FilesystemIterator::SKIP_DOTS);
69+
$files = new \RecursiveIteratorIterator(
70+
new \RecursiveCallbackFilterIterator($iterator, function ($current) use ($fullPath) {
7571
// @todo Find a more performant way for filtering
7672

7773
$filepath = $current->getRealPath();
@@ -101,7 +97,7 @@ public function createZipArchiveFromPath(string $path): string
10197

10298
return true;
10399
}),
104-
RecursiveIteratorIterator::LEAVES_ONLY
100+
\RecursiveIteratorIterator::LEAVES_ONLY
105101
);
106102

107103
foreach ($files as $file) {
@@ -157,7 +153,7 @@ public function createZipArchiveFromArtefact(string $filename): string
157153
if (!is_file($filename)) {
158154
throw new FormDataProcessingException('No such file.', 1605562482);
159155
}
160-
$zipArchive = new ZipArchive();
156+
$zipArchive = new \ZipArchive();
161157
$zipFile = $zipArchive->open($filename);
162158
if (!$zipFile || $zipArchive->numFiles <= 0) {
163159
throw new FormDataProcessingException('No files in given directory.', 1605562663);

tests/Unit/Service/VersionServiceTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace TYPO3\Tailor\Tests\Unit\Service;
1414

1515
use PHPUnit\Framework\TestCase;
16-
use ReflectionMethod;
1716
use TYPO3\Tailor\Exception\RequiredConfigurationMissing;
1817
use TYPO3\Tailor\Service\VersionService;
1918

@@ -135,7 +134,7 @@ protected function invokeMethod(string $methodName, array $arguments)
135134
->setConstructorArgs(['1.0.0', 'my_ext', '/dummyPath'])
136135
->getMock();
137136

138-
$method = new ReflectionMethod(VersionService::class, $methodName);
137+
$method = new \ReflectionMethod(VersionService::class, $methodName);
139138
$method->setAccessible(true);
140139

141140
return $method->invokeArgs($mock, $arguments);

0 commit comments

Comments
 (0)