Skip to content

Commit fa512bc

Browse files
committed
support for PHP 8.4 amongst other improvements
1 parent 116b8d9 commit fa512bc

File tree

16 files changed

+109
-142
lines changed

16 files changed

+109
-142
lines changed

.gitattributes

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
* text=auto eol=lf
22

3-
/tests export-ignore
4-
.editorconfig export-ignore
5-
.gitattributes export-ignore
6-
.gitignore export-ignore
7-
.php_cs export-ignore
8-
.travis.yml export-ignore
9-
phpcs.xml.dist export-ignore
10-
phpunit.xml.dist export-ignore
3+
/tests export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.php-cs-fixer.php export-ignore
8+
phpcs.xml.dist export-ignore
9+
phpunit.xml.dist export-ignore
10+
.phpstan.neon export-ignore

.github/workflows/main.yaml

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1 @@
1-
name: "testing"
2-
3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
9-
jobs:
10-
qa:
11-
name: Quality assurance
12-
runs-on: ubuntu-latest
13-
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
18-
- name: Validate composer.json and composer.lock
19-
run: composer validate
20-
21-
- name: Cache Composer packages
22-
id: composer-cache
23-
uses: actions/cache@v2
24-
with:
25-
path: vendor
26-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-php-
29-
30-
- name: Install dependencies
31-
if: steps.composer-cache.outputs.cache-hit != 'true'
32-
run: composer install --prefer-dist --no-progress
33-
34-
- name: Coding Standard
35-
run: composer run-script cs
36-
37-
tests:
38-
name: Tests
39-
runs-on: ubuntu-latest
40-
41-
strategy:
42-
matrix:
43-
php:
44-
- 7.2
45-
- 7.3
46-
- 7.4
47-
composer-args: [ "" ]
48-
include:
49-
- php: 8.0
50-
composer-args: --ignore-platform-reqs
51-
fail-fast: false
52-
53-
steps:
54-
- name: Checkout
55-
uses: actions/checkout@v2
56-
57-
- name: Install PHP
58-
uses: shivammathur/setup-php@v2
59-
with:
60-
php-version: ${{ matrix.php }}
61-
62-
- name: Cache PHP dependencies
63-
uses: actions/cache@v2
64-
with:
65-
path: vendor
66-
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
67-
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
68-
69-
- name: Install dependencies
70-
run: composer install --prefer-dist --no-progress ${{ matrix.composer-args }}
71-
72-
- name: Tests
73-
run: composer test
74-
75-
- name: Tests coverage
76-
run: composer coverage
1+
/src/config/workflow.yaml

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ vendor
22
composer.lock
33
coverage
44
*.cache
5+
.idea
6+
kit
File renamed without changes.

.phpstan.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
parameters:
2+
reportUnmatchedIgnoredErrors: false
3+
inferPrivatePropertyTypeFromConstructor: true
4+
level: max
5+
paths:
6+
- src
7+
- tests
8+
ignoreErrors:
9+
-
10+
identifier: 'function.alreadyNarrowedType'
11+
reportUnmatched: false
12+
- "#^Unsafe usage of new static#"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [3.0.0] - 2020-12-03
9+
### Changed
10+
- Updated `league/filesystem` to version 2 for php 7.2, 7.3 and 7.4, and to version 3 for >= php 8.0.
11+
- With these changes, a breaking change is introduced by `league/filesystem`. Now you have to pass a FilesystemOperator interface compliant class to the middlewares. Check README's code examples.
12+
813
## [2.0.1] - 2020-12-03
914
### Added
1015
- Support for PHP 8.0
@@ -69,6 +74,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6974
## 0.1.0 - 2016-10-02
7075
First version
7176

77+
[3.0.0]: https://github.com/middlewares/filesystem/compare/v2.0.1...v3.0.0
7278
[2.0.1]: https://github.com/middlewares/filesystem/compare/v2.0.0...v2.0.1
7379
[2.0.0]: https://github.com/middlewares/filesystem/compare/v1.1.0...v2.0.0
7480
[1.1.0]: https://github.com/middlewares/filesystem/compare/v1.0.0...v1.1.0

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019
3+
Copyright (c) 2019-2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,30 @@ Example using a ftp storage:
4545

4646
```php
4747
use League\Flysystem\Filesystem;
48-
use League\Flysystem\Adapter\Ftp;
49-
50-
$filesystem = new Filesystem(new Ftp([
51-
'host' => 'ftp.example.com',
52-
'username' => 'username',
53-
'password' => 'password',
54-
'port' => 21,
55-
'root' => '/path/to/root',
56-
'passive' => true,
57-
'ssl' => true,
58-
'timeout' => 30,
59-
]));
48+
use League\Flysystem\Ftp\FtpAdapter;
49+
use League\Flysystem\Ftp\FtpConnectionOptions;
50+
51+
$adapter = new League\Flysystem\Ftp\FtpAdapter(
52+
FtpConnectionOptions::fromArray([
53+
'host' => 'hostname',
54+
'root' => '/root/path/',
55+
'username' => 'username',
56+
'password' => 'password',
57+
'port' => 21,
58+
'ssl' => false,
59+
'timeout' => 90,
60+
'utf8' => false,
61+
'passive' => true,
62+
'transferMode' => FTP_BINARY,
63+
'systemType' => null, // 'windows' or 'unix'
64+
'ignorePassiveAddress' => null, // true or false
65+
'timestampsOnUnixListingsEnabled' => false, // true or false
66+
'recurseManually' => true // true
67+
])
68+
);
69+
70+
// The FilesystemOperator
71+
$filesystem = new Filesystem($adapter);
6072

6173
Dispatcher::run([
6274
new Middlewares\Reader($filesystem)
@@ -77,7 +89,7 @@ $reader = new Middlewares\Reader($filesystem, $responseFactory, $streamFactory);
7789
Allows to continue to the next middleware on error (file not found, method not allowed, etc). This allows to create a simple caching system as the following:
7890

7991
```php
80-
$cache = new Flysystem(new Local(__DIR__.'/path/to/files'));
92+
$cache = new Filesystem(new LocalFilesystemAdapter(__DIR__.'/path/to/files'));
8193

8294
Dispatcher::run([
8395
(new Middlewares\Reader($cache)) //read and returns the cached response...
@@ -103,7 +115,7 @@ To be compatible with `Reader` behaviour:
103115
* If the response is gzipped (has the header `Content-Encoding: gzip`) the file is saved with the extension .gz. For example `/post/23/index.html.gz` (instead `/post/23/index.html`).
104116

105117
```php
106-
$filesystem = new Flysystem(new Local(__DIR__.'/storage'));
118+
$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__.'/storage'));
107119

108120
Dispatcher::run([
109121
new Middlewares\Writer($filesystem)

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
},
1919
"require": {
2020
"php": "^7.2 || ^8.0",
21-
"middlewares/utils": "^3.0",
22-
"league/flysystem": "^1.0",
23-
"psr/http-server-middleware": "^1.0"
21+
"middlewares/utils": "^2 || ^3 || ^4",
22+
"league/flysystem": "^2 || ^3",
23+
"psr/http-server-middleware": "^1"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^8|^9",
27-
"friendsofphp/php-cs-fixer": "^2.0",
28-
"squizlabs/php_codesniffer": "^3.0",
29-
"oscarotero/php-cs-fixer-config": "^1.0",
30-
"phpstan/phpstan": "^0.12",
31-
"laminas/laminas-diactoros": "^2.3"
26+
"phpunit/phpunit": "^8 || ^9",
27+
"friendsofphp/php-cs-fixer": "^3",
28+
"squizlabs/php_codesniffer": "^3",
29+
"oscarotero/php-cs-fixer-config": "^2",
30+
"phpstan/phpstan": "^1 || ^2",
31+
"laminas/laminas-diactoros": "^2 || ^3"
3232
},
3333
"autoload": {
3434
"psr-4": {
File renamed without changes.

0 commit comments

Comments
 (0)