Skip to content

Commit

Permalink
Merge pull request #6 from webalternatif/php83
Browse files Browse the repository at this point in the history
✨ Add support of PHP 8.3
  • Loading branch information
chapa authored Jan 18, 2024
2 parents 3d160ec + 9419870 commit 2679d46
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -53,6 +54,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -90,6 +92,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v2

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## v0.4.3 (unreleased)

### ✨ New features

* Add support of PHP 8.3

### 🐛 Bug fixes

* Use Guzzle's CachingStream to replicate a file ([#5](https://github.com/webalternatif/flysystem-failover-bundle/pull/5))
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": "8.0.* || 8.1.* || 8.2.*",
"php": "8.0.* || 8.1.* || 8.2.* || 8.3.*",
"guzzlehttp/psr7": "^2.0",
"league/flysystem": "^3.0",
"nyholm/dsn": "^2.0",
Expand All @@ -31,9 +31,9 @@
"infection/infection": "^0.25.0",
"league/flysystem-memory": "^3.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.15.1",
"psalm/plugin-phpunit": "^0.18.4",
"symfony/serializer": "^5.3",
"vimeo/psalm": "^4.10"
"vimeo/psalm": "^5.19"
},
"conflict": {
"doctrine/dbal": "<2.13.1"
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/WebfFlysystemFailoverExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private function registerMessageRepository(
->setArguments([
new Reference(sprintf(
'doctrine.dbal.%s_connection',
$dsn->getHost() ?: 'default'
$dsn->getHost() ?? 'default'
)),
])
);
Expand Down
3 changes: 3 additions & 0 deletions src/Flysystem/FailoverAdaptersLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

/**
* @template T of FilesystemAdapter
*
* @template-implements FailoverAdaptersLocatorInterface<T>
* @template-implements IteratorAggregate<string, FailoverAdapter<T>>
*/
class FailoverAdaptersLocator implements FailoverAdaptersLocatorInterface, IteratorAggregate
{
Expand Down
6 changes: 6 additions & 0 deletions src/Flysystem/FailoverAdaptersLocatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

namespace Webf\FlysystemFailoverBundle\Flysystem;

use League\Flysystem\FilesystemAdapter;
use Traversable;
use Webf\FlysystemFailoverBundle\Exception\FailoverAdapterNotFoundException;

/**
* @template T of FilesystemAdapter
*
* @template-extends Traversable<string, FailoverAdapter<T>>
*/
interface FailoverAdaptersLocatorInterface extends Traversable
{
/**
Expand Down
6 changes: 6 additions & 0 deletions src/MessageHandler/ReplicateFileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
use GuzzleHttp\Psr7\StreamWrapper;
use GuzzleHttp\Psr7\Utils;
use League\Flysystem\Config;
use League\Flysystem\FilesystemAdapter;
use League\Flysystem\FilesystemException;
use Webf\FlysystemFailoverBundle\Flysystem\FailoverAdaptersLocatorInterface;
use Webf\FlysystemFailoverBundle\Message\ReplicateFile;
use Webf\FlysystemFailoverBundle\MessageRepository\MessageRepositoryInterface;

class ReplicateFileHandler implements MessageHandlerInterface
{
/**
* @template T of FilesystemAdapter
*
* @param FailoverAdaptersLocatorInterface<T> $adaptersLocator
*/
public function __construct(
private FailoverAdaptersLocatorInterface $adaptersLocator,
private MessageRepositoryInterface $messageRepository,
Expand Down
8 changes: 7 additions & 1 deletion src/Service/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Webf\FlysystemFailoverBundle\Service;

use League\Flysystem\FilesystemAdapter;
use League\Flysystem\FilesystemException;
use League\Flysystem\StorageAttributes;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -28,6 +29,11 @@ class SyncService
public const EXTRA_FILES_DELETE = 'delete';
public const EXTRA_FILES_IGNORE = 'ignore';

/**
* @template T of FilesystemAdapter
*
* @param FailoverAdaptersLocatorInterface<T> $failoverAdaptersLocator
*/
public function __construct(
private EventDispatcherInterface $eventDispatcher,
private FailoverAdaptersLocatorInterface $failoverAdaptersLocator,
Expand Down Expand Up @@ -88,7 +94,7 @@ public function addFile(StorageAttributes $file, int $adapter, int $timeShift):
{
$lastModified = $file->lastModified();

$this->cache[$adapter][$file->path()] = $lastModified
$this->cache[$adapter][$file->path()] = $lastModified !== null
? $lastModified - $timeShift
: 0;
}
Expand Down

0 comments on commit 2679d46

Please sign in to comment.