bug #36908 [Cache][HttpClient] Made method signatures compatible with their corresponding traits (derrabus)
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache][HttpClient] Made method signatures compatible with their corresponding traits
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #36872
| License | MIT
| Doc PR | N/A
Apparently, php 8 is less forgiving about method signature differences between a trait and the class that uses the trait. This PR makes minimal adjustments to get rid of fatal errors triggered by php 8.
Commits
-------
6fda276feb
Made method signatures compatible with their corresponding traits.
This commit is contained in:
commit
a25e88b485
@ -79,7 +79,7 @@ class Psr16Adapter extends AbstractAdapter implements PruneableInterface, Resett
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime);
|
return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ trait AbstractTrait
|
|||||||
*
|
*
|
||||||
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
||||||
*/
|
*/
|
||||||
abstract protected function doSave(array $values, $lifetime);
|
abstract protected function doSave(array $values, ?int $lifetime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -101,7 +101,7 @@ trait ApcuTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (false === $failures = apcu_store($values, null, $lifetime)) {
|
if (false === $failures = apcu_store($values, null, $lifetime)) {
|
||||||
|
@ -91,7 +91,7 @@ trait DoctrineTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
return $this->provider->saveMultiple($values, $lifetime);
|
return $this->provider->saveMultiple($values, $lifetime);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ trait FilesystemTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
$expiresAt = $lifetime ? (time() + $lifetime) : 0;
|
$expiresAt = $lifetime ? (time() + $lifetime) : 0;
|
||||||
$values = $this->marshaller->marshall($values, $failed);
|
$values = $this->marshaller->marshall($values, $failed);
|
||||||
|
@ -223,7 +223,7 @@ trait MemcachedTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -275,7 +275,7 @@ trait PdoTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -194,7 +194,7 @@ trait PhpFilesTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
$ok = true;
|
$ok = true;
|
||||||
$expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX';
|
$expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX';
|
||||||
|
@ -404,7 +404,7 @@ trait RedisTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, $lifetime)
|
protected function doSave(array $values, ?int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface;
|
|||||||
use Symfony\Component\HttpClient\Chunk\FirstChunk;
|
use Symfony\Component\HttpClient\Chunk\FirstChunk;
|
||||||
use Symfony\Component\HttpClient\Chunk\InformationalChunk;
|
use Symfony\Component\HttpClient\Chunk\InformationalChunk;
|
||||||
use Symfony\Component\HttpClient\Exception\TransportException;
|
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||||
|
use Symfony\Component\HttpClient\Internal\ClientState;
|
||||||
use Symfony\Component\HttpClient\Internal\CurlClientState;
|
use Symfony\Component\HttpClient\Internal\CurlClientState;
|
||||||
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||||
@ -242,8 +243,10 @@ final class CurlResponse implements ResponseInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @param CurlClientState $multi
|
||||||
*/
|
*/
|
||||||
private static function perform(CurlClientState $multi, array &$responses = null): void
|
private static function perform(ClientState $multi, array &$responses = null): void
|
||||||
{
|
{
|
||||||
if (self::$performing) {
|
if (self::$performing) {
|
||||||
if ($responses) {
|
if ($responses) {
|
||||||
@ -289,8 +292,10 @@ final class CurlResponse implements ResponseInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @param CurlClientState $multi
|
||||||
*/
|
*/
|
||||||
private static function select(CurlClientState $multi, float $timeout): int
|
private static function select(ClientState $multi, float $timeout): int
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID < 70123 || (70200 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70211)) {
|
if (\PHP_VERSION_ID < 70123 || (70200 <= \PHP_VERSION_ID && \PHP_VERSION_ID < 70211)) {
|
||||||
// workaround https://bugs.php.net/76480
|
// workaround https://bugs.php.net/76480
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\HttpClient\Response;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\HttpClient\Chunk\FirstChunk;
|
use Symfony\Component\HttpClient\Chunk\FirstChunk;
|
||||||
use Symfony\Component\HttpClient\Exception\TransportException;
|
use Symfony\Component\HttpClient\Exception\TransportException;
|
||||||
|
use Symfony\Component\HttpClient\Internal\ClientState;
|
||||||
use Symfony\Component\HttpClient\Internal\NativeClientState;
|
use Symfony\Component\HttpClient\Internal\NativeClientState;
|
||||||
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||||
@ -214,8 +215,10 @@ final class NativeResponse implements ResponseInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @param NativeClientState $multi
|
||||||
*/
|
*/
|
||||||
private static function perform(NativeClientState $multi, array &$responses = null): void
|
private static function perform(ClientState $multi, array &$responses = null): void
|
||||||
{
|
{
|
||||||
// List of native handles for stream_select()
|
// List of native handles for stream_select()
|
||||||
if (null !== $responses) {
|
if (null !== $responses) {
|
||||||
@ -326,8 +329,10 @@ final class NativeResponse implements ResponseInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @param NativeClientState $multi
|
||||||
*/
|
*/
|
||||||
private static function select(NativeClientState $multi, float $timeout): int
|
private static function select(ClientState $multi, float $timeout): int
|
||||||
{
|
{
|
||||||
$_ = [];
|
$_ = [];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user