Skip to content

Commit

Permalink
Merge pull request #43 from samsonasik/apply-php74
Browse files Browse the repository at this point in the history
Apply PHP 7.4 syntax and typed property
  • Loading branch information
Ocramius authored Sep 20, 2022
2 parents 042ca1b + 433fd02 commit c717b67
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/Apcu.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class Apcu extends AbstractAdapter implements
*
* @var null|int|float
*/
protected $totalSpace;
private $totalSpace;

/**
* Constructor
Expand Down Expand Up @@ -731,7 +731,7 @@ protected function internalGetCapabilities()
);

// update namespace separator on change option
$this->getEventManager()->attach('option', function ($event) use ($capabilities, $marker) {
$this->getEventManager()->attach('option', static function ($event) use ($capabilities, $marker): void {
$params = $event->getParams();

if (isset($params['namespace_separator'])) {
Expand Down
16 changes: 5 additions & 11 deletions src/ApcuIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Laminas\Cache\Storage\Adapter;

use APCUIterator as BaseApcuIterator;
use Laminas\Cache\Storage\Adapter\Apcu;
use Laminas\Cache\Storage\IteratorInterface;
use ReturnTypeWillChange;

Expand All @@ -15,32 +16,25 @@ final class ApcuIterator implements IteratorInterface
{
/**
* The storage instance
*
* @var Apcu
*/
private $storage;
private Apcu $storage;

/**
* The iterator mode
*
* @var int
* @psalm-var IteratorInterface::CURRENT_AS_*
*/
private $mode = IteratorInterface::CURRENT_AS_KEY;
private int $mode = IteratorInterface::CURRENT_AS_KEY;

/**
* The base APCIterator instance
*
* @var BaseApcuIterator
*/
private $baseIterator;
private BaseApcuIterator $baseIterator;

/**
* The length of the namespace prefix
*
* @var int
*/
private $prefixLength;
private int $prefixLength;

public function __construct(Apcu $storage, BaseApcuIterator $baseIterator, string $prefix)
{
Expand Down
4 changes: 1 addition & 3 deletions test/integration/Psr/CacheItemPool/ApcuIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ final class ApcuIntegrationTest extends AbstractCacheItemPoolIntegrationTest
{
/**
* Restore 'apc.use_request_time'
*
* @var string
*/
protected $iniUseRequestTime;
private string $iniUseRequestTime;

public function testApcUseRequestTimeThrowsException(): void
{
Expand Down
3 changes: 1 addition & 2 deletions test/unit/Apcu/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

final class ConfigProviderTest extends TestCase
{
/** @var ConfigProvider */
private $provider;
private ConfigProvider $provider;

protected function setUp(): void
{
Expand Down
3 changes: 1 addition & 2 deletions test/unit/Apcu/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

final class ModuleTest extends TestCase
{
/** @var Module */
private $module;
private Module $module;

protected function setUp(): void
{
Expand Down
4 changes: 1 addition & 3 deletions test/unit/ApcuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ final class ApcuTest extends AbstractCommonAdapterTest
{
/**
* Restore 'apc.use_request_time'
*
* @var string
*/
protected $iniUseRequestTime;
private string $iniUseRequestTime;

public function setUp(): void
{
Expand Down

0 comments on commit c717b67

Please sign in to comment.