Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
4d5daf4e
Commit
4d5daf4e
authored
May 29, 2017
by
Brent Shaffer
Committed by
Paul Yang
May 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds fluent setters for PHP (#3130)
parent
4674cc7c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
generated_class_test.php
php/tests/generated_class_test.php
+13
-0
php_generator.cc
src/google/protobuf/compiler/php/php_generator.cc
+2
-0
No files found.
php/tests/generated_class_test.php
View file @
4d5daf4e
...
...
@@ -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
());
}
}
src/google/protobuf/compiler/php/php_generator.cc
View file @
4d5daf4e
...
...
@@ -530,6 +530,8 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
"field_name"
,
field
->
name
());
}
printer
->
Print
(
"
\n
return $this;
\n
"
);
Outdent
(
printer
);
printer
->
Print
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment