mirror of
https://github.com/php/php-src.git
synced 2026-04-17 13:01:02 +02:00
We fix the most often occuring typos according to a recent codespell report[1] in tests, code comments and documentation. [1] <https://fossies.org/linux/test/php-src-master-f8f48ce.191129.tar.gz/codespell.html>.
37 lines
852 B
PHP
37 lines
852 B
PHP
--TEST--
|
|
ReflectionClass::hasConstant()
|
|
--CREDITS--
|
|
Robin Fernandes <robinf@php.net>
|
|
Steve Seear <stevseea@php.net>
|
|
--FILE--
|
|
<?php
|
|
class C {
|
|
const myConst = 1;
|
|
}
|
|
|
|
class D extends C {
|
|
}
|
|
|
|
|
|
$rc = new ReflectionClass("C");
|
|
echo "Check existing constant: ";
|
|
var_dump($rc->hasConstant("myConst"));
|
|
echo "Check existing constant, different case: ";
|
|
var_dump($rc->hasConstant("MyCoNsT"));
|
|
echo "Check absent constant: ";
|
|
var_dump($rc->hasConstant("doesNotExist"));
|
|
|
|
|
|
$rd = new ReflectionClass("D");
|
|
echo "Check inherited constant: ";
|
|
var_dump($rd->hasConstant("myConst"));
|
|
echo "Check absent constant: ";
|
|
var_dump($rd->hasConstant("doesNotExist"));
|
|
?>
|
|
--EXPECT--
|
|
Check existing constant: bool(true)
|
|
Check existing constant, different case: bool(false)
|
|
Check absent constant: bool(false)
|
|
Check inherited constant: bool(true)
|
|
Check absent constant: bool(false)
|