Skip to content

Declare ext/random constants in stubs #9109

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

Merged
merged 1 commit into from
Jul 23, 2022
Merged
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
3 changes: 1 addition & 2 deletions ext/random/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,7 @@ PHP_MINIT_FUNCTION(random)
random_randomizer_object_handlers.free_obj = randomizer_free_obj;
random_randomizer_object_handlers.clone_obj = NULL;

REGISTER_LONG_CONSTANT("MT_RAND_MT19937", MT_RAND_MT19937, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MT_RAND_PHP", MT_RAND_PHP, CONST_CS | CONST_PERSISTENT);
register_random_symbols(module_number);

return SUCCESS;
}
Expand Down
23 changes: 17 additions & 6 deletions ext/random/random.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
/** @generate-class-entries */

namespace {
/**
* @var int
* @cvalue MT_RAND_MT19937
*/
const MT_RAND_MT19937 = UNKNOWN;
/**
* @var int
* @cvalue MT_RAND_PHP
*/
const MT_RAND_PHP = UNKNOWN;

function lcg_value(): float {}

function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
Expand Down Expand Up @@ -54,7 +65,7 @@ public function __construct(string|int|null $seed = null, string|int $sequence =
public function generate(): string {}

public function jump(int $advance): void {}

/** @implementation-alias Random\Engine\Mt19937::__serialize */
public function __serialize(): array {}

Expand All @@ -74,17 +85,17 @@ public function __construct(string|int|null $seed = null) {}

/** @implementation-alias Random\Engine\Mt19937::generate */
public function generate(): string {}

public function jump(): void {}

public function jumpLong(): void {}

/** @implementation-alias Random\Engine\Mt19937::__serialize */
public function __serialize(): array {}

/** @implementation-alias Random\Engine\Mt19937::__unserialize */
public function __unserialize(array $data): void {}

/** @implementation-alias Random\Engine\Mt19937::__debugInfo */
public function __debugInfo(): array {}
}
Expand Down
8 changes: 7 additions & 1 deletion ext/random/random_arginfo.h

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