Merge branch 'PHP-8.0'

This commit is contained in:
Máté Kocsis 2021-07-12 10:32:07 +02:00
commit 0192fd20cc
No known key found for this signature in database
GPG Key ID: FD055E41728BF310
7 changed files with 49 additions and 53 deletions

View File

@ -125,6 +125,10 @@ class SimpleType {
return new SimpleType($node->toString(), true);
}
if ($node->toLowerString() === 'self') {
throw new Exception('The exact class name must be used instead of "self"');
}
assert($node->isFullyQualified());
return new SimpleType($node->toString(), false);
}
@ -149,9 +153,10 @@ class SimpleType {
case "object":
case "resource":
case "mixed":
case "self":
case "static":
return new SimpleType(strtolower($type), true);
case "self":
throw new Exception('The exact class name must be used instead of "self"');
}
if (strpos($type, "[]") !== false) {
@ -1510,6 +1515,10 @@ function parseFunctionLike(
}
}
if ($param->default instanceof Expr\ClassConstFetch && $param->default->class->toLowerString() === "self") {
throw new Exception('The exact class name must be used instead of "self"');
}
$foundVariadic = $param->variadic;
$args[] = new ArgInfo(

View File

@ -6,29 +6,17 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count
{
public function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class) {}
/**
* @param string|int $key
* @return bool
*/
public function offsetExists($key) {}
/** @return bool */
public function offsetExists(mixed $key) {}
/**
* @param string|int $key
* @return mixed
*/
public function offsetGet($key) {}
/** @return mixed */
public function offsetGet(mixed $key) {}
/**
* @param string|int $key
* @return void
*/
public function offsetSet($key, mixed $value) {}
/** @return void */
public function offsetSet(mixed $key, mixed $value) {}
/**
* @param string|int $key
* @return void
*/
public function offsetUnset($key) {}
/** @return void */
public function offsetUnset(mixed $key) {}
/** @return void */
public function append(mixed $value) {}
@ -96,32 +84,28 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Coun
public function __construct(array|object $array = [], int $flags = 0) {}
/**
* @param string|int $key
* @return bool
* @implementation-alias ArrayObject::offsetExists
*/
public function offsetExists($key) {}
public function offsetExists(mixed $key) {}
/**
* @param string|int $key
* @return mixed
* @implementation-alias ArrayObject::offsetGet
*/
public function offsetGet($key) {}
public function offsetGet(mixed $key) {}
/**
* @param string|int $key
* @return void
* @implementation-alias ArrayObject::offsetSet
*/
public function offsetSet($key, mixed $value) {}
public function offsetSet(mixed $key, mixed $value) {}
/**
* @param string|int $key
* @return void
* @implementation-alias ArrayObject::offsetUnset
*/
public function offsetUnset($key) {}
public function offsetUnset(mixed $key) {}
/**
* @return void

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: e1f39b5dcb4da47427d5a1a13c9949c8b0a7ba8b */
* Stub hash: 309be43f56774d35e7bddd4bf7f119e0d4c99d12 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0)
ZEND_ARG_TYPE_MASK(0, array, MAY_BE_ARRAY|MAY_BE_OBJECT, "[]")
@ -8,13 +8,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject_offsetExists, 0, 0, 1)
ZEND_ARG_INFO(0, key)
ZEND_ARG_TYPE_INFO(0, key, IS_MIXED, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_ArrayObject_offsetGet arginfo_class_ArrayObject_offsetExists
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject_offsetSet, 0, 0, 2)
ZEND_ARG_INFO(0, key)
ZEND_ARG_TYPE_INFO(0, key, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_END_ARG_INFO()

View File

@ -148,7 +148,7 @@ class FilesystemIterator extends DirectoryIterator
/** @return string */
public function key() {}
/** @return string|SplFileInfo|self */
/** @return string|SplFileInfo|FilesystemIterator */
public function current() {}
/** @return int */
@ -211,7 +211,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** @return int|false */
public function fputcsv(array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\\", string $eol = "\n") {}
/** @return bool|null */
/** @return void */
public function setCsvControl(string $separator = ",", string $enclosure = "\"", string $escape = "\\") {}
/** @return array */
@ -238,7 +238,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** @return int */
public function fpassthru() {}
/** @return array|int|false|null */
/** @return array|int|null */
public function fscanf(string $format, mixed &...$vars) {}
/** @return int|false */
@ -274,7 +274,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** @return bool */
public function hasChildren() {}
/** @return null */
/** @return RecursiveIterator|null */
public function getChildren() {}
/** @return void */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: bea6fbfdd7ff20de998dcd24bef4fd2ab56d5041 */
* Stub hash: 7d34368a9fcdde100433b57fe2ef88bb4334e403 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)

View File

@ -47,13 +47,13 @@ interface RecursiveIterator extends Iterator
/** @return bool */
public function hasChildren();
/** @return RecursiveIterator */
/** @return RecursiveIterator|null */
public function getChildren();
}
class RecursiveIteratorIterator implements OuterIterator
{
public function __construct(Traversable $iterator, int $mode = self::LEAVES_ONLY, int $flags = 0) {}
public function __construct(Traversable $iterator, int $mode = RecursiveIteratorIterator::LEAVES_ONLY, int $flags = 0) {}
/** @return void */
public function rewind() {}
@ -200,7 +200,7 @@ class LimitIterator extends IteratorIterator
class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable
{
public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {}
public function __construct(Iterator $iterator, int $flags = CachingIterator::CALL_TOSTRING) {}
/** @return void */
public function rewind() {}
@ -255,7 +255,7 @@ class CachingIterator extends IteratorIterator implements ArrayAccess, Countable
class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator
{
public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {}
public function __construct(Iterator $iterator, int $flags = RecursiveCachingIterator::CALL_TOSTRING) {}
/** @return bool */
public function hasChildren() {}
@ -322,7 +322,7 @@ class RegexIterator extends FilterIterator
{
public ?string $replacement = null;
public function __construct(Iterator $iterator, string $pattern, int $mode = self::MATCH, int $flags = 0, int $pregFlags = 0) {}
public function __construct(Iterator $iterator, string $pattern, int $mode = RegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
/** @return bool */
public function accept() {}
@ -351,7 +351,7 @@ class RegexIterator extends FilterIterator
class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
{
public function __construct(RecursiveIterator $iterator, string $pattern, int $mode = self::MATCH, int $flags = 0, int $pregFlags = 0) {}
public function __construct(RecursiveIterator $iterator, string $pattern, int $mode = RecursiveRegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
/** @return bool */
public function accept() {}
@ -371,9 +371,9 @@ class RecursiveTreeIterator extends RecursiveIteratorIterator
/** @param RecursiveIterator|IteratorAggregate $iterator */
public function __construct(
$iterator,
int $flags = self::BYPASS_KEY,
int $flags = RecursiveTreeIterator::BYPASS_KEY,
int $cachingIteratorFlags = CachingIterator::CATCH_GET_CHILD,
int $mode = self::SELF_FIRST
int $mode = RecursiveTreeIterator::SELF_FIRST
) {}
/** @return mixed */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: faf45a8d4e731dccfc161514f233a78d98b716e9 */
* Stub hash: de49628718b5fff1a3b2516cc89108e01b67c312 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0)
ZEND_END_ARG_INFO()
@ -34,7 +34,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveIteratorIterator___construct, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::LEAVES_ONLY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveIteratorIterator::LEAVES_ONLY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
@ -139,7 +139,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CachingIterator___construct, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "self::CALL_TOSTRING")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "CachingIterator::CALL_TOSTRING")
ZEND_END_ARG_INFO()
#define arginfo_class_CachingIterator_rewind arginfo_class_EmptyIterator_current
@ -176,7 +176,10 @@ ZEND_END_ARG_INFO()
#define arginfo_class_CachingIterator_count arginfo_class_EmptyIterator_current
#define arginfo_class_RecursiveCachingIterator___construct arginfo_class_CachingIterator___construct
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveCachingIterator___construct, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "RecursiveCachingIterator::CALL_TOSTRING")
ZEND_END_ARG_INFO()
#define arginfo_class_RecursiveCachingIterator_hasChildren arginfo_class_EmptyIterator_current
@ -217,7 +220,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RegexIterator___construct, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::MATCH")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RegexIterator::MATCH")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pregFlags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
@ -245,7 +248,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveRegexIterator___construct, 0, 0, 2)
ZEND_ARG_OBJ_INFO(0, iterator, RecursiveIterator, 0)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::MATCH")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveRegexIterator::MATCH")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pregFlags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
@ -258,9 +261,9 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveTreeIterator___construct, 0, 0, 1)
ZEND_ARG_INFO(0, iterator)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "self::BYPASS_KEY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "RecursiveTreeIterator::BYPASS_KEY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cachingIteratorFlags, IS_LONG, 0, "CachingIterator::CATCH_GET_CHILD")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::SELF_FIRST")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveTreeIterator::SELF_FIRST")
ZEND_END_ARG_INFO()
#define arginfo_class_RecursiveTreeIterator_key arginfo_class_EmptyIterator_current