Skip to content

Commit 3c66afb

Browse files
authored
Libs update (#18)
* Remove useless php-doc tags * Add php 8.2 to actions * Update phpUnit to v10 * Make some test function static * Fix path creating functions * Fix testRemoveIfExists * Fix testCopyFile * Fix testCopyDir * Fix testRenameDir * Fix testRenameFile * Fix testMkDir * Fix testMkDirIfNotExist * Fix testEmptyDir * Fix all others * Remove infection exception
1 parent c3c5c14 commit 3c66afb

File tree

13 files changed

+418
-301
lines changed

13 files changed

+418
-301
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php-versions: ['8.1']
17+
php-versions: ['8.1', '8.2']
1818

1919
steps:
2020
- uses: actions/checkout@v2

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
'yoda_style' => false,
1717
'phpdoc_no_empty_return' => false,
18-
'no_superfluous_phpdoc_tags' => false,
18+
'no_superfluous_phpdoc_tags' => true,
1919
'single_line_throw' => false,
2020
'array_indentation' => true,
2121
'declare_strict_types' => true,

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
"php": ">=8.1"
99
},
1010
"require-dev": {
11-
"phpunit/phpunit": "^9.0",
11+
"phpunit/phpunit": "^10.0",
1212
"friendsofphp/php-cs-fixer": "^3.0",
13-
"sebastian/phpcpd": "^6.0",
1413
"vimeo/psalm": "^5.0",
15-
"infection/infection": "^0.26.13"
14+
"infection/infection": "^0.27"
1615
},
1716
"autoload": {
1817
"psr-4": {
@@ -36,7 +35,6 @@
3635
],
3736
"linter": [
3837
"vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -vv --allow-risky=yes --dry-run --stop-on-violation",
39-
"vendor/bin/phpcpd ./ --exclude vendor --exclude tests",
4038
"vendor/bin/psalm --show-info=true --php-version=$(php -r \"echo phpversion();\")"
4139
],
4240
"infection": [

docker/php/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ RUN set -xe && apk update && apk add --no-cache \
1212
git \
1313
autoconf \
1414
g++ \
15-
make
15+
make \
16+
linux-headers
1617

1718

18-
RUN docker-php-ext-install zip soap \
19+
RUN docker-php-ext-install zip opcache \
1920
&& docker-php-source extract \
2021
&& pecl install xdebug \
2122
&& docker-php-ext-enable xdebug \
@@ -24,7 +25,7 @@ RUN docker-php-ext-install zip soap \
2425
&& echo 'xdebug.mode=coverage' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
2526

2627

27-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.4.2 \
28+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.5.8 \
2829
&& mkdir -p /.composer && chmod -Rf 777 /.composer
2930

3031

infection.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@
1717
"Marvin255\\FileSystemHelper\\FileSystemHelperImpl::rename",
1818
"Marvin255\\FileSystemHelper\\FileSystemHelperImpl::runPhpFunction"
1919
]
20-
},
21-
"LogicalOr": {
22-
"ignore": [
23-
"Marvin255\\FileSystemHelper\\FileSystemHelperImpl::getTmpDir"
24-
]
25-
},
26-
"TrueValue": {
27-
"ignore": [
28-
"Marvin255\\FileSystemHelper\\FileSystemHelperImpl::mkdir"
29-
]
30-
},
31-
"ArrayItemRemoval": {
32-
"ignore": [
33-
"Marvin255\\FileSystemHelper\\Helper\\PathHelper::fixDirectorySeparatorAndTrim"
34-
]
3520
}
3621
}
3722
}

phpunit.xml.dist

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="./vendor/autoload.php" executionOrder="random" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory>./src</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="./vendor/autoload.php" executionOrder="random" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd">
3+
<coverage/>
84
<testsuites>
95
<testsuite name="File system helper tests suite">
106
<directory>./tests</directory>
117
</testsuite>
128
</testsuites>
9+
<source>
10+
<include>
11+
<directory>./src</directory>
12+
</include>
13+
</source>
1314
</phpunit>

src/Exception/FileSystemException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
/**
88
* Exception class for errors in file helper.
9+
*
10+
* @psalm-api
911
*/
1012
final class FileSystemException extends \Exception
1113
{
@@ -17,10 +19,7 @@ private function __construct(string $message = '')
1719
/**
1820
* Creates FileSystemException.
1921
*
20-
* @param string $message
2122
* @param array<int, \SplFileInfo|string> $params
22-
*
23-
* @return FileSystemException
2423
*/
2524
public static function create(string $message, ...$params): FileSystemException
2625
{

src/FileSystemFactory.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
/**
88
* Factory object for file system helper.
9+
*
10+
* @psalm-api
911
*/
1012
final class FileSystemFactory
1113
{
@@ -15,12 +17,8 @@ private function __construct()
1517

1618
/**
1719
* Creates new FileSystemHelperInterface instance with default settings.
18-
*
19-
* @param string|null $baseFolder
20-
*
21-
* @return FileSystemHelper
2220
*/
23-
public static function create(?string $baseFolder = null): FileSystemHelper
21+
public static function create(string $baseFolder = null): FileSystemHelper
2422
{
2523
return new FileSystemHelperImpl($baseFolder);
2624
}

src/FileSystemHelperImpl.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class FileSystemHelperImpl implements FileSystemHelper
1616
{
1717
private readonly ?string $baseFolder;
1818

19-
public function __construct(?string $baseFolder = null)
19+
public function __construct(string $baseFolder = null)
2020
{
2121
$validatedBaseFolder = null;
2222

@@ -342,7 +342,6 @@ private function makeFileInfoAndCheckBasePath(\SplFileInfo|string $data): \SplFi
342342
/**
343343
* Runs set php function in try/catch.
344344
*
345-
* @param string $functionName
346345
* @param mixed[] $params
347346
*
348347
* @throws FileSystemException

src/Helper/PathHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
/**
88
* Set of functions for working with file paths.
9+
*
10+
* @internal
911
*/
1012
final class PathHelper
1113
{
@@ -64,8 +66,7 @@ public static function unifyPath(string $path): string
6466
}
6567
}
6668

67-
return ($hasLeadingSlash ? \DIRECTORY_SEPARATOR : '')
68-
. implode(\DIRECTORY_SEPARATOR, $absolutes);
69+
return ($hasLeadingSlash ? \DIRECTORY_SEPARATOR : '') . implode(\DIRECTORY_SEPARATOR, $absolutes);
6970
}
7071

7172
/**

0 commit comments

Comments
 (0)