Skip to content

Update ext/tidy parameter names #6283

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
2 changes: 1 addition & 1 deletion ext/tidy/tests/021.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ var_dump($t->getOptDoc('ncr'));
var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99);
?>
--EXPECT--
tidy_get_opt_doc(): Argument #2 ($optname) is an invalid configuration option, "some_bogus_cfg" given
tidy_get_opt_doc(): Argument #2 ($option) is an invalid configuration option, "some_bogus_cfg" given
string(73) "This option specifies if Tidy should allow numeric character references. "
bool(true)
56 changes: 28 additions & 28 deletions ext/tidy/tidy.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,59 @@

/** @generate-function-entries */

function tidy_parse_string(string $input, array|string|null $config_options = null, ?string $encoding = null): tidy|false {}
function tidy_parse_string(string $string, array|string|null $config = null, ?string $encoding = null): tidy|false {}
Copy link
Member Author

Choose a reason for hiding this comment

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

I was a bit unsure about $config vs $options here. I went with $config, because this parameter accepts either a path to a config file, or a config options array.


function tidy_get_error_buffer(tidy $object): string|false {}
function tidy_get_error_buffer(tidy $tidy): string|false {}

function tidy_get_output(tidy $object): string {}
function tidy_get_output(tidy $tidy): string {}

function tidy_parse_file(string $file, array|string|null $config_options = null, ?string $encoding = null, bool $use_include_path = false): tidy|false {}
function tidy_parse_file(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false): tidy|false {}

function tidy_clean_repair(tidy $object): bool {}
function tidy_clean_repair(tidy $tidy): bool {}

function tidy_repair_string(string $data, array|string|null $config_options = null, ?string $encoding = null): string|false {}
function tidy_repair_string(string $string, array|string|null $config = null, ?string $encoding = null): string|false {}

function tidy_repair_file(string $filename, array|string|null $config_options = null, ?string $encoding = null, bool $use_include_path = false): string|false {}
function tidy_repair_file(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false): string|false {}

function tidy_diagnose(tidy $object): bool {}
function tidy_diagnose(tidy $tidy): bool {}

function tidy_get_release(): string {}

#ifdef HAVE_TIDYOPTGETDOC
function tidy_get_opt_doc(tidy $object, string $optname): string|false {}
function tidy_get_opt_doc(tidy $tidy, string $option): string|false {}
#endif

function tidy_get_config(tidy $object): array {}
function tidy_get_config(tidy $tidy): array {}

function tidy_get_status(tidy $object): int {}
function tidy_get_status(tidy $tidy): int {}

function tidy_get_html_ver(tidy $object): int {}
function tidy_get_html_ver(tidy $tidy): int {}

function tidy_is_xhtml(tidy $object): bool {}
function tidy_is_xhtml(tidy $tidy): bool {}

function tidy_is_xml(tidy $object): bool {}
function tidy_is_xml(tidy $tidy): bool {}

function tidy_error_count(tidy $object): int {}
function tidy_error_count(tidy $tidy): int {}

function tidy_warning_count(tidy $object): int {}
function tidy_warning_count(tidy $tidy): int {}

function tidy_access_count(tidy $object): int {}
function tidy_access_count(tidy $tidy): int {}

function tidy_config_count(tidy $object): int {}
function tidy_config_count(tidy $tidy): int {}

function tidy_getopt(tidy $object, string $option): string|int|bool {}
function tidy_getopt(tidy $tidy, string $option): string|int|bool {}

function tidy_get_root(tidy $object): ?tidyNode {}
function tidy_get_root(tidy $tidy): ?tidyNode {}

function tidy_get_html(tidy $object): ?tidyNode {}
function tidy_get_html(tidy $tidy): ?tidyNode {}

function tidy_get_head(tidy $object): ?tidyNode {}
function tidy_get_head(tidy $tidy): ?tidyNode {}

function tidy_get_body(tidy $tidy): ?tidyNode {}

class tidy
{
public function __construct(?string $filename = null, array|string|null $config_options = null, ?string $encoding = null, bool $use_include_path = false) {}
public function __construct(?string $filename = null, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false) {}

/**
* @return string|int|bool
Expand All @@ -69,22 +69,22 @@ public function getOpt(string $option) {}
public function cleanRepair() {}

/** @return bool */
public function parseFile(string $file, array|string|null $config_options = null, ?string $encoding = null, bool $use_include_path = false) {}
public function parseFile(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false) {}

/** @return bool */
public function parseString(string $input, array|string|null $config_options = null, ?string $encoding = null) {}
public function parseString(string $string, array|string|null $config = null, ?string $encoding = null) {}

/**
* @return bool
* @alias tidy_repair_string
*/
public function repairString(string $data, array|string|null $config_options = null, ?string $encoding = null) {}
public function repairString(string $string, array|string|null $config = null, ?string $encoding = null) {}

/**
* @return bool
* @alias tidy_repair_file
*/
public function repairFile(string $filename, array|string|null $config_options = null, ?string $encoding = null, bool $use_include_path = false) {}
public function repairFile(string $filename, array|string|null $config = null, ?string $encoding = null, bool $useIncludePath = false) {}

/**
* @return bool
Expand Down Expand Up @@ -121,7 +121,7 @@ public function getHtmlVer() {}
* @return string|false
* @alias tidy_get_opt_doc
*/
public function getOptDoc(string $optname) {}
public function getOptDoc(string $option) {}
#endif

/**
Expand Down
71 changes: 30 additions & 41 deletions ext/tidy/tidy_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 62b1cdb7f9b9a5641d3bd9248f5a73c30266d02e */
* Stub hash: ac4cd960d6c65653994b8b044dcc52c179a57d45 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_string, 0, 1, tidy, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_get_error_buffer, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_output, 0, 1, IS_STRING, 0)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_file, 0, 1, tidy, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, useIncludePath, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_clean_repair, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_repair_string, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_repair_file, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, useIncludePath, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()

#define arginfo_tidy_diagnose arginfo_tidy_clean_repair
Expand All @@ -46,17 +46,17 @@ ZEND_END_ARG_INFO()

#if defined(HAVE_TIDYOPTGETDOC)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_get_opt_doc, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_config, 0, 1, IS_ARRAY, 0)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_status, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

#define arginfo_tidy_get_html_ver arginfo_tidy_get_status
Expand All @@ -74,27 +74,25 @@ ZEND_END_ARG_INFO()
#define arginfo_tidy_config_count arginfo_tidy_get_status

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_getopt, 0, 2, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_root, 0, 1, tidyNode, 1)
ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()

#define arginfo_tidy_get_html arginfo_tidy_get_root

#define arginfo_tidy_get_head arginfo_tidy_get_root

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_body, 0, 1, tidyNode, 1)
ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
ZEND_END_ARG_INFO()
#define arginfo_tidy_get_body arginfo_tidy_get_root

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, useIncludePath, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOpt, 0, 0, 1)
Expand All @@ -105,30 +103,21 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_cleanRepair, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_parseFile, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, useIncludePath, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_parseString, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_repairString, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_tidy_repairString arginfo_class_tidy_parseString

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_repairFile, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, config_options, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
#define arginfo_class_tidy_repairFile arginfo_class_tidy_parseFile

#define arginfo_class_tidy_diagnose arginfo_class_tidy_cleanRepair

Expand All @@ -142,7 +131,7 @@ ZEND_END_ARG_INFO()

#if defined(HAVE_TIDYOPTGETDOC)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOptDoc, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif

Expand Down