Skip to content

Commit

Permalink
Merge branch 'erikn69-patch-1' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Jan 15, 2022
2 parents 72451e4 + bcee2f4 commit 33d6a63
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/.php-cs-fixer.php
/.php-cs-fixer.cache
/google-cloud-service-account.json
.idea
9 changes: 5 additions & 4 deletions bin/check-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions bin/set-flysystem-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bin/tools.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

include_once __DIR__.'/../vendor/autoload.php';
include_once __DIR__ . '/../vendor/autoload.php';

function write_line(string $line)
{
Expand Down
12 changes: 10 additions & 2 deletions src/AdapterTestUtilities/FilesystemAdapterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ public function writing_a_file_with_a_stream(): void
$writeStream = stream_with_contents('contents');

$adapter->writeStream('path.txt', $writeStream, new Config());
is_resource($writeStream) && fclose($writeStream);

if (is_resource($writeStream)) {
fclose($writeStream);
}

$fileExists = $adapter->fileExists('path.txt');

$this->assertTrue($fileExists);
Expand Down Expand Up @@ -197,7 +201,11 @@ public function writing_a_file_with_an_empty_stream(): void
$writeStream = stream_with_contents('');

$adapter->writeStream('path.txt', $writeStream, new Config());
is_resource($writeStream) && fclose($writeStream);

if (is_resource($writeStream)) {
fclose($writeStream);
}

$fileExists = $adapter->fileExists('path.txt');

$this->assertTrue($fileExists);
Expand Down

0 comments on commit 33d6a63

Please sign in to comment.