8000 [Cache] make RelayProxyTrait compatible with relay extension 0.9.0 by xabbuh · Pull Request #58938 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Cache] make RelayProxyTrait compatible with relay extension 0.9.0 #58938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
/**
* @internal
*/
trait CopyTrait
{
public function copy($src, $dst, $options = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait CopyTrait

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\CopyTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php (see https://psalm.dev/071)

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\CopyTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/CopyTrait.php (see https://psalm.dev/071)
{
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
}
}
36 changes: 36 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
< 8000 /td> */

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait GeosearchTrait
{
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait GeosearchTrait

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\GeosearchTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php (see https://psalm.dev/071)

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\GeosearchTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/GeosearchTrait.php (see https://psalm.dev/071)
{
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
}
}
}
36 changes: 36 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait GetrangeTrait
{
public function getrange($key, $start, $end): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait GetrangeTrait

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\GetrangeTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php (see https://psalm.dev/071)

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\GetrangeTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/GetrangeTrait.php (see https://psalm.dev/071)
{
public function getrange($key, $start, $end): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
}
}
}
36 changes: 36 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/HsetTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait HsetTrait
{
public function hset($key, ...$keys_and_vals): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait HsetTrait

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/HsetTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/HsetTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\HsetTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/HsetTrait.php (see https://psalm.dev/071)
{
public function hset($key, $mem, $val, ...$kvals): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
}
}
}
46 changes: 46 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/MoveTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait MoveTrait
{
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
}

public function lmove($srckey, $dstkey, $srcpos, $dstpos): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait MoveTrait

Check failure on line 34 in src/Symfony/Component/Cache/Traits/Relay/MoveTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/MoveTrait.php:34:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\MoveTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/MoveTrait.php (see https://psalm.dev/071)
{
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|null|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
}

public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|null|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
}
}
}
96 changes: 96 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/NullableReturnTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait NullableReturnTrait
{
public function dump($key): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
}

public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
}

public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
}

public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
}

public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
}

public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
}

public function zscore($key, $member): \Relay\Relay|false|float|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait NullableReturnTrait

Check failure on line 59 in src/Symfony/Component/Cache/Traits/Relay/NullableReturnTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/NullableReturnTrait.php:59:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\NullableReturnTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/NullableReturnTrait.php (see https://psalm.dev/071)
{
public function dump($key): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
}

public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
}

public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
}

public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
}

public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
}

public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
}

public function zscore($key, $member): \Relay\Relay|false|float
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
}
}
}
36 changes: 36 additions & 0 deletions src/Symfony/Component/Cache/Traits/Relay/PfcountTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Cache\Traits\Relay;

if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait PfcountTrait
{
public function pfcount($key_or_keys): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait PfcountTrait

Check failure on line 29 in src/Symfony/Component/Cache/Traits/Relay/PfcountTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

DuplicateClass

src/Symfony/Component/Cache/Traits/Relay/PfcountTrait.php:29:11: DuplicateClass: Class Symfony\Component\Cache\Traits\Relay\PfcountTrait has already been defined in /home/runner/work/symfony/symfony/src/Symfony/Component/Cache/Traits/Relay/PfcountTrait.php (see https://psalm.dev/071)
{
public function pfcount($key): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
}
}
}
Loading
Loading
0