Skip to content

Commit

Permalink
IBX-1687: Added Ibexa\Contracts\Core\FieldType\StorageGatewayInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p authored Dec 13, 2021
1 parent ada0655 commit 3d4ee58
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/contracts/FieldType/GatewayBasedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
/**
* Field Type External Storage gateway base class.
*
* @template T of \Ibexa\Contracts\Core\FieldType\StorageGateway
* @template T of \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface
*/
abstract class GatewayBasedStorage implements FieldStorage
{
/**
* Field Type External Storage Gateway.
*
* @var \Ibexa\Contracts\Core\FieldType\StorageGateway
* @var \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface
* @phpstan-var T
*/
protected $gateway;

/**
* @param \Ibexa\Contracts\Core\FieldType\StorageGateway $gateway
* @param \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface $gateway
* @phpstan-param T $gateway
*/
public function __construct(StorageGateway $gateway)
public function __construct(StorageGatewayInterface $gateway)
{
$this->gateway = $gateway;
}
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/FieldType/StorageGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* Base class for FieldType external storage gateways.
*/
abstract class StorageGateway
abstract class StorageGateway implements StorageGatewayInterface
{
/**
* Get sequence name bound to database table and column.
Expand Down
13 changes: 13 additions & 0 deletions src/contracts/FieldType/StorageGatewayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\Core\FieldType;

interface StorageGatewayInterface
{
}
6 changes: 3 additions & 3 deletions src/lib/FieldType/BinaryBase/BinaryBaseStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator;
use Ibexa\Contracts\Core\FieldType\BinaryBase\RouteAwarePathGenerator;
use Ibexa\Contracts\Core\FieldType\GatewayBasedStorage;
use Ibexa\Contracts\Core\FieldType\StorageGateway;
use Ibexa\Contracts\Core\FieldType\StorageGatewayInterface;
use Ibexa\Contracts\Core\IO\MimeTypeDetector;
use Ibexa\Contracts\Core\Persistence\Content\Field;
use Ibexa\Contracts\Core\Persistence\Content\VersionInfo;
Expand Down Expand Up @@ -42,13 +42,13 @@ class BinaryBaseStorage extends GatewayBasedStorage
/**
* Construct from gateways.
*
* @param \Ibexa\Contracts\Core\FieldType\StorageGateway $gateway
* @param \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface $gateway
* @param \Ibexa\Core\IO\IOServiceInterface $ioService
* @param \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator $pathGenerator
* @param \Ibexa\Contracts\Core\IO\MimeTypeDetector $mimeTypeDetector
*/
public function __construct(
StorageGateway $gateway,
StorageGatewayInterface $gateway,
IOServiceInterface $ioService,
PathGenerator $pathGenerator,
MimeTypeDetector $mimeTypeDetector
Expand Down
4 changes: 2 additions & 2 deletions src/lib/FieldType/Image/ImageStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Ibexa\Core\FieldType\Image;

use Ibexa\Contracts\Core\FieldType\GatewayBasedStorage;
use Ibexa\Contracts\Core\FieldType\StorageGateway;
use Ibexa\Contracts\Core\FieldType\StorageGatewayInterface;
use Ibexa\Contracts\Core\Persistence\Content\Field;
use Ibexa\Contracts\Core\Persistence\Content\VersionInfo;
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
Expand Down Expand Up @@ -43,7 +43,7 @@ class ImageStorage extends GatewayBasedStorage
protected $filePathNormalizer;

public function __construct(
StorageGateway $gateway,
StorageGatewayInterface $gateway,
IOServiceInterface $ioService,
PathGenerator $pathGenerator,
MetadataHandler $imageSizeMetadataHandler,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/StorageGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Abstract base class for storage gateways.
*
* @deprecated Since 6.11. Extend {@link \Ibexa\Contracts\Core\FieldType\StorageGateway} class instead.
* @deprecated Since 6.11. Extend {@link \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface} class instead.
*/
abstract class StorageGateway extends SPIStorageGateway
{
Expand Down
6 changes: 3 additions & 3 deletions src/lib/FieldType/Url/UrlStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Ibexa\Core\FieldType\Url;

use Ibexa\Contracts\Core\FieldType\GatewayBasedStorage;
use Ibexa\Contracts\Core\FieldType\StorageGateway;
use Ibexa\Contracts\Core\FieldType\StorageGatewayInterface;
use Ibexa\Contracts\Core\Persistence\Content\Field;
use Ibexa\Contracts\Core\Persistence\Content\VersionInfo;
use Psr\Log\LoggerInterface;
Expand All @@ -26,10 +26,10 @@ class UrlStorage extends GatewayBasedStorage
/**
* Construct from gateways.
*
* @param \Ibexa\Contracts\Core\FieldType\StorageGateway $gateway
* @param \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface $gateway
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(StorageGateway $gateway, LoggerInterface $logger = null)
public function __construct(StorageGatewayInterface $gateway, LoggerInterface $logger = null)
{
parent::__construct($gateway);
$this->logger = $logger;
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/FieldType/Url/UrlStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
namespace Ibexa\Tests\Core\FieldType\Url;

use Ibexa\Contracts\Core\FieldType\StorageGateway;
use Ibexa\Contracts\Core\FieldType\StorageGatewayInterface;
use Ibexa\Contracts\Core\Persistence\Content\Field;
use Ibexa\Contracts\Core\Persistence\Content\FieldValue;
use Ibexa\Contracts\Core\Persistence\Content\VersionInfo;
Expand Down Expand Up @@ -211,11 +211,11 @@ public function testHasFieldData()
}

/**
* @param \Ibexa\Contracts\Core\FieldType\StorageGateway $gateway
* @param \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface $gateway
*
* @return \Ibexa\Core\FieldType\Url\UrlStorage|\PHPUnit\Framework\MockObject\MockObject
*/
protected function getPartlyMockedStorage(StorageGateway $gateway)
protected function getPartlyMockedStorage(StorageGatewayInterface $gateway)
{
return $this->getMockBuilder(UrlStorage::class)
->setMethods(null)
Expand Down

0 comments on commit 3d4ee58

Please sign in to comment.