public function testSetGetDefaultValue() { $prop = new PhpProperty('needsName'); $this->assertNull($prop->getDefaultValue()); $this->assertFalse($prop->hasDefaultValue()); $this->assertSame($prop, $prop->setDefaultValue('foo')); $this->assertEquals('foo', $prop->getDefaultValue()); $this->assertTrue($prop->hasDefaultValue()); $this->assertSame($prop, $prop->unsetDefaultValue()); $this->assertNull($prop->getDefaultValue()); $this->assertFalse($prop->hasDefaultValue()); }
public function visitProperty(PhpProperty $property) { $this->visitDocblock($property->getDocblock()); $this->writer->write($property->getVisibility() . ' ' . ($property->isStatic() ? 'static ' : '') . '$' . $property->getName()); if ($property->hasDefaultValue()) { $this->writer->write(' = ' . $this->getPhpExport($property->getDefaultValue())); } $this->writer->writeln(';'); }