1--TEST-- 2ReflectionClass::hasConstant() - error cases 3--CREDITS-- 4Robin Fernandes <robinf@php.net> 5Steve Seear <stevseea@php.net> 6--FILE-- 7<?php 8class C { 9 const myConst = 1; 10} 11 12$rc = new ReflectionClass("C"); 13echo "Check invalid params:\n"; 14var_dump($rc->hasConstant()); 15var_dump($rc->hasConstant("myConst", "myConst")); 16var_dump($rc->hasConstant(null)); 17var_dump($rc->hasConstant(1)); 18var_dump($rc->hasConstant(1.5)); 19var_dump($rc->hasConstant(true)); 20var_dump($rc->hasConstant(array(1,2,3))); 21var_dump($rc->hasConstant(new C)); 22?> 23--EXPECTF-- 24Check invalid params: 25 26Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8 27NULL 28 29Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9 30NULL 31bool(false) 32bool(false) 33bool(false) 34bool(false) 35 36Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14 37NULL 38 39Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15 40NULL