Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4942

Set PHP struct generated field values as private with getters and setters

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.12.0
    • Fix Version/s: 0.14.0
    • Component/s: PHP - Compiler
    • Environment:

      I'm using Ubuntu 18.04, applies to all platforms

    • Patch Info:
      Patch Available

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              2dsharp Dedipyaman Das
              Reporter:
              dedipyaman Dedipyaman Das
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.5h Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 5h 50m
                5h 50m