Skip to content

Commit

Permalink
Merge pull request #16 from Chris53897/feature/x
Browse files Browse the repository at this point in the history
feat: drop support for PHP < 8.1
  • Loading branch information
RoyVoetman authored Apr 28, 2024
2 parents c689eb4 + 220e463 commit a583ad7
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 320 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ All notable changes to `flysystem-gitlab-storage` will be documented in this fil

### 2.0.4 - 2020-12-16
- Savings HTTP exchanges with HEAD request

### 2.xx - 2024-xx-xx
- Moved minimum PHP version to 8.1
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.0",
"league/flysystem": "^2.0 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.2"
"phpunit/phpunit": "^10.5.11 || ^11.0.4"
},
"autoload": {
"psr-4": {
Expand Down
34 changes: 16 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Gitlab Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
>
<testsuites>
<testsuite name="Gitlab Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory>./src</directory>
</include>
</source>

</phpunit>
130 changes: 34 additions & 96 deletions src/GitlabAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,13 @@ class GitlabAdapter implements FilesystemAdapter
{
const UPLOADED_FILE_COMMIT_MESSAGE = 'Uploaded file via Gitlab API';
const DELETED_FILE_COMMIT_MESSAGE = 'Deleted file via Gitlab API';

/**
* @var \RoyVoetman\FlysystemGitlab\Client
*/

protected Client $client;

/**
* @var \League\Flysystem\PathPrefixer
*/

protected PathPrefixer $prefixer;

/**
* @var \League\MimeTypeDetection\ExtensionMimeTypeDetector
*/

protected ExtensionMimeTypeDetector $mimeTypeDetector;

/**
* GitlabAdapter constructor.
*
* @param \RoyVoetman\FlysystemGitlab\Client $client
* @param string $prefix
*/

public function __construct(Client $client, $prefix = '')
{
$this->client = $client;
Expand All @@ -64,10 +49,7 @@ public function __construct(Client $client, $prefix = '')
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToCheckFileExistence
* @return bool
* @inheritdoc
*/
public function fileExists(string $path): bool
{
Expand All @@ -83,13 +65,9 @@ public function fileExists(string $path): bool

return true;
}

/**
* @param string $path
* @param string $contents
* @param \League\Flysystem\Config $config
*
* @throws \League\Flysystem\UnableToWriteFile
* @inheritdoc
*/
public function write(string $path, string $contents, Config $config): void
{
Expand All @@ -103,13 +81,9 @@ public function write(string $path, string $contents, Config $config): void
throw UnableToWriteFile::atLocation($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
* @param resource $contents
* @param \League\Flysystem\Config $config
*
* @throws UnableToWriteFile
* @inheritdoc
*/
public function writeStream(string $path, $contents, Config $config): void
{
Expand All @@ -123,12 +97,9 @@ public function writeStream(string $path, $contents, Config $config): void
throw UnableToWriteFile::atLocation($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToReadFile
* @return string
* @inheritdoc
*/
public function read(string $path): string
{
Expand All @@ -138,11 +109,9 @@ public function read(string $path): string
throw UnableToReadFile::fromLocation($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToReadFile
* @inheritdoc
*/
public function readStream(string $path)
{
Expand All @@ -156,11 +125,9 @@ public function readStream(string $path)
throw UnableToReadFile::fromLocation($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToDeleteFile
* @inheritdoc
*/
public function delete(string $path): void
{
Expand All @@ -170,11 +137,9 @@ public function delete(string $path): void
throw UnableToDeleteFile::atLocation($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
*
* @throws \League\Flysystem\FilesystemException
* @inheritdoc
*/
public function deleteDirectory(string $path): void
{
Expand All @@ -191,12 +156,9 @@ public function deleteDirectory(string $path): void
}
}
}

/**
* @param string $path
* @param \League\Flysystem\Config $config
*
* @throws \League\Flysystem\UnableToCreateDirectory
* @inheritdoc
*/
public function createDirectory(string $path, Config $config): void
{
Expand All @@ -208,10 +170,9 @@ public function createDirectory(string $path, Config $config): void
throw UnableToCreateDirectory::dueToFailure($path, $e);
}
}

/**
* @param string $path
* @param mixed $visibility
* @inheritdoc
*
* @throws \League\Flysystem\UnableToSetVisibility
*/
Expand All @@ -221,9 +182,8 @@ public function setVisibility(string $path, $visibility): void
}

/**
* @param string $path
* @inheritdoc
*
* @return \League\Flysystem\FileAttributes
* @throws \League\Flysystem\UnableToSetVisibility
*/
public function visibility(string $path): FileAttributes
Expand All @@ -232,10 +192,9 @@ public function visibility(string $path): FileAttributes
}

/**
* @param string $path
* @inheritdoc
*
* @throws \League\Flysystem\UnableToRetrieveMetadata
* @return \League\Flysystem\FileAttributes
*/
public function mimeType(string $path): FileAttributes
{
Expand All @@ -249,10 +208,7 @@ public function mimeType(string $path): FileAttributes
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToRetrieveMetadata
* @return \League\Flysystem\FileAttributes
* @inheritdoc
*/
public function lastModified(string $path): FileAttributes
{
Expand All @@ -270,12 +226,9 @@ public function lastModified(string $path): FileAttributes
throw UnableToRetrieveMetadata::lastModified($path, $e->getMessage(), $e);
}
}

/**
* @param string $path
*
* @throws \League\Flysystem\UnableToRetrieveMetadata
* @return \League\Flysystem\FileAttributes
* @inheritdoc
*/
public function fileSize(string $path): FileAttributes
{
Expand All @@ -289,11 +242,7 @@ public function fileSize(string $path): FileAttributes
}

/**
* @param string $path
* @param bool $deep
*
* @throws FilesystemException
* @return iterable<StorageAttributes>
* @inheritdoc
*/
public function listContents(string $path, bool $deep): iterable
{
Expand All @@ -319,11 +268,7 @@ public function listContents(string $path, bool $deep): iterable
}

/**
* @param string $source
* @param string $destination
* @param \League\Flysystem\Config $config
*
* @throws \League\Flysystem\UnableToMoveFile
* @inheritdoc
*/
public function move(string $source, string $destination, Config $config): void
{
Expand All @@ -343,11 +288,7 @@ public function move(string $source, string $destination, Config $config): void
}

/**
* @param string $source
* @param string $destination
* @param \League\Flysystem\Config $config
*
* @throws \League\Flysystem\UnableToCopyFile
* @inheritdoc
*/
public function copy(string $source, string $destination, Config $config): void
{
Expand All @@ -363,23 +304,20 @@ public function copy(string $source, string $destination, Config $config): void
throw UnableToCopyFile::fromLocationTo($source, $destination, $e);
}
}

/**
* @return \RoyVoetman\FlysystemGitlab\Client
*/

public function getClient(): Client
{
return $this->client;
}

/**
* @param \RoyVoetman\FlysystemGitlab\Client $client
*/

public function setClient(Client $client)
{
$this->client = $client;
}

/**
* @inheritdoc
*/
public function directoryExists(string $path): bool
{
try {
Expand Down
2 changes: 1 addition & 1 deletion src/UnableToRetrieveFileTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
final class UnableToRetrieveFileTree extends RuntimeException implements FilesystemOperationFailed
{
/**
* @return string
* @see FilesystemOperationFailed::operation()
*/
public function operation(): string
{
Expand Down
Loading

0 comments on commit a583ad7

Please sign in to comment.