diff --git a/language/control-structures/foreach.xml b/language/control-structures/foreach.xml index ded0de4dee78..44a0b3d47408 100644 --- a/language/control-structures/foreach.xml +++ b/language/control-structures/foreach.xml @@ -219,7 +219,7 @@ foreach ($array as [, , $c]) { - A notice will be generated if there aren't enough array elements to fill + A warning will be generated if there aren't enough array elements to fill the list: @@ -239,10 +239,10 @@ foreach ($array as [$a, $b, $c]) { &example.outputs; diff --git a/language/oop5/anonymous.xml b/language/oop5/anonymous.xml index e2281847d315..f8562ebcd603 100644 --- a/language/oop5/anonymous.xml +++ b/language/oop5/anonymous.xml @@ -63,8 +63,8 @@ var_dump(new class(10) extends SomeClass implements SomeInterface { &example.outputs; +object(SomeClass@anonymous)#1 (1) { + ["num":"SomeClass@anonymous":private]=> int(10) } ]]> @@ -153,11 +153,12 @@ same class - + Note that anonymous classes are assigned a name by the engine, as demonstrated in the following example. This name has to be regarded an - implementation detail, which should not be relied upon. - + implementation detail, which should not be relied upon. The generated name + contains a NUL byte, which is not visible in the output below. + diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml index 425f3c0a6c6f..43c901d71bfe 100644 --- a/language/oop5/magic.xml +++ b/language/oop5/magic.xml @@ -527,7 +527,7 @@ var_dump($c); &example.outputs; 5, 'var2' => 'foo', ))" diff --git a/language/operators/precedence.xml b/language/operators/precedence.xml index 35ac34c0cb7a..d54067490f40 100644 --- a/language/operators/precedence.xml +++ b/language/operators/precedence.xml @@ -377,10 +377,10 @@ $array[$i] = $i++; // may set either index 1 or 2 diff --git a/language/operators/type.xml b/language/operators/type.xml index 3c6dd538388b..6fbcbaa81d63 100644 --- a/language/operators/type.xml +++ b/language/operators/type.xml @@ -188,7 +188,7 @@ var_dump(FALSE instanceof stdClass); bool(false) bool(false) bool(false) -PHP Fatal error: instanceof expects an object instance, constant given +bool(false) ]]> diff --git a/language/predefined/backedenum/from.xml b/language/predefined/backedenum/from.xml index 4ecd30257c18..386c5e913f37 100644 --- a/language/predefined/backedenum/from.xml +++ b/language/predefined/backedenum/from.xml @@ -71,7 +71,11 @@ $b = Suit::from('B'); diff --git a/reference/mbstring/functions/mb-detect-encoding.xml b/reference/mbstring/functions/mb-detect-encoding.xml index 692ff51ef435..304fd48cfe94 100644 --- a/reference/mbstring/functions/mb-detect-encoding.xml +++ b/reference/mbstring/functions/mb-detect-encoding.xml @@ -178,7 +178,8 @@ string(5) "ASCII" // 'áéóú' encoded in ISO-8859-1 $str = "\xE1\xE9\xF3\xFA"; -// The string is not valid ASCII or UTF-8, but UTF-8 is considered a closer match +// The string is valid in neither encoding: non-strict reports the closest +// match, strict returns false var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], false)); var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], true)); @@ -191,7 +192,7 @@ var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8', 'ISO-8859-1'], true)); &example.outputs; __toString(); &example.outputs; class Exception ] { +Class [ class Exception implements Stringable, Throwable ] { - Constants [0] { } @@ -58,50 +58,92 @@ Class [ class Exception ] { } - Properties [7] { - Property [ protected $message ] - Property [ private $string ] - Property [ protected $code ] - Property [ protected $file ] - Property [ protected $line ] - Property [ private $trace ] - Property [ private $previous ] + Property [ protected $message = '' ] + Property [ private string $string = '' ] + Property [ protected $code = 0 ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] + Property [ private array $trace = [] ] + Property [ private ?Throwable $previous = NULL ] } - - Methods [10] { - Method [ final private method __clone ] { + - Methods [11] { + Method [ private method __clone ] { + + - Parameters [0] { + } + - Return [ void ] } Method [ public method __construct ] { - Parameters [3] { - Parameter #0 [ $message ] - Parameter #1 [ $code ] - Parameter #2 [ $previous ] + Parameter #0 [ string $message = "" ] + Parameter #1 [ int $code = 0 ] + Parameter #2 [ ?Throwable $previous = null ] } } - Method [ final public method getMessage ] { + Method [ public method __wakeup ] { + + - Parameters [0] { + } + - Tentative return [ void ] } - Method [ final public method getCode ] { + Method [ final public method getMessage ] { + + - Parameters [0] { + } + - Return [ string ] } - Method [ final public method getFile ] { + Method [ final public method getCode ] { + + - Parameters [0] { + } + } + + Method [ final public method getFile ] { + + - Parameters [0] { + } + - Return [ string ] } - Method [ final public method getLine ] { + Method [ final public method getLine ] { + + - Parameters [0] { + } + - Return [ int ] } - Method [ final public method getTrace ] { + Method [ final public method getTrace ] { + + - Parameters [0] { + } + - Return [ array ] } - Method [ final public method getPrevious ] { + Method [ final public method getPrevious ] { + + - Parameters [0] { + } + - Return [ ?Throwable ] } - Method [ final public method getTraceAsString ] { + Method [ final public method getTraceAsString ] { + + - Parameters [0] { + } + - Return [ string ] } - Method [ public method __toString ] { + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] } } } diff --git a/reference/reflection/reflectionfunctionabstract/getreturntype.xml b/reference/reflection/reflectionfunctionabstract/getreturntype.xml index 157c45706b19..b32a4196fdef 100644 --- a/reference/reflection/reflectionfunctionabstract/getreturntype.xml +++ b/reference/reflection/reflectionfunctionabstract/getreturntype.xml @@ -56,28 +56,30 @@ int - Usage on built-in functions + Methods with a tentative return type getReturnType()); +echo $reflection2->getTentativeReturnType(); ]]> &example.outputs; - This is because many internal functions do not have types specified for their - parameters or return values. It is therefore best to avoid using this - method on built-in functions. + A tentative return type is not reported here; use + ReflectionFunctionAbstract::getTentativeReturnType + to obtain it. @@ -85,6 +87,7 @@ null &reftitle.seealso; + ReflectionFunctionAbstract::getTentativeReturnType ReflectionFunctionAbstract::hasReturnType ReflectionType::__toString diff --git a/reference/reflection/reflectionfunctionabstract/hasreturntype.xml b/reference/reflection/reflectionfunctionabstract/hasreturntype.xml index 40846a250b97..0c77adcbeceb 100644 --- a/reference/reflection/reflectionfunctionabstract/hasreturntype.xml +++ b/reference/reflection/reflectionfunctionabstract/hasreturntype.xml @@ -56,20 +56,22 @@ bool(true) - Usage on built-in functions + Methods with a tentative return type hasReturnType()); +var_dump($reflection2->hasTentativeReturnType()); ]]> &example.outputs; @@ -81,6 +83,7 @@ bool(false) ReflectionFunctionAbstract::getReturnType + ReflectionFunctionAbstract::hasTentativeReturnType