-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Declare ext/spl constants in stubs #9226
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -150,6 +150,67 @@ public function __toString(): string {} | |||||
|
||||||
class FilesystemIterator extends DirectoryIterator | ||||||
{ | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_CURRENT_MODE_MASK | ||||||
*/ | ||||||
public const CURRENT_MODE_MASK = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_CURRENT_AS_PATHNAME | ||||||
*/ | ||||||
public const CURRENT_AS_PATHNAME = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_CURRENT_AS_FILEINFO | ||||||
*/ | ||||||
public const CURRENT_AS_FILEINFO = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_CURRENT_AS_SELF | ||||||
*/ | ||||||
public const CURRENT_AS_SELF = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_KEY_MODE_MASK | ||||||
*/ | ||||||
public const KEY_MODE_MASK = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_KEY_AS_PATHNAME | ||||||
*/ | ||||||
public const KEY_AS_PATHNAME = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_FOLLOW_SYMLINKS | ||||||
*/ | ||||||
public const FOLLOW_SYMLINKS = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_KEY_AS_FILENAME | ||||||
*/ | ||||||
public const KEY_AS_FILENAME = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_NEW_CURRENT_AND_KEY | ||||||
*/ | ||||||
public const NEW_CURRENT_AND_KEY = UNKNOWN; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Would be the idea There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, great idea, I'll try it if gen_stub properly support it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, unfortunately, constant evaluation doesn't work properly :( So I'll stay with my original implementation |
||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_OTHERS_MASK | ||||||
*/ | ||||||
public const OTHER_MODE_MASK = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_SKIPDOTS | ||||||
*/ | ||||||
public const SKIP_DOTS = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_DIR_UNIXPATHS | ||||||
*/ | ||||||
public const UNIX_PATHS = UNKNOWN; | ||||||
|
||||||
public function __construct(string $directory, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS) {} | ||||||
|
||||||
/** @tentative-return-type */ | ||||||
|
@@ -197,6 +258,27 @@ 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; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_OBJECT_READ_AHEAD | ||||||
*/ | ||||||
public const READ_AHEAD = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_OBJECT_SKIP_EMPTY | ||||||
*/ | ||||||
public const SKIP_EMPTY = UNKNOWN; | ||||||
/** | ||||||
* @var int | ||||||
* @cvalue SPL_FILE_OBJECT_READ_CSV | ||||||
*/ | ||||||
public const READ_CSV = UNKNOWN; | ||||||
|
||||||
/** @param resource|null $context */ | ||||||
public function __construct(string $filename, string $mode = "r", bool $useIncludePath = false, $context = null) {} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this even need to be defined? Wouldn't it be possible to compose the constant values in the stub? (or am I asking for a feature which does not yet exist)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's not strictly required to have, but I prefer not to put too much C code into stubs, so I usually create a new macro when an expression needs to be used.