Skip to content

Replace @deprecated with #[\Deprecated] for internal constants #18780

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5317,7 +5317,7 @@ static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimum
$constName = str_replace('\\', '\\\\', $constInfo->name->__toString());
$constVarName = 'const_' . $constName;

$code .= "\tzend_constant *$constVarName = zend_hash_str_find_ptr(EG(zend_constants), \"" . $constName . "\", sizeof(\"" . $constName . "\") - 1);\n";
$code = "\tzend_constant *$constVarName = zend_hash_str_find_ptr(EG(zend_constants), \"" . $constName . "\", sizeof(\"" . $constName . "\") - 1);\n";
foreach ($constInfo->attributes as $key => $attribute) {
$code .= $attribute->generateCode(
"zend_add_global_constant_attribute($constVarName",
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/curl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
const CURLOPT_AUTOREFERER = UNKNOWN;
/**
* @var int
* @deprecated has no effect since 5.1.2
* @cvalue CURLOPT_BINARYTRANSFER
*/
#[\Deprecated(since: '8.4', message: 'as it had no effect since 5.1.2')]
const CURLOPT_BINARYTRANSFER = UNKNOWN;
/**
* @var int
Expand Down
16 changes: 15 additions & 1 deletion ext/curl/curl_arginfo.h

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

1 change: 1 addition & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#include "zend_attributes.h"
#include "curl_arginfo.h"

ZEND_DECLARE_MODULE_GLOBALS(curl)
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/tests/bug46711.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var_dump($opt); // with this bug, $opt[58] becomes NULL

?>
--EXPECTF--
Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated in %s on line %d
Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated since 8.4, as it had no effect since 5.1.2 in %s on line %d
array(2) {
[58]=>
bool(true)
Expand Down
6 changes: 3 additions & 3 deletions ext/date/php_date.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@
/**
* @var int
* @cvalue SUNFUNCS_RET_TIMESTAMP
* @deprecated
*/
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
const SUNFUNCS_RET_TIMESTAMP = UNKNOWN;

/**
* @var int
* @cvalue SUNFUNCS_RET_STRING
* @deprecated
*/
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
const SUNFUNCS_RET_STRING = UNKNOWN;

/**
* @var int
* @cvalue SUNFUNCS_RET_DOUBLE
* @deprecated
*/
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
const SUNFUNCS_RET_DOUBLE = UNKNOWN;

function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}
Expand Down
41 changes: 40 additions & 1 deletion ext/date/php_date_arginfo.h

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

4 changes: 2 additions & 2 deletions ext/date/tests/date_sunrise_and_sunset_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ var_dump(gettype(date_sunset(time())));
--EXPECTF--
Basic test for date_sunrise() and date_sunset()

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
%s %s %d %d, sunrise time : %d:%d

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
%s %s %d %d, sunset time : %d:%d
Expand Down
4 changes: 2 additions & 2 deletions ext/date/tests/gh14732.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ date_sun_info(): Argument #2 ($latitude) must be finite
date_sun_info(): Argument #3 ($longitude) must be finite
date_sun_info(): Argument #3 ($longitude) must be finite

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)
8 changes: 4 additions & 4 deletions ext/date/tests/gh16454.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, PHP_FLOAT_MAX));
var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, -PHP_FLOAT_MAX));
?>
--EXPECTF--
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)
8 changes: 4 additions & 4 deletions ext/date/tests/gh18481.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ foreach ([-NAN, NAN, INF, -INF] as $offset) {
}
?>
--EXPECTF--
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)

Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d

Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
bool(false)
1 change: 1 addition & 0 deletions ext/dom/php_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "php.h"
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
#include "zend_enum.h"
#include "zend_attributes.h"
#include "php_dom.h"
#include "nodelist.h"
#include "html_collection.h"
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/php_dom.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@

/**
* @var int
* @deprecated is no longer used since 8.4
* @cvalue PHP_ERR
*/
#[\Deprecated(since: '8.4', message: 'as it is no longer used')]
const DOM_PHP_ERR = UNKNOWN;
/**
* @var int
Expand Down
16 changes: 15 additions & 1 deletion ext/dom/php_dom_arginfo.h

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

2 changes: 1 addition & 1 deletion ext/dom/tests/DOM_PHP_ERR_deprecated.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ dom
var_dump(DOM_PHP_ERR);
?>
--EXPECTF--
Deprecated: Constant DOM_PHP_ERR is deprecated in %s on line %d
Deprecated: Constant DOM_PHP_ERR is deprecated since 8.4, as it is no longer used in %s on line %d
int(0)
4 changes: 2 additions & 2 deletions ext/enchant/enchant.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
/**
* @var int
* @cvalue PHP_ENCHANT_MYSPELL
* @deprecated
*/
#[\Deprecated(since: '8.0', message: 'as enchant_broker_get_dict_path() and enchant_broker_set_dict_path() are deprecated')]
const ENCHANT_MYSPELL = UNKNOWN;
/**
* @var int
* @cvalue PHP_ENCHANT_ISPELL
* @deprecated
*/
#[\Deprecated(since: '8.0', message: 'as enchant_broker_get_dict_path() and enchant_broker_set_dict_path() are deprecated')]
const ENCHANT_ISPELL = UNKNOWN;
#ifdef HAVE_ENCHANT_GET_VERSION
/**
Expand Down
Loading