mirror of
https://github.com/php/php-src.git
synced 2026-03-29 11:42:17 +02:00
This deprecates:
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParameter::getClass()
These APIs have been superseded by ReflectionParameter::getType()
since PHP 7.0. Types introduced since that time are not available
through the old APIs, and their behavior is getting increasingly
confusing. This is how they interact with PHP 8 union types:
* isArray() will return true if the type is array or ?array,
but not any other union type
* Same for isCallable().
* getClass() will return a class for T|int etc, as long as the
union only contains a single type. T1|T2 will return null.
This behavior is not particularly reasonable or useful, and will
get more confusing as new type system extensions are added.
Closes GH-5209.
28 lines
791 B
PHP
28 lines
791 B
PHP
--TEST--
|
|
public bool ReflectionParameter::isArray ( void );
|
|
--CREDITS--
|
|
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
|
|
--FILE--
|
|
<?php
|
|
|
|
function testReflectionIsArray(array $a, ?array $b, iterable $c, array|string $d) {}
|
|
|
|
$reflection = new ReflectionFunction('testReflectionIsArray');
|
|
|
|
foreach ($reflection->getParameters() as $parameter) {
|
|
var_dump($parameter->isArray());
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Function ReflectionParameter::isArray() is deprecated in %s on line %d
|
|
bool(true)
|
|
|
|
Deprecated: Function ReflectionParameter::isArray() is deprecated in %s on line %d
|
|
bool(true)
|
|
|
|
Deprecated: Function ReflectionParameter::isArray() is deprecated in %s on line %d
|
|
bool(false)
|
|
|
|
Deprecated: Function ReflectionParameter::isArray() is deprecated in %s on line %d
|
|
bool(false)
|