You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Duru Can Celasun (Jira)" <ji...@apache.org> on 2019/10/08 22:25:00 UTC

[jira] [Commented] (THRIFT-4942) Set PHP struct generated field values as private with getters and setters

    [ https://issues.apache.org/jira/browse/THRIFT-4942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947214#comment-16947214 ] 

Duru Can Celasun commented on THRIFT-4942:
------------------------------------------

The patch itself looks fine, but I'm not sure if it's worth the breaking change.

Any PHP developer who would like to share their opinion?

> Set PHP struct generated field values as private with getters and setters
> -------------------------------------------------------------------------
>
>                 Key: THRIFT-4942
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4942
>             Project: Thrift
>          Issue Type: Improvement
>          Components: PHP - Compiler
>    Affects Versions: 0.12.0
>         Environment: I'm using Ubuntu 18.04, applies to all platforms
>            Reporter: Dedipyaman Das
>            Priority: Minor
>              Labels: Breaking-Change, newbie, pull-request-available
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The PHP autogenerated code currently keeps the struct derived class attributes public, and they have to be accessed like: $class->field.
> The java version keeps them private instead and uses getters and setters to access and mutate the data.
> A similar approach would be a better choice for most oop based php coding standards. 
> I've created a working patch, so if I get approval I will create a Pull request for this.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)