Skip to content

Commit

Permalink
feature #84 Add Symfony 6 support (AbdelilahJabri, tgalopin)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

Add Symfony 6 support

Commits
-------

d336d87 Fix tests for Symfony 6
48ae2f0 Fix and improve CI
de58094 Add Symfony 6 support
  • Loading branch information
tgalopin committed Dec 14, 2021
2 parents 320a440 + d336d87 commit 983a908
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 44 deletions.
39 changes: 30 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,74 @@ jobs:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.0'
coverage: none
- name: php-cs-fixer
run: |
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.4/php-cs-fixer.phar -q
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar -q
php php-cs-fixer.phar fix --dry-run --diff
tests-php-7-2-symfony-4-2:
tests-php-7-2-symfony-4-4:
runs-on: ubuntu-latest
env:
SYMFONY_VERSION: 4.2.*
SYMFONY_VERSION: 4.4.*
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
coverage: none
- name: PHPUnit
run: |
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
composer require --no-update --dev symfony/framework-bundle=$SYMFONY_VERSION symfony/yaml=$SYMFONY_VERSION
composer update --prefer-lowest --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
tests-php-7-4-symfony-5-0:
tests-php-7-4-symfony-5-3:
runs-on: ubuntu-latest
env:
SYMFONY_VERSION: 5.0.*
SYMFONY_VERSION: 5.3.*
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '7.4'
coverage: none
- name: PHPUnit
run: |
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
composer require --no-update --dev symfony/framework-bundle=$SYMFONY_VERSION symfony/yaml=$SYMFONY_VERSION
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
tests-php-8-0-symfony-5-2:
tests-php-8-0-symfony-5-4:
runs-on: ubuntu-latest
env:
SYMFONY_VERSION: 5.2.*
SYMFONY_VERSION: 5.4.*
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
- name: PHPUnit
run: |
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
composer require --no-update --dev symfony/framework-bundle=$SYMFONY_VERSION symfony/yaml=$SYMFONY_VERSION
composer update --prefer-dist --no-interaction --no-ansi --no-progress
php vendor/bin/simple-phpunit
tests-php-8-1-symfony-6-0:
runs-on: ubuntu-latest
env:
SYMFONY_VERSION: 6.0.*
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
- name: PHPUnit
run: |
composer require --no-update symfony/config=$SYMFONY_VERSION symfony/http-kernel=$SYMFONY_VERSION symfony/dependency-injection=$SYMFONY_VERSION symfony/options-resolver=$SYMFONY_VERSION
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"require": {
"php": ">=7.2",
"league/flysystem": "^2.0",
"symfony/config": "^4.2|^5.0",
"symfony/http-kernel": "^4.2|^5.0",
"symfony/dependency-injection": "^4.2|^5.0",
"symfony/options-resolver": "^4.2|^5.0"
"symfony/config": "^4.2|^5.0|^6.0",
"symfony/http-kernel": "^4.2|^5.0|^6.0",
"symfony/dependency-injection": "^4.2|^5.0|^6.0",
"symfony/options-resolver": "^4.2|^5.0|^6.0"
},
"require-dev": {
"league/flysystem-async-aws-s3": "^2.0",
Expand All @@ -34,11 +34,11 @@
"league/flysystem-google-cloud-storage": "^2.0",
"league/flysystem-memory": "^2.0",
"league/flysystem-sftp": "^2.0",
"symfony/dotenv": "^4.2|^5.0",
"symfony/framework-bundle": "^4.2|^5.0",
"symfony/dotenv": "^4.2|^5.0|^6.0",
"symfony/framework-bundle": "^4.2|^5.0|^6.0",
"symfony/phpunit-bridge": "^5.2",
"symfony/var-dumper": "^4.1|^5.0",
"symfony/yaml": "^4.2|^5.0"
"symfony/var-dumper": "^4.1|^5.0|^6.0",
"symfony/yaml": "^4.2|^5.0|^6.0"
},
"conflict": {
"league/flysystem-cached-adapter": "<1.0.9"
Expand Down
33 changes: 16 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php">
<php>
<ini name="error_reporting" value="-1" />
<env name="SHELL_VERBOSITY" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="9999" />
</php>
<php>
<ini name="error_reporting" value="-1"/>
<env name="SHELL_VERBOSITY" value="-1"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="9999"/>
</php>

<testsuites>
<testsuite name="FlysystemBundle Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="FlysystemBundle Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>
11 changes: 10 additions & 1 deletion src/Adapter/Builder/LocalAdapterDefinitionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@ protected function configureDefinition(Definition $definition, array $options)
$definition->setArgument(1,
(new Definition(PortableVisibilityConverter::class))
->setFactory([PortableVisibilityConverter::class, 'fromArray'])
->addArgument($options['permissions'])
->addArgument([
'file' => [
'public' => (int) $options['permissions']['file']['public'],
'private' => (int) $options['permissions']['file']['private'],
],
'dir' => [
'public' => (int) $options['permissions']['dir']['public'],
'private' => (int) $options['permissions']['dir']['private'],
],
])
->setShared(false)
);
$definition->setArgument(2, $options['lock']);
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('flysystem');
$rootNode = $treeBuilder->getRootNode();
Expand Down
4 changes: 2 additions & 2 deletions tests/Kernel/AppKernelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

trait AppKernelTrait
{
public function getCacheDir()
public function getCacheDir(): string
{
return $this->createTmpDir('cache');
}

public function getLogDir()
public function getLogDir(): string
{
return $this->createTmpDir('logs');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Kernel/EmptyAppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EmptyAppKernel extends Kernel
{
use AppKernelTrait;

public function registerBundles()
public function registerBundles(): iterable
{
return [new FlysystemBundle()];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Kernel/FlysystemAppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FlysystemAppKernel extends Kernel

private $adapterClients = [];

public function registerBundles()
public function registerBundles(): iterable
{
return [new FrameworkBundle(), new FlysystemBundle()];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Kernel/FrameworkAppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FrameworkAppKernel extends Kernel
{
use AppKernelTrait;

public function registerBundles()
public function registerBundles(): iterable
{
return [new FrameworkBundle(), new FlysystemBundle()];
}
Expand Down
3 changes: 0 additions & 3 deletions tests/Kernel/config/flysystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,3 @@ flysystem:
privateKey: 'path/to/or/contents/of/privatekey'
root: '/path/to/root'
timeout: 10
directoryPerm: 0755
permPrivate: 0700
permPublic: 0744

0 comments on commit 983a908

Please sign in to comment.