ReflectionParameter::isDefaultValueConstant

(PHP 5 >= 5.4.6, PHP 7)

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.

add a note add a note

User Contributed Notes 1 note

up
1
kristianoye at gmail dot com
9 years ago
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.
To Top