Skip to content

Commit

Permalink
Merge pull request #7982 from KevinVanSonsbeek/bugfix/#7912-class-APC…
Browse files Browse the repository at this point in the history
…uIterator-does-not-exist

Bugfix/#7912 class APCuIterator does not exist
  • Loading branch information
orklah committed May 18, 2022
2 parents 894e4e4 + 23eff58 commit 5c1d95b
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,11 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):
$this->internal_stubs[] = $ext_phpredis_path;
}

if (extension_loaded('apcu')) {
$ext_apcu_path = $dir_lvl_2 . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'ext-apcu.phpstub';
$this->internal_stubs[] = $ext_apcu_path;
}

foreach ($this->internal_stubs as $stub_path) {
if (!file_exists($stub_path)) {
throw new UnexpectedValueException('Cannot locate ' . $stub_path);
Expand Down
92 changes: 92 additions & 0 deletions stubs/ext-apcu.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

define('APC_LIST_ACTIVE', 1);
define('APC_LIST_DELETED', 2);
define('APC_ITER_TYPE', 1);
define('APC_ITER_KEY', 2);
define('APC_ITER_FILENAME', 4);
define('APC_ITER_DEVICE', 8);
define('APC_ITER_INODE', 16);
define('APC_ITER_VALUE', 32);
define('APC_ITER_MD5', 64);
define('APC_ITER_NUM_HITS', 128);
define('APC_ITER_MTIME', 256);
define('APC_ITER_CTIME', 512);
define('APC_ITER_DTIME', 1024);
define('APC_ITER_ATIME', 2048);
define('APC_ITER_REFCOUNT', 4096);
define('APC_ITER_MEM_SIZE', 8192);
define('APC_ITER_TTL', 16384);
define('APC_ITER_NONE', 0);
define('APC_ITER_ALL', -1);

class APCUIterator implements Iterator
{
/**
* @param array<string>|null|string $search
* @param int $format
* @param int $chunk_size
* @param int $list
*
* @return void
*/
public function __construct($search, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE)
{
}

/**
* @return void
*/
public function rewind()
{
}

/**
* @return void
*/
public function next()
{
}

/**
* @return bool
*/
public function valid()
{
}

/**
* @return string
*/
public function key()
{
}

/**
* @return mixed
*/
public function current()
{
}

/**
* @return int
*/
public function getTotalHits()
{
}

/**
* @return int
*/
public function getTotalSize()
{
}

/**
* @return int
*/
public function getTotalCount()
{
}
}

0 comments on commit 5c1d95b

Please sign in to comment.