--TEST-- reflection: ReflectionProperty::getDefaultValue --FILE-- getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'bar'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'static1'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'static2'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'val1'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'val2'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'nullable'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'nullable2'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'constantAst'); var_dump($property->getDefaultValue()); $property = new ReflectionProperty(TestClass::class, 'constantRuntimeAst'); var_dump($property->getDefaultValue()); $test = new TestClass; $test->dynamic = null; $property = new ReflectionProperty($test, 'dynamic'); var_dump($property->getDefaultValue()); ?> --EXPECT-- NULL string(3) "baz" NULL int(1234) NULL int(1234) NULL NULL int(4) int(42) NULL