文字

ReflectionParameter::isDefaultValueConstant

(PHP 5 >= 5.4.6)

ReflectionParameter::isDefaultValueConstantReturns whether the default value of this parameter is constant

说明

public bool ReflectionParameter::isDefaultValueConstant ( void )

Warning

本函数还未编写文档,仅有参数列表。

参数

此函数没有参数。

返回值

Returns TRUE if the default value is constant, FALSE if it is not or NULL on failure.

用户评论:

[#1] kristianoye at gmail dot com [2015-05-25 21:39:59]

This method returns true only if the parameter's default value is set to a named constant.  e.g.

class Foo {
   const OPTION_MULTIGET = 1;

   //Method 1
   public function setGetOptions($opts=0);

   //Method 2
   public function setMultiGetOptions($opts=Foo::OPTION_MULTIGET);
}

Method 1's first ReflectionParameter will return isDefaultValueConstant() = false (0 is a "constant"/static value but not a named constant) and Method 2's will return isDefaultValueConsntant() = true.

上一篇: 下一篇: