From a5cb83ba1d3f4c2176650ac3188e56b3dcaebbdb Mon Sep 17 00:00:00 2001 From: erikn69 Date: Mon, 27 Dec 2021 17:40:20 -0500 Subject: [PATCH 1/2] Avoid `supplied resource is not a valid stream` --- .github/workflows/quality-assurance.yml | 1 + src/AdapterTestUtilities/FilesystemAdapterTestCase.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/quality-assurance.yml b/.github/workflows/quality-assurance.yml index 0b39c9da3..d9d89ff04 100644 --- a/.github/workflows/quality-assurance.yml +++ b/.github/workflows/quality-assurance.yml @@ -27,6 +27,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: + fail-fast: false matrix: php: [ '7.2', '7.3', '7.4' ] composer-flags: [ '' ] diff --git a/src/AdapterTestUtilities/FilesystemAdapterTestCase.php b/src/AdapterTestUtilities/FilesystemAdapterTestCase.php index e5e9453b2..f3b1a2885 100644 --- a/src/AdapterTestUtilities/FilesystemAdapterTestCase.php +++ b/src/AdapterTestUtilities/FilesystemAdapterTestCase.php @@ -144,7 +144,9 @@ public function writing_a_file_with_a_stream(): void $writeStream = stream_with_contents('contents'); $adapter->writeStream('path.txt', $writeStream, new Config()); - fclose($writeStream); + if (is_resource($writeStream)) { + fclose($writeStream); + } $fileExists = $adapter->fileExists('path.txt'); $this->assertTrue($fileExists); @@ -195,7 +197,9 @@ public function writing_a_file_with_an_empty_stream(): void $writeStream = stream_with_contents(''); $adapter->writeStream('path.txt', $writeStream, new Config()); - fclose($writeStream); + if (is_resource($writeStream)) { + fclose($writeStream); + } $fileExists = $adapter->fileExists('path.txt'); $this->assertTrue($fileExists); From adafbfb08efaafcf3a5a0060cfcc830b3f9c7eb9 Mon Sep 17 00:00:00 2001 From: George Zakharov Date: Sat, 15 Jan 2022 19:20:27 +0300 Subject: [PATCH 2/2] Minor style fixes --- .gitignore | 1 + bin/check-versions.php | 9 +++++---- bin/set-flysystem-version.php | 4 ++-- bin/tools.php | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6fc14647d..faaac7a00 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /.php-cs-fixer.php /.php-cs-fixer.cache /google-cloud-service-account.json +.idea \ No newline at end of file diff --git a/bin/check-versions.php b/bin/check-versions.php index f98bb05ee..095108b26 100644 --- a/bin/check-versions.php +++ b/bin/check-versions.php @@ -8,7 +8,7 @@ * - All required dependencies of the extracted packages MUST be * present in the main composer.json's require(-dev) section. * - Dependency constraints of extracted packages may not exclude - * the constrains of the main package and visa versa. + * the constraints of the main package and visa versa. * - The provided target release argument must be satisfiable by * all of the extracted packages' core dependency constraint. */ @@ -21,7 +21,7 @@ use League\Flysystem\Local\LocalFilesystemAdapter; use League\Flysystem\StorageAttributes; -include_once __DIR__.'/tools.php'; +include_once __DIR__ . '/tools.php'; function constraint_has_conflict(string $mainConstraint, string $packageConstraint): bool @@ -53,7 +53,7 @@ function constraint_has_conflict(string $mainConstraint, string $packageConstrai write_line("🔎 Inspecting composer dependency incompatibilities."); $mainVersion = $argv[1]; -$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__.'/../')); +$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__ . '/../')); $mainComposer = $filesystem->read('composer.json'); /** @var string[] $otherComposers */ @@ -69,7 +69,7 @@ function constraint_has_conflict(string $mainConstraint, string $packageConstrai $information = json_decode($filesystem->read($composerFile), true); foreach ($information['require'] as $dependency => $constraint) { - if (strpos($dependency, 'ext-') === 0 || $dependency === 'phpseclib/phpseclib') { + if (str_starts_with($dependency, 'ext-') || $dependency === 'phpseclib/phpseclib') { continue; } @@ -79,6 +79,7 @@ function constraint_has_conflict(string $mainConstraint, string $packageConstrai } else { write_line("Composer file {$composerFile} allows league/flysystem:{$mainVersion} with {$constraint}"); } + continue; } diff --git a/bin/set-flysystem-version.php b/bin/set-flysystem-version.php index 7f25df7fc..1036e08b4 100644 --- a/bin/set-flysystem-version.php +++ b/bin/set-flysystem-version.php @@ -5,7 +5,7 @@ use League\Flysystem\Local\LocalFilesystemAdapter; use League\Flysystem\StorageAttributes; -include_once __DIR__.'/tools.php'; +include_once __DIR__ . '/tools.php'; if ( ! isset($argv[1])) { panic('No base version provided'); @@ -15,7 +15,7 @@ write_line("☝️ Setting all flysystem constraints to {$mainVersion}."); -$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__.'/../')); +$filesystem = new Filesystem(new LocalFilesystemAdapter(__DIR__ . '/../')); /** @var string[] $otherComposers */ $composerFiles = $filesystem->listContents('src', true) diff --git a/bin/tools.php b/bin/tools.php index add416899..b114a30da 100644 --- a/bin/tools.php +++ b/bin/tools.php @@ -1,6 +1,6 @@