-
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
Conversation
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.
LGTM with a couple of additional comments
@@ -105,6 +105,7 @@ struct _spl_filesystem_object { | |||
#define SPL_FILE_DIR_KEY_AS_PATHNAME 0x00000000 /* make RecursiveDirectoryTree::key() return getPathname() */ | |||
#define SPL_FILE_DIR_KEY_AS_FILENAME 0x00000100 /* make RecursiveDirectoryTree::key() return getFilename() */ | |||
#define SPL_FILE_DIR_KEY_MODE_MASK 0x00000F00 /* mask RecursiveDirectoryTree::key() */ | |||
#define SPL_FILE_NEW_CURRENT_AND_KEY SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO |
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.
* @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 comment
The reason will be displayed to describe this comment to others. Learn more.
public const NEW_CURRENT_AND_KEY = UNKNOWN; | |
public const NEW_CURRENT_AND_KEY = self::CURRENT_AS_FILEINFO|self::KEY_AS_FILENAME; |
Would be the idea
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.
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 comment
The 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
No description provided.