Skip to content

Commit 7d4da06

Browse files
committed
Update PHP minimum version to 8.0 and dependencies to latest compatible version
1 parent 972e9d9 commit 7d4da06

15 files changed

+55
-44
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
16-
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
16+
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4']
1717
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
1818
steps:
1919
- name: Checkout
@@ -28,7 +28,7 @@ jobs:
2828
run: php -v
2929
- name: Cache Composer packages
3030
id: composer-cache
31-
uses: actions/cache@v3
31+
uses: actions/cache@v4
3232
with:
3333
path: vendor
3434
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build:
1111
command: phpcs-run
1212
use_website_config: false
1313
environment:
14-
php: 7.4.0
14+
php: 8.0
1515
filter:
1616
excluded_paths:
1717
- 'tests/*'

README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/1a791203238c45539178f1992285933c)](https://app.codacy.com/gh/platine-php/filesystem/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
1313

1414
### Requirements
15-
- **PHP >= 7.4**, **PHP 8**
15+
- **PHP >= 8.0**
1616

1717
### Installation
1818
#### Using composer (recommended)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
},
2020

2121
"require": {
22-
"php": "^7.4 || ^8",
22+
"php": "^8",
2323
"platine-php/stdlib": "^1.0"
2424
},
2525

2626
"require-dev": {
2727
"mikey179/vfsstream": "~1.6",
2828
"phpmd/phpmd": "@stable",
29-
"phpstan/phpstan": "^1.8",
30-
"phpunit/phpunit": "^9.5",
31-
"platine-php/dev": "^1.0",
29+
"phpstan/phpstan": "^2.0",
30+
"phpunit/phpunit": "^9.6",
31+
"platine-php/dev": "^2.0",
3232
"squizlabs/php_codesniffer": "3.*"
3333
},
3434

src/Adapter/AdapterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
use Platine\Filesystem\FileInterface;
5252

5353
/**
54-
* Class AdapterInterface
54+
* @class AdapterInterface
5555
* @package Platine\Filesystem\Adapter
5656
*/
5757
interface AdapterInterface
@@ -61,7 +61,7 @@ interface AdapterInterface
6161
* @param string $path
6262
* @return FileInterface|DirectoryInterface|null
6363
*/
64-
public function get(string $path);
64+
public function get(string $path): FileInterface|DirectoryInterface|null;
6565

6666
/**
6767
* Return the instance of file

src/Adapter/Local/AbstractLocal.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@
4949

5050
use Platine\Filesystem\Adapter\AdapterInterface;
5151
use Platine\Filesystem\Adapter\Local\Exception\FilesystemException;
52+
use Platine\Filesystem\DirectoryInterface;
53+
use Platine\Filesystem\FileInterface;
5254
use Platine\Filesystem\FilesystemInterface;
5355
use Platine\Stdlib\Helper\Path;
5456

5557

5658
/**
57-
* Class AbstractLocal
59+
* @class AbstractLocal
5860
* @package Platine\Filesystem\Adapter\Local
5961
*/
6062
abstract class AbstractLocal implements FilesystemInterface
@@ -133,7 +135,7 @@ public function getOriginalPath(): string
133135
/**
134136
* {@inheritdoc}
135137
*/
136-
public function moveTo($directory)
138+
public function moveTo(string|DirectoryInterface $directory): FileInterface|DirectoryInterface
137139
{
138140
$dest = $this->copyTo($directory);
139141
$dest->touch($this->getMtime());
@@ -145,7 +147,7 @@ public function moveTo($directory)
145147
/**
146148
* {@inheritdoc}
147149
*/
148-
public function chmod(int $mode)
150+
public function chmod(int $mode): self
149151
{
150152
chmod($this->path, $mode);
151153

@@ -244,7 +246,7 @@ public function isWritable(): bool
244246
/**
245247
* {@inheritdoc}
246248
*/
247-
public function rename(string $newPath)
249+
public function rename(string $newPath): self
248250
{
249251
$normalizedNewPath = rtrim(Path::normalizePathDS($newPath), '\\/');
250252
if (strpos($normalizedNewPath, DIRECTORY_SEPARATOR) === false) {
@@ -264,7 +266,7 @@ public function rename(string $newPath)
264266
/**
265267
* {@inheritdoc}
266268
*/
267-
public function touch(int $time)
269+
public function touch(int $time): self
268270
{
269271
touch($this->path, $time);
270272

src/Adapter/Local/Directory.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,18 @@
5353
use Platine\Filesystem\FileInterface;
5454

5555
/**
56-
* Class Directory
56+
* @class Directory
5757
* @package Platine\Filesystem\Adapter\Local
5858
*/
5959
class Directory extends AbstractLocal implements DirectoryInterface
6060
{
6161
/**
6262
* {@inheritdoc}
6363
*/
64-
public function copyTo($directory, int $mode = 0775)
65-
{
64+
public function copyTo(
65+
string|DirectoryInterface $directory,
66+
int $mode = 0775
67+
): FileInterface|DirectoryInterface {
6668
if (!$this->exists()) {
6769
throw new NotFoundException(sprintf(
6870
'Source path [%s] not found',
@@ -96,7 +98,7 @@ public function copyTo($directory, int $mode = 0775)
9698
/**
9799
* {@inheritdoc}
98100
*/
99-
public function create(string $name, int $mode = 0775, bool $recursive = false)
101+
public function create(string $name, int $mode = 0775, bool $recursive = false): DirectoryInterface
100102
{
101103
if (!file_exists($this->path . DIRECTORY_SEPARATOR . $name)) {
102104
mkdir($this->path . DIRECTORY_SEPARATOR . $name, $mode, $recursive);

src/Adapter/Local/Exception/FilesystemException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
use Exception;
3737

3838
/**
39-
* Class FilesystemException
39+
* @class FilesystemException
4040
* @package Platine\Filesystem\Adapter\Local\Exception
4141
*/
4242
class FilesystemException extends Exception

src/Adapter/Local/Exception/NotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
namespace Platine\Filesystem\Adapter\Local\Exception;
3535

3636
/**
37-
* Class NotFoundException
37+
* @class NotFoundException
3838
* @package Platine\Filesystem\Adapter\Local\Exception
3939
*/
4040
class NotFoundException extends FilesystemException

src/Adapter/Local/File.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@
4747

4848
namespace Platine\Filesystem\Adapter\Local;
4949

50+
use Platine\Filesystem\DirectoryInterface;
5051
use Platine\Filesystem\FileInterface;
5152
use Platine\Stdlib\Helper\Path;
5253

5354
/**
54-
* Class File
55+
* @class File
5556
* @package Platine\Filesystem\Adapter\Local
5657
*/
5758
class File extends AbstractLocal implements FileInterface
@@ -69,8 +70,10 @@ public function append(string $content): self
6970
/**
7071
* {@inheritdoc}
7172
*/
72-
public function copyTo($directory, int $mode = 0775)
73-
{
73+
public function copyTo(
74+
string|DirectoryInterface $directory,
75+
int $mode = 0775
76+
): FileInterface {
7477
if (is_string($directory)) {
7578
$directory = $this->adapter->directory($directory);
7679
}
@@ -85,7 +88,7 @@ public function copyTo($directory, int $mode = 0775)
8588
/**
8689
* {@inheritdoc}
8790
*/
88-
public function create(string $path, string $content = '', int $mode = 0775)
91+
public function create(string $path, string $content = '', int $mode = 0775): FileInterface
8992
{
9093
$file = $this->adapter->file($path)->write($content);
9194
$file->chmod($mode);

0 commit comments

Comments
 (0)