[phpstorm-stubs] add int ranges

This commit is contained in:
Ivan Fedorov 2022-03-31 10:37:54 +02:00 committed by Ivan Fedorov
parent 5440d5873d
commit 96c26c803a
16 changed files with 22 additions and 21 deletions

View File

@ -51,7 +51,7 @@ function func_get_args(): array {}
* @param string $string <p>
* The string being measured for length.
* </p>
* @return int The length of the <i>string</i> on success,
* @return int<0,max> The length of the <i>string</i> on success,
* and 0 if the <i>string</i> is empty.
*/
#[Pure]

View File

@ -698,7 +698,7 @@ interface Countable
/**
* Count elements of an object
* @link https://php.net/manual/en/countable.count.php
* @return int The custom count as an integer.
* @return int<0,max> The custom count as an integer.
* <p>
* The return value is cast to an integer.
* </p>
@ -799,7 +799,7 @@ final class WeakMap implements ArrayAccess, Countable, IteratorAggregate
/**
* Returns the number of items in the {@see WeakMap} instance.
*
* @return int
* @return int<0,max>
*/
public function count(): int {}
}

View File

@ -316,7 +316,7 @@ class Phar extends RecursiveDirectoryIterator implements RecursiveIterator, Seek
* Returns the number of entries (files) in the Phar archive
* @link https://php.net/manual/en/phar.count.php
* @param int $mode [optional]
* @return int The number of files contained within this phar, or 0 (the number zero)
* @return int<0,max> The number of files contained within this phar, or 0 (the number zero)
* if none.
*/
#[TentativeType]
@ -1178,7 +1178,7 @@ class PharFileInfo extends SplFileInfo
* (PHP &gt;= 5.3.0, PECL phar &gt;= 1.0.0)<br/>
* Returns the actual size of the file (with compression) inside the Phar archive
* @link https://php.net/manual/en/pharfileinfo.getcompressedsize.php
* @return int The size in bytes of the file within the Phar archive on disk.
* @return int<0, max> The size in bytes of the file within the Phar archive on disk.
*/
#[TentativeType]
public function getCompressedSize(): int {}

View File

@ -1919,7 +1919,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Coun
/**
* Count elements
* @link https://php.net/manual/en/arrayiterator.count.php
* @return int The number of elements or public properties in the associated
* @return int<0,max> The number of elements or public properties in the associated
* array or object, respectively.
*/
#[TentativeType]

View File

@ -586,7 +586,7 @@ class GlobIterator extends FilesystemIterator implements Countable
/**
* Get the number of directories and files
* @link https://php.net/manual/en/globiterator.count.php
* @return int The number of returned directories and files, as an
* @return int<0,max> The number of returned directories and files, as an
* integer.
*/
#[TentativeType]
@ -975,7 +975,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/**
* Get maximum line length
* @link https://php.net/manual/en/splfileobject.getmaxlinelen.php
* @return int the maximum line length if one has been set with
* @return int<0, max> the maximum line length if one has been set with
* <b>SplFileObject::setMaxLineLen</b>, default is 0.
*/
#[TentativeType]

View File

@ -257,7 +257,7 @@ class SimpleXMLElement implements Traversable, ArrayAccess, Countable, Iterator,
/**
* Counts the children of an element
* @link https://php.net/manual/en/simplexmlelement.count.php
* @return int the number of elements of an element.
* @return int<0,max> the number of elements of an element.
*/
#[Pure]
#[TentativeType]

View File

@ -28,7 +28,7 @@ function bzopen($file, string $mode) {}
* The file pointer. It must be valid and must point to a file
* successfully opened by <b>bzopen</b>.
* </p>
* @param int $length [optional] <p>
* @param int<1024, 8192> $length [optional] <p>
* If not specified, <b>bzread</b> will read 1024
* (uncompressed) bytes at a time. A maximum of 8192
* uncompressed bytes will be read at a time.

View File

@ -1278,6 +1278,7 @@ class DOMNodeList implements IteratorAggregate, Countable
public function item(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $index) {}
/**
* @return int<0, max>
* @since 7.2
*/
#[TentativeType]
@ -1367,7 +1368,7 @@ class DOMNamedNodeMap implements IteratorAggregate, Countable
public function removeNamedItemNS($namespace, $localName) {}
/**
* @return int
* @return int<0,max>
* @since 7.2
*/
#[TentativeType]

View File

@ -345,7 +345,7 @@ function mhash_get_hash_name(int $algo): string|false {}
/**
* Gets the highest available hash ID
* @link https://php.net/manual/en/function.mhash-count.php
* @return int the highest available hash ID. Hashes are numbered from 0 to this
* @return int<0, max> the highest available hash ID. Hashes are numbered from 0 to this
* hash ID.
* @deprecated 8.1
*/

View File

@ -167,7 +167,7 @@ function iconv_substr(string $string, int $offset, ?int $length, ?string $encodi
* <i>string</i> are assumed to be encoded in
* iconv.internal_encoding.
* </p>
* @return int|false the numeric position of the first occurrence of
* @return int<0,max>|false the numeric position of the first occurrence of
* <i>needle</i> in <i>haystack</i>.
* <p>
* If <i>needle</i> is not found,

View File

@ -2286,7 +2286,7 @@ class ResourceBundle implements IteratorAggregate, Countable
* (PHP &gt;= 5.3.2, PECL intl &gt;= 2.0.0)<br/>
* Get number of elements in the bundle
* @link https://php.net/manual/en/resourcebundle.count.php
* @return int number of elements in the bundle.
* @return int<0,max> number of elements in the bundle.
*/
#[Pure]
#[TentativeType]

View File

@ -267,11 +267,11 @@ function mb_strlen(string $string, #[LanguageLevelTypeAware(['8.0' => 'string|nu
* @param string $needle <p>
* The position counted from the beginning of haystack.
* </p>
* @param int $offset [optional] <p>
* @param int<0,max> $offset [optional] <p>
* The search offset. If it is not specified, 0 is used.
* </p>
* @param string|null $encoding [optional]
* @return int|false the numeric position of
* @return int<0,max>|false the numeric position of
* the first occurrence of needle in the
* haystack string. If
* needle is not found, it returns false.

View File

@ -1300,7 +1300,7 @@ function strnatcasecmp(string $string1, string $string2): int {}
* substring. It outputs a warning if the offset plus the length is
* greater than the haystack length.
* </p>
* @return int This functions returns an integer.
* @return int<0,max> This functions returns an integer.
*/
#[Pure]
function substr_count(string $haystack, string $needle, int $offset = 0, ?int $length): int {}

View File

@ -39,11 +39,11 @@ function strtolower(string $string): string {}
* If <b>needle</b> is not a string, it is converted
* to an integer and applied as the ordinal value of a character.
* </p>
* @param int $offset [optional] <p>
* @param int<0,max> $offset [optional] <p>
* If specified, search will start this number of characters counted from
* the beginning of the string. Unlike {@see strrpos()} and {@see strripos()}, the offset cannot be negative.
* </p>
* @return int|false <p>
* @return int<0,max>|false <p>
* Returns the position where the needle exists relative to the beginnning of
* the <b>haystack</b> string (independent of search direction
* or offset).

View File

@ -623,7 +623,7 @@ function array_walk_recursive(object|array &$array, callable $callback, mixed $a
* COUNT_RECURSIVE (or 1), count
* will recursively count the array. This is particularly useful for
* counting all the elements of a multidimensional array. count does not detect infinite recursion.
* @return int the number of elements in var, which is
* @return int<0,max> the number of elements in var, which is
* typically an array, since anything else will have one
* element.
* <p>

View File

@ -852,7 +852,7 @@ function pos(object|array $array): mixed {}
* @link https://php.net/manual/en/function.sizeof.php
* @param array|Countable $value
* @param int $mode [optional]
* @return int
* @return int<0, max>
*/
#[Pure]
function sizeof(Countable|array $value, int $mode = COUNT_NORMAL): int {}