Skip to content

Commit 85b0366

Browse files
committed
Merge branch 'hotfix/update_docker_and_lint'
2 parents 73de614 + 5418594 commit 85b0366

6 files changed

Lines changed: 57 additions & 27 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
8+
9+
return (new Config())
10+
->setParallelConfig(ParallelConfigFactory::detect()) // @TODO 4.0 no need to call this manually
11+
->setRiskyAllowed(false)
12+
->setRules([
13+
'@auto' => true
14+
])
15+
// 💡 by default, Fixer looks for `*.php` files excluding `./vendor/` - here, you can groom this config
16+
->setFinder(
17+
(new Finder())
18+
// 💡 root folder to check
19+
->in(__DIR__)
20+
// 💡 additional files, eg bin entry file
21+
// ->append([__DIR__.'/bin-entry-file'])
22+
// 💡 folders to exclude, if any
23+
// ->exclude([/* ... */])
24+
// 💡 path patterns to exclude, if any
25+
// ->notPath([/* ... */])
26+
// 💡 extra configs
27+
// ->ignoreDotFiles(false) // true by default in v3, false in v4 or future mode
28+
// ->ignoreVCS(true) // true by default
29+
)
30+
;

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3-cli
1+
FROM php:8.5-cli
22

33
# Installer les dépendances pour l'extension zip
44
RUN apt-get update && apt-get install -y \

src/Exception/FileExistsException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class FileExistsException extends \Exception
77
public function __construct(
88
string $message = "File already exists",
99
int $code = 0,
10-
\Exception $previous = null
10+
?\Exception $previous = null
1111
) {
1212
parent::__construct($message, $code, $previous);
1313
}

src/Exception/FileNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class FileNotFoundException extends \Exception
77
public function __construct(
88
string $message = "File not found",
99
int $code = 0,
10-
\Exception $previous = null
10+
?\Exception $previous = null
1111
) {
1212
parent::__construct($message, $code, $previous);
1313
}

src/Exception/IOException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class IOException extends \Exception
77
public function __construct(
88
string $message = "Read/write error",
99
int $code = 0,
10-
\Exception $previous = null
10+
?\Exception $previous = null
1111
) {
1212
parent::__construct($message, $code, $previous);
1313
}

src/Path.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Path
4242
*/
4343
public static function join(string|self $path, string|self ...$parts): self
4444
{
45-
$path = (string)$path;
46-
$parts = \array_map(fn ($p) => (string)$p, $parts);
45+
$path = (string) $path;
46+
$parts = \array_map(fn($p) => (string) $p, $parts);
4747

4848
foreach ($parts as $part) {
4949
if (\str_starts_with($part, BuiltinProxy::$DIRECTORY_SEPARATOR)) {
@@ -75,7 +75,7 @@ public static function join(string|self $path, string|self ...$parts): self
7575
*/
7676
public static function splitDrive(string|self $path): array
7777
{
78-
$path = (string)$path;
78+
$path = (string) $path;
7979

8080
$matches = [];
8181

@@ -84,10 +84,10 @@ public static function splitDrive(string|self $path): array
8484
return \array_slice($matches, -2);
8585
}
8686

87-
$rx =
88-
BuiltinProxy::$DIRECTORY_SEPARATOR === '/' ?
89-
'/(^\/\/[\w\-\s]{2,15}\/[\w\-\s]+)(.*)/' :
90-
'/(^\\\\\\\\[\w\-\s]{2,15}\\\[\w\-\s]+)(.*)/';
87+
$rx
88+
= BuiltinProxy::$DIRECTORY_SEPARATOR === '/'
89+
? '/(^\/\/[\w\-\s]{2,15}\/[\w\-\s]+)(.*)/'
90+
: '/(^\\\\\\\\[\w\-\s]{2,15}\\\[\w\-\s]+)(.*)/';
9191

9292
\preg_match($rx, $path, $matches);
9393
if ($matches) {
@@ -101,7 +101,7 @@ public function __construct(string|self $path)
101101
{
102102
$this->builtin = new BuiltinProxy();
103103

104-
$this->path = (string)$path;
104+
$this->path = (string) $path;
105105
$this->handle = null;
106106
}
107107

@@ -218,9 +218,9 @@ public function getHomeDir(): self
218218
}
219219

220220
if ($this->builtin->function_exists('exec')) {
221-
$homeDir = $isWindows ?
222-
$this->builtin->exec('echo %userprofile%') :
223-
$this->builtin->exec('echo ~');
221+
$homeDir = $isWindows
222+
? $this->builtin->exec('echo %userprofile%')
223+
: $this->builtin->exec('echo ~');
224224

225225
if ($homeDir) {
226226
return new self($homeDir);
@@ -693,7 +693,7 @@ public function move(string|self $destination): self
693693
* @return void
694694
* @throws IOException
695695
*/
696-
public function touch(int|\DateTime $time = null, int|\DateTime $atime = null): void
696+
public function touch(int|\DateTime|null $time = null, int|\DateTime|null $atime = null): void
697697
{
698698
if ($time instanceof \DateTime) {
699699
$time = $time->getTimestamp();
@@ -744,7 +744,7 @@ public function size(): int
744744
public function parent(int $levels = 1): self
745745
{
746746
return $this->cast(
747-
$this->builtin->dirname($this->path ?? ".", $levels)
747+
$this->builtin->dirname($this->path ?: ".", $levels)
748748
);
749749
}
750750

@@ -953,7 +953,7 @@ public function getPermissions(bool $asOctal = true): int
953953
}
954954

955955
if (!$asOctal) {
956-
$perms = (int)substr(sprintf('%o', $perms), -4);
956+
$perms = (int) substr(sprintf('%o', $perms), -4);
957957
}
958958

959959
return $perms;
@@ -1058,9 +1058,9 @@ public function setOwner(string $user, string $group, bool $clearStatCache = fal
10581058
$this->builtin->clearstatcache();
10591059
}
10601060

1061-
$success =
1062-
$this->builtin->chown($this->path, $user) &&
1063-
$this->builtin->chgrp($this->path, $group);
1061+
$success
1062+
= $this->builtin->chown($this->path, $user)
1063+
&& $this->builtin->chgrp($this->path, $group);
10641064

10651065
if ($success === false) {
10661066
throw new IOException("An error occurred while setting owner of " . $this->path);
@@ -1087,7 +1087,7 @@ public function exists(): bool
10871087
*
10881088
* @throws IOException
10891089
*/
1090-
public function sameFile(string | self $other): bool
1090+
public function sameFile(string|self $other): bool
10911091
{
10921092
return $this->absPath()->path() === $this->cast($other)->absPath()->path();
10931093
}
@@ -1613,7 +1613,7 @@ public function link(string|self $newLink): self
16131613
throw new FileExistsException($newLink . " already exist");
16141614
}
16151615

1616-
$success = $this->builtin->link($this->path, (string)$newLink);
1616+
$success = $this->builtin->link($this->path, (string) $newLink);
16171617

16181618
if ($success === false) {
16191619
throw new IOException("An error occurred while creating the link from " . $this->path . " to " . $newLink);
@@ -1650,7 +1650,7 @@ public function lstat(): array
16501650
* @throws FileExistsException If the symbolic link already exists.
16511651
* @throws IOException If there was an error while creating the symbolic link.
16521652
*/
1653-
public function symlink(string | self $newLink): self
1653+
public function symlink(string|self $newLink): self
16541654
{
16551655
if (!$this->exists()) {
16561656
throw new FileNotFoundException("File or dir does not exist : " . $this);
@@ -1662,7 +1662,7 @@ public function symlink(string | self $newLink): self
16621662
throw new FileExistsException($newLink . " already exist");
16631663
}
16641664

1665-
$success = $this->builtin->symlink($this->path, (string)$newLink);
1665+
$success = $this->builtin->symlink($this->path, (string) $newLink);
16661666

16671667
if ($success === false) {
16681668
throw new IOException("An error occurred while creating the symbolic link from " . $this->path . " to " . $newLink);
@@ -1719,8 +1719,8 @@ public function getRelativePath(string|self $basePath): self
17191719
throw new FileNotFoundException("{$this->path} is not a file or directory");
17201720
}
17211721

1722-
$path = (string)$this->absPath();
1723-
$basePath = (string)$basePath;
1722+
$path = (string) $this->absPath();
1723+
$basePath = (string) $basePath;
17241724

17251725
$realBasePath = $this->builtin->realpath($basePath);
17261726
if ($realBasePath === false) {

0 commit comments

Comments
 (0)