Commit 4d5daf4e authored by Brent Shaffer's avatar Brent Shaffer Committed by Paul Yang

Adds fluent setters for PHP (#3130)

parent 4674cc7c
......@@ -877,4 +877,17 @@ class GeneratedClassTest extends TestBase
$m = new \Foo\PBEmpty();
$m = new \PrefixEmpty();
}
#########################################################
# Test fluent setters.
#########################################################
public function testFluentSetters()
{
$m = (new TestMessage())
->setOptionalInt32(1)
->setOptionalInt64(2);
$this->assertSame(1, $m->getOptionalInt32());
$this->assertSame(2, $m->getOptionalInt64());
}
}
......@@ -530,6 +530,8 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
"field_name", field->name());
}
printer->Print("\nreturn $this;\n");
Outdent(printer);
printer->Print(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment