Skip to content
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

Typed constants in SPL extension #12358

Merged
merged 3 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 5 additions & 10 deletions ext/spl/spl_array.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable
{
/**
* @var int
* @cvalue SPL_ARRAY_STD_PROP_LIST
jorgsowa marked this conversation as resolved.
Show resolved Hide resolved
*/
const STD_PROP_LIST = UNKNOWN;
public const int STD_PROP_LIST = UNKNOWN;
/**
* @var int
* @cvalue SPL_ARRAY_ARRAY_AS_PROPS
*/
const ARRAY_AS_PROPS = UNKNOWN;
public const int ARRAY_AS_PROPS = UNKNOWN;

public function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class) {}

Expand Down Expand Up @@ -93,15 +91,13 @@ public function __debugInfo(): array {}
class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable
{
/**
* @var int
* @cvalue SPL_ARRAY_STD_PROP_LIST
*/
public const STD_PROP_LIST = UNKNOWN;
public const int STD_PROP_LIST = UNKNOWN;
/**
* @var int
* @cvalue SPL_ARRAY_ARRAY_AS_PROPS
*/
public const ARRAY_AS_PROPS = UNKNOWN;
public const int ARRAY_AS_PROPS = UNKNOWN;

public function __construct(array|object $array = [], int $flags = 0) {}

Expand Down Expand Up @@ -247,10 +243,9 @@ public function __debugInfo(): array {}
class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
{
/**
* @var int
* @cvalue SPL_ARRAY_CHILD_ARRAYS_ONLY
*/
public const CHILD_ARRAYS_ONLY = UNKNOWN;
public const int CHILD_ARRAYS_ONLY = UNKNOWN;

/** @tentative-return-type */
public function hasChildren(): bool {}
Expand Down
12 changes: 6 additions & 6 deletions ext/spl/spl_array_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 16 additions & 32 deletions ext/spl/spl_directory.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,65 +151,53 @@ public function __toString(): string {}
class FilesystemIterator extends DirectoryIterator
{
/**
* @var int
* @cvalue SPL_FILE_DIR_CURRENT_MODE_MASK
*/
public const CURRENT_MODE_MASK = UNKNOWN;
public const int CURRENT_MODE_MASK = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_CURRENT_AS_PATHNAME
*/
public const CURRENT_AS_PATHNAME = UNKNOWN;
public const int CURRENT_AS_PATHNAME = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_CURRENT_AS_FILEINFO
*/
public const CURRENT_AS_FILEINFO = UNKNOWN;
public const int CURRENT_AS_FILEINFO = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_CURRENT_AS_SELF
*/
public const CURRENT_AS_SELF = UNKNOWN;
public const int CURRENT_AS_SELF = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_KEY_MODE_MASK
*/
public const KEY_MODE_MASK = UNKNOWN;
public const int KEY_MODE_MASK = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_KEY_AS_PATHNAME
*/
public const KEY_AS_PATHNAME = UNKNOWN;
public const int KEY_AS_PATHNAME = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_FOLLOW_SYMLINKS
*/
public const FOLLOW_SYMLINKS = UNKNOWN;
public const int FOLLOW_SYMLINKS = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_KEY_AS_FILENAME
*/
public const KEY_AS_FILENAME = UNKNOWN;
public const int KEY_AS_FILENAME = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_NEW_CURRENT_AND_KEY
*/
public const NEW_CURRENT_AND_KEY = UNKNOWN;
public const int NEW_CURRENT_AND_KEY = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_OTHERS_MASK
*/
public const OTHER_MODE_MASK = UNKNOWN;
public const int OTHER_MODE_MASK = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_SKIPDOTS
*/
public const SKIP_DOTS = UNKNOWN;
public const int SKIP_DOTS = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_DIR_UNIXPATHS
*/
public const UNIX_PATHS = UNKNOWN;
public const int UNIX_PATHS = UNKNOWN;

public function __construct(string $directory, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS) {}

Expand Down Expand Up @@ -259,25 +247,21 @@ public function count(): int {}
class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator
{
/**
* @var int
* @cvalue SPL_FILE_OBJECT_DROP_NEW_LINE
*/
public const DROP_NEW_LINE = UNKNOWN;
public const int DROP_NEW_LINE = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_OBJECT_READ_AHEAD
*/
public const READ_AHEAD = UNKNOWN;
public const int READ_AHEAD = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_OBJECT_SKIP_EMPTY
*/
public const SKIP_EMPTY = UNKNOWN;
public const int SKIP_EMPTY = UNKNOWN;
/**
* @var int
* @cvalue SPL_FILE_OBJECT_READ_CSV
*/
public const READ_CSV = UNKNOWN;
public const int READ_CSV = UNKNOWN;

/** @param resource|null $context */
public function __construct(string $filename, string $mode = "r", bool $useIncludePath = false, $context = null) {}
Expand Down
34 changes: 17 additions & 17 deletions ext/spl/spl_directory_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions ext/spl/spl_dllist.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@
class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable
{
/**
* @var int
* @cvalue SPL_DLLIST_IT_LIFO
*/
public const IT_MODE_LIFO = UNKNOWN;
public const int IT_MODE_LIFO = UNKNOWN;
/**
* @var int
* @cvalue SPL_DLLIST_IT_FIFO
*/
public const IT_MODE_FIFO = UNKNOWN;
public const int IT_MODE_FIFO = UNKNOWN;
/**
* @var int
* @cvalue SPL_DLLIST_IT_DELETE
*/
public const IT_MODE_DELETE = UNKNOWN;
public const int IT_MODE_DELETE = UNKNOWN;
/**
* @var int
* @cvalue SPL_DLLIST_IT_KEEP
*/
public const IT_MODE_KEEP = UNKNOWN;
public const int IT_MODE_KEEP = UNKNOWN;

/** @tentative-return-type */
public function add(int $index, mixed $value): void {}
Expand Down
Loading