This commit is contained in:
DmitryTronin 2022-07-27 17:40:39 +02:00
parent 08b9e06fa1
commit 3b14ae6313
15 changed files with 285 additions and 120 deletions

View File

@ -734,6 +734,13 @@ const CLASSES = array (
'RRDCreator' => 'rrd/rrd.php',
'RRDGraph' => 'rrd/rrd.php',
'RRDUpdater' => 'rrd/rrd.php',
'Random\\CryptoSafeEngine' => 'random/random.php',
'Random\\Engine' => 'random/random.php',
'Random\\Engine\\Mt19937' => 'random/random.php',
'Random\\Engine\\PcgOneseq128XslRr64' => 'random/random.php',
'Random\\Engine\\Secure' => 'random/random.php',
'Random\\Engine\\Xoshiro256StarStar' => 'random/random.php',
'Random\\Randomizer' => 'random/random.php',
'RangeException' => 'SPL/SPL.php',
'RarArchive' => 'rar/rar.php',
'RarEntry' => 'rar/rar.php',
@ -2661,7 +2668,7 @@ const FUNCTIONS = array (
'getopt' => 'standard/standard_3.php',
'getprotobyname' => 'standard/standard_2.php',
'getprotobynumber' => 'standard/standard_2.php',
'getrandmax' => 'standard/standard_2.php',
'getrandmax' => 'random/random.php',
'getrusage' => 'standard/standard_3.php',
'getservbyname' => 'standard/standard_2.php',
'getservbyport' => 'standard/standard_2.php',
@ -3299,7 +3306,7 @@ const FUNCTIONS = array (
'krsort' => 'standard/standard_8.php',
'ksort' => 'standard/standard_8.php',
'lcfirst' => 'standard/standard_1.php',
'lcg_value' => 'standard/standard_8.php',
'lcg_value' => 'random/random.php',
'lchgrp' => 'standard/standard_7.php',
'lchown' => 'standard/standard_7.php',
'ldap_8859_to_t61' => 'ldap/ldap.php',
@ -3848,9 +3855,9 @@ const FUNCTIONS = array (
'mssql_result' => 'mssql/mssql.php',
'mssql_rows_affected' => 'mssql/mssql.php',
'mssql_select_db' => 'mssql/mssql.php',
'mt_getrandmax' => 'standard/standard_2.php',
'mt_rand' => 'standard/standard_2.php',
'mt_srand' => 'standard/standard_2.php',
'mt_getrandmax' => 'random/random.php',
'mt_rand' => 'random/random.php',
'mt_srand' => 'random/random.php',
'mysql' => 'mysql/mysql.php',
'mysql_affected_rows' => 'mysql/mysql.php',
'mysql_client_encoding' => 'mysql/mysql.php',
@ -4777,9 +4784,9 @@ const FUNCTIONS = array (
'radius_close' => 'radius/radius.php',
'radius_config' => 'radius/radius.php',
'radius_create_request' => 'radius/radius.php',
'rand' => 'standard/standard_2.php',
'random_bytes' => 'standard/CSPRNG.php',
'random_int' => 'standard/CSPRNG.php',
'rand' => 'random/random.php',
'random_bytes' => 'random/random.php',
'random_int' => 'random/random.php',
'range' => 'standard/standard_8.php',
'rawurldecode' => 'standard/standard_2.php',
'rawurlencode' => 'standard/standard_2.php',
@ -5190,7 +5197,7 @@ const FUNCTIONS = array (
'sqlsrv_send_stream_data' => 'sqlsrv/sqlsrv.php',
'sqlsrv_server_info' => 'sqlsrv/sqlsrv.php',
'sqrt' => 'standard/standard_3.php',
'srand' => 'standard/standard_2.php',
'srand' => 'random/random.php',
'sscanf' => 'standard/standard_2.php',
'ssh2_auth_agent' => 'ssh2/ssh2.php',
'ssh2_auth_hostbased_file' => 'ssh2/ssh2.php',
@ -7346,6 +7353,7 @@ const CONSTANTS = array (
'FILTER_FLAG_ENCODE_AMP' => 'filter/filter.php',
'FILTER_FLAG_ENCODE_HIGH' => 'filter/filter.php',
'FILTER_FLAG_ENCODE_LOW' => 'filter/filter.php',
'FILTER_FLAG_GLOBAL_RANGE' => 'filter/filter.php',
'FILTER_FLAG_HOSTNAME' => 'filter/filter.php',
'FILTER_FLAG_HOST_REQUIRED' => 'filter/filter.php',
'FILTER_FLAG_IPV4' => 'filter/filter.php',
@ -9852,6 +9860,7 @@ const CONSTANTS = array (
'MSG_TRUNC' => 'sockets/sockets.php',
'MSG_WAITALL' => 'sockets/sockets.php',
'MSG_WAITFORONE' => 'sockets/sockets.php',
'MSG_ZEROCOPY' => 'sockets/sockets.php',
'MSSQL_ASSOC' => 'mssql/mssql.php',
'MSSQL_BOTH' => 'mssql/mssql.php',
'MSSQL_NUM' => 'mssql/mssql.php',
@ -11796,6 +11805,7 @@ const CONSTANTS = array (
'SO_SNDLOWAT' => 'sockets/sockets.php',
'SO_SNDTIMEO' => 'sockets/sockets.php',
'SO_TYPE' => 'sockets/sockets.php',
'SO_ZEROCOPY' => 'sockets/sockets.php',
'SQLBIT' => 'mssql/mssql.php',
'SQLCHAR' => 'mssql/mssql.php',
'SQLFLT4' => 'mssql/mssql.php',

View File

@ -147,7 +147,7 @@ function spl_object_hash(object $object): string {}
* </p>
* @return array An array containing the elements of the iterator.
*/
function iterator_to_array(Traversable $iterator, bool $preserve_keys = true): array {}
function iterator_to_array(#[LanguageLevelTypeAware(['8.2' => 'Traversable|array'], default: 'Traversable')] $iterator, bool $preserve_keys = true): array {}
/**
* Count the elements in an iterator
@ -158,7 +158,7 @@ function iterator_to_array(Traversable $iterator, bool $preserve_keys = true): a
* @return int The number of elements in iterator.
*/
#[Pure]
function iterator_count(Traversable $iterator): int {}
function iterator_count(#[LanguageLevelTypeAware(['8.2' => 'Traversable|array'], default: 'Traversable')] $iterator): int {}
/**
* Call a function for every element in an iterator

View File

@ -526,4 +526,11 @@ define('FILTER_FLAG_NO_PRIV_RANGE', 8388608);
define('FILTER_FLAG_HOSTNAME', 1048576);
define('FILTER_FLAG_EMAIL_UNICODE', 1048576);
/**
* filters Global IPs per RFC 6890
* @since 8.2
*/
define('FILTER_FLAG_GLOBAL_RANGE', 268435456);
// End of filter v.0.11.0

View File

@ -1384,6 +1384,7 @@ function imap_mail(string $to, string $subject, string $message, ?string $additi
* <dt>fetchsubject</dt><dd>subject line formatted to fit subjectlength characters</dd>
* </dl>
*/
#[PhpStormStubsElementAvailable(to: '7.4')]
function imap_header($stream_id, $msg_no, $from_length = 0, $subject_length = 0, $default_host = null) {}
/**

View File

@ -350,6 +350,16 @@ class mysqli
#[TentativeType]
public function get_charset(): ?object {}
/**
* @param mysqli $mysql
* @param string $query
* @param array|null $params
* @return mysqli_result|bool
* @see mysqli_execute_query
* @since 8.2
*/
public function execute_query(string $query, ?array $params = null): mysqli_result|bool {}
/**
* Returns the MySQL client version as a string
* @link https://php.net/manual/en/mysqli.get-client-info.php

View File

@ -629,7 +629,7 @@ define('PCRE_VERSION_MAJOR', 10);
/**
* @since 7.3
*/
define('PCRE_VERSION_MINOR', 39);
define('PCRE_VERSION_MINOR', 40);
/**
* @since 7.3

213
random/random.php Normal file
View File

@ -0,0 +1,213 @@
<?php
namespace {
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Pure;
/**
* Combined linear congruential generator
* @link https://php.net/manual/en/function.lcg-value.php
* @return float A pseudo random float value in the range of (0, 1)
*/
function lcg_value(): float {}
/**
* Seeds the Mersenne Twister Random Number Generator
* @link https://php.net/manual/en/function.mt-srand.php
* @param int $seed <p>
* An optional seed value
* </p>
* @param int $mode [optional] <p>
* Use one of the following constants to specify the implementation of the algorithm to use.
* </p>
* @return void
*/
function mt_srand(
int $seed = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937
): void {}
/**
* Seed the random number generator
* <p><strong>Note</strong>: As of PHP 7.1.0, {@see srand()} has been made
* an alias of {@see mt_srand()}.
* </p>
* @link https://php.net/manual/en/function.srand.php
* @param int $seed <p>
* Optional seed value
* </p>
* @param int $mode [optional] <p>
* Use one of the following constants to specify the implementation of the algorithm to use.
* </p>
* @return void
*/
function srand(
int $seed = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937
): void {}
/**
* Generate a random integer
* @link https://php.net/manual/en/function.rand.php
* @param int $min
* @param int $max [optional]
* @return int A pseudo random value between min
* (or 0) and max (or getrandmax, inclusive).
*/
function rand(int $min = null, int $max): int {}
/**
* Generate a random value via the Mersenne Twister Random Number Generator
* @link https://php.net/manual/en/function.mt-rand.php
* @param int $min <p>
* Optional lowest value to be returned (default: 0)
* </p>
* @param int $max [optional] <p>
* Optional highest value to be returned (default: mt_getrandmax())
* </p>
* @return int A random integer value between min (or 0)
* and max (or mt_getrandmax, inclusive)
*/
function mt_rand(int $min = null, int $max): int {}
/**
* Show largest possible random value
* @link https://php.net/manual/en/function.mt-getrandmax.php
* @return int the maximum random value returned by mt_rand
*/
#[Pure]
function mt_getrandmax(): int {}
/**
* Show largest possible random value
* @link https://php.net/manual/en/function.getrandmax.php
* @return int The largest possible random value returned by rand
*/
#[Pure]
function getrandmax(): int {}
/**
* Generates cryptographically secure pseudo-random bytes
* @link https://php.net/manual/en/function.random-bytes.php
* @param int $length The length of the random string that should be returned in bytes.
* @return string Returns a string containing the requested number of cryptographically secure random bytes.
* @since 7.0
* @throws Exception if an appropriate source of randomness cannot be found.
*/
function random_bytes(int $length): string {}
/**
* Generates cryptographically secure pseudo-random integers
* @link https://php.net/manual/en/function.random-int.php
* @param int $min The lowest value to be returned, which must be PHP_INT_MIN or higher.
* @param int $max The highest value to be returned, which must be less than or equal to PHP_INT_MAX.
* @return int Returns a cryptographically secure random integer in the range min to max, inclusive.
* @since 7.0
* @throws Exception if an appropriate source of randomness cannot be found.
*/
function random_int(int $min, int $max): int {}
}
namespace Random\Engine
{
/**
* @since 8.2
*/
final class Mt19937 implements \Random\Engine
{
public function __construct(int|null $seed = null, int $mode = MT_RAND_MT19937) {}
public function generate(): string {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
public function __debugInfo(): array {}
}
/**
* @since 8.2
*/
final class PcgOneseq128XslRr64 implements \Random\Engine
{
public function __construct(string|int|null $seed = null, string|int $sequence = 0) {}
public function generate(): string {}
public function jump(int $advance): void {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
public function __debugInfo(): array {}
}
/**
* @since 8.2
*/
final class Xoshiro256StarStar implements \Random\Engine
{
public function __construct(string|int|null $seed = null) {}
public function generate(): string {}
public function jump(): void {}
public function jumpLong(): void {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
public function __debugInfo(): array {}
}
/**
* @since 8.2
*/
final class Secure implements \Random\CryptoSafeEngine
{
public function generate(): string {}
}
}
namespace Random
{
/**
* @since 8.2
*/
interface Engine
{
public function generate(): string;
}
/**
* @since 8.2
*/
interface CryptoSafeEngine extends Engine {}
/**
* @since 8.2
*/
final class Randomizer
{
public readonly Engine $engine;
public function __construct(?Engine $engine = null) {}
public function getInt(int $min = UNKNOWN, int $max = UNKNOWN): int {}
public function getBytes(int $length): string {}
public function shuffleArray(array $array): array {}
public function shuffleBytes(string $bytes): string {}
public function pickArrayKeys(array $array, int $num): array {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
}
}

View File

@ -2312,6 +2312,20 @@ define('TCP_KEEPINTVL', 5);
*/
define('TCP_KEEPCNT', 6);
/**
* Socket_set_option for the socket_send* functions.
* It avoids copy b/w userland and kernel for both TCP and UDP protocols.
* @since 8.2
*/
define('SO_ZEROCOPY', 60);
/**
* Socket_set_option for the socket_send* functions.
* It avoids copy b/w userland and kernel for both TCP and UDP protocols.
* @since 8.2
*/
define('MSG_ZEROCOPY', 67108864);
/**
* @since 8.0
*/

View File

@ -1,21 +0,0 @@
<?php
/**
* Generates cryptographically secure pseudo-random bytes
* @link https://php.net/manual/en/function.random-bytes.php
* @param int $length The length of the random string that should be returned in bytes.
* @return string Returns a string containing the requested number of cryptographically secure random bytes.
* @since 7.0
* @throws Exception if an appropriate source of randomness cannot be found.
*/
function random_bytes(int $length): string {}
/**
* Generates cryptographically secure pseudo-random integers
* @link https://php.net/manual/en/function.random-int.php
* @param int $min The lowest value to be returned, which must be PHP_INT_MIN or higher.
* @param int $max The highest value to be returned, which must be less than or equal to PHP_INT_MAX.
* @return int Returns a cryptographically secure random integer in the range min to max, inclusive.
* @since 7.0
* @throws Exception if an appropriate source of randomness cannot be found.
*/
function random_int(int $min, int $max): int {}

View File

@ -99,15 +99,27 @@ class Directory
/**
* @var string The directory that was opened.
*/
#[LanguageLevelTypeAware(['8.1' => 'string'], default: '')]
#[PhpStormStubsElementAvailable(to: '8.0')]
public $path;
/**
* @var string The directory that was opened.
*/
#[PhpStormStubsElementAvailable(from: '8.1')]
public readonly string $path;
/**
* @var resource Can be used with other directory functions such as {@see readdir()}, {@see rewinddir()} and {@see closedir()}.
*/
#[LanguageLevelTypeAware(['8.1' => 'mixed'], default: '')]
#[PhpStormStubsElementAvailable(to: '8.0')]
public $handle;
/**
* @var resource Can be used with other directory functions such as {@see readdir()}, {@see rewinddir()} and {@see closedir()}.
*/
#[PhpStormStubsElementAvailable(from: '8.1')]
public readonly mixed $handle;
/**
* Close directory handle.
* Same as closedir(), only dir_handle defaults to $this.

View File

@ -930,81 +930,6 @@ function proc_get_status($process) {}
*/
function proc_nice(int $priority): bool {}
/**
* Generate a random integer
* @link https://php.net/manual/en/function.rand.php
* @param int $min
* @param int $max [optional]
* @return int A pseudo random value between min
* (or 0) and max (or getrandmax, inclusive).
*/
function rand(int $min = null, int $max): int {}
/**
* Seed the random number generator
* <p><strong>Note</strong>: As of PHP 7.1.0, {@see srand()} has been made
* an alias of {@see mt_srand()}.
* </p>
* @link https://php.net/manual/en/function.srand.php
* @param int $seed <p>
* Optional seed value
* </p>
* @param int $mode [optional] <p>
* Use one of the following constants to specify the implementation of the algorithm to use.
* </p>
* @return void
*/
function srand(
int $seed = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937
): void {}
/**
* Show largest possible random value
* @link https://php.net/manual/en/function.getrandmax.php
* @return int The largest possible random value returned by rand
*/
#[Pure]
function getrandmax(): int {}
/**
* Generate a random value via the Mersenne Twister Random Number Generator
* @link https://php.net/manual/en/function.mt-rand.php
* @param int $min <p>
* Optional lowest value to be returned (default: 0)
* </p>
* @param int $max [optional] <p>
* Optional highest value to be returned (default: mt_getrandmax())
* </p>
* @return int A random integer value between min (or 0)
* and max (or mt_getrandmax, inclusive)
*/
function mt_rand(int $min = null, int $max): int {}
/**
* Seeds the Mersenne Twister Random Number Generator
* @link https://php.net/manual/en/function.mt-srand.php
* @param int $seed <p>
* An optional seed value
* </p>
* @param int $mode [optional] <p>
* Use one of the following constants to specify the implementation of the algorithm to use.
* </p>
* @return void
*/
function mt_srand(
int $seed = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937
): void {}
/**
* Show largest possible random value
* @link https://php.net/manual/en/function.mt-getrandmax.php
* @return int the maximum random value returned by mt_rand
*/
#[Pure]
function mt_getrandmax(): int {}
/**
* Get port number associated with an Internet service and protocol
* @link https://php.net/manual/en/function.getservbyname.php

View File

@ -124,13 +124,6 @@ function stream_set_chunk_size($stream, int $size) {}
#[Deprecated(since: '5.3')]
function define_syslog_variables() {}
/**
* Combined linear congruential generator
* @link https://php.net/manual/en/function.lcg-value.php
* @return float A pseudo random float value in the range of (0, 1)
*/
function lcg_value(): float {}
/**
* Calculate the metaphone key of a string
* @link https://php.net/manual/en/function.metaphone.php

View File

@ -1,4 +1,4 @@
FROM php:8.2.0alpha3-zts-alpine
FROM php:8.2.0beta1-zts-alpine
RUN set -eux; \
apk add --no-cache --virtual .build-deps \

View File

@ -49,8 +49,8 @@ class PHPProperty extends BasePHPElement
if (method_exists($reflectionObject, 'getType')) {
$this->typesFromSignature = self::getReflectionTypeAsArray($reflectionObject->getType());
}
if (property_exists($reflectionObject, 'isReadonly')) {
$this->isReadonly = $reflectionObject->isReadonly;
if (method_exists($reflectionObject, 'isReadonly')) {
$this->isReadonly = $reflectionObject->isReadOnly();
}
return $this;
}

View File

@ -16,6 +16,7 @@ class PhpCoreStubsProvider
'hash',
'meta',
'pcre',
'random',
'Phar',
'Reflection',
'regex',