bearsunday /
BEAR.QueryRepository
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | namespace BEAR\QueryRepository; |
||||
| 6 | |||||
| 7 | use BEAR\QueryRepository\HttpCacheInterface as DeprecatedHttpCacheInterface; |
||||
| 8 | use BEAR\Sunday\Extension\Transfer\HttpCacheInterface; |
||||
|
0 ignored issues
–
show
|
|||||
| 9 | use Override; |
||||
| 10 | |||||
| 11 | use function http_response_code; |
||||
| 12 | |||||
| 13 | /** @psalm-suppress DeprecatedInterface for BC */ |
||||
| 14 | final class HttpCache implements HttpCacheInterface, DeprecatedHttpCacheInterface |
||||
|
0 ignored issues
–
show
The interface
BEAR\QueryRepository\HttpCacheInterface has been deprecated: Use \BEAR\Sunday\Extension\Transfer\HttpCacheInterface instead
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This interface has been deprecated. The supplier of the interface has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead. Loading history...
|
|||||
| 15 | { |
||||
| 16 | public function __construct( |
||||
| 17 | private readonly ResourceStorageInterface $storage, |
||||
| 18 | ) { |
||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * {@inheritDoc} |
||||
| 23 | */ |
||||
| 24 | #[Override] |
||||
| 25 | public function isNotModified(array $server): bool |
||||
| 26 | { |
||||
| 27 | return isset($server[Header::HTTP_IF_NONE_MATCH]) && $this->storage->hasEtag($server[Header::HTTP_IF_NONE_MATCH]); |
||||
| 28 | } |
||||
| 29 | |||||
| 30 | /** |
||||
| 31 | * {@inheritDoc} |
||||
| 32 | * |
||||
| 33 | * @return void |
||||
| 34 | */ |
||||
| 35 | #[Override] |
||||
| 36 | public function transfer() |
||||
| 37 | { |
||||
| 38 | // @codeCoverageIgnoreStart |
||||
| 39 | http_response_code(304); |
||||
| 40 | // @codeCoverageIgnoreEnd |
||||
| 41 | } |
||||
| 42 | } |
||||
| 43 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: