Skip to content

Update fileinfo names #6206

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions ext/fileinfo/fileinfo.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
class finfo
{
/** @alias finfo_open */
public function __construct(int $options = FILEINFO_NONE, string $arg = "") {}
public function __construct(int $flags = FILEINFO_NONE, string $magic_database = "") {}

/**
* @param resource|null $context
* @return string|false
* @alias finfo_file
*/
public function file(string $file_name, int $options = FILEINFO_NONE, $context = null) {}
public function file(string $filename, int $flags = FILEINFO_NONE, $context = null) {}

/**
* @param resource|null $context
* @return string|false
* @alias finfo_buffer
*/
public function buffer(string $string, int $options = FILEINFO_NONE, $context = null) {}
public function buffer(string $string, int $flags = FILEINFO_NONE, $context = null) {}

/**
* @return bool
* @alias finfo_set_flags
*/
public function set_flags(int $options) {}
public function set_flags(int $flags) {}
}

/** @return resource|false */
function finfo_open(int $options = FILEINFO_NONE, string $arg = "") {}
function finfo_open(int $flags = FILEINFO_NONE, string $magic_database = "") {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect! :)


/**
* @param resource $finfo
Expand All @@ -39,19 +39,19 @@ function finfo_close($finfo): bool {}
/**
* @param resource $finfo
*/
function finfo_set_flags($finfo, int $options): bool {}
function finfo_set_flags($finfo, int $flags): bool {}

/**
* @param resource $finfo
* @param resource|null $context
*/
function finfo_file($finfo, string $file_name, int $options = FILEINFO_NONE, $context = null): string|false {}
function finfo_file($finfo, string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}

/**
* @param resource $finfo
* @param resource|null $context
*/
function finfo_buffer($finfo, string $string, int $options = FILEINFO_NONE, $context = null): string|false {}
function finfo_buffer($finfo, string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}

/**
* @param resource|string $filename
Expand Down
22 changes: 11 additions & 11 deletions ext/fileinfo/fileinfo_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b8bfd01bd5a9a181550160e39c50a8cc047f15cd */
* Stub hash: be858509df27550b51d8a7a51a3629eceb6d0aa6 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, arg, IS_STRING, 0, "\"\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 0, "\"\"")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)
Expand All @@ -12,20 +12,20 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_set_flags, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, finfo)
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_finfo_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, finfo)
ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_finfo_buffer, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, finfo)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
ZEND_END_ARG_INFO()

Expand All @@ -36,19 +36,19 @@ ZEND_END_ARG_INFO()
#define arginfo_class_finfo___construct arginfo_finfo_open

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_file, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_buffer, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_set_flags, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()


Expand Down
2 changes: 1 addition & 1 deletion ext/fileinfo/tests/finfo_open_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));

?>
--EXPECTF--
finfo_open(): Argument #2 ($arg) must not contain any null bytes
finfo_open(): Argument #2 ($magic_database) must not contain any null bytes
resource(%d) of type (file_info)
resource(%d) of type (file_info)

Expand Down
4 changes: 2 additions & 2 deletions ext/fileinfo/tests/finfo_open_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ bool(false)

Warning: finfo_open(): using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
resource(6) of type (file_info)
finfo_open(): Argument #1 ($options) must be of type int, string given
finfo::__construct(): Argument #1 ($options) must be of type int, string given
finfo_open(): Argument #1 ($flags) must be of type int, string given
finfo::__construct(): Argument #1 ($flags) must be of type int, string given