Skip to content

Commit aee03b7

Browse files
bshaffercopybara-github
authored andcommitted
feat(php): Add PHP typehints for setters and remove redundant GPBUtil checks (#25296)
This PR modifies `php_generator.cc` to: - Add PHP typehints to setter method signatures for all types (for 64-bit integers, the type hint is `int|string` to maintain compatibility with 32-bit systems) - Remove redundant `GPBUtil::check...` for primitive types and messages (the PHP type hint provides sufficient validation) - Retain `GPBUtil::check...` for 32 and 64-bit integers, strings (for UTF-8 validation), enums, maps, and repeated fields Additionally makes the following changes: - Updates descriptor protos with generator changes - Suppresses float to int "loss of precision" warnings in tests which expect it - Removes compatibility in tests with PHPUnit 6, which is no longer needed - Proper casing in gencode for `true` and `false` (instead of `True` and `False`) Closes #25296 PiperOrigin-RevId: 856990912
1 parent 5687acc commit aee03b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+531
-555
lines changed

php/src/Google/Protobuf/Any.php

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/Api.php

Lines changed: 11 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/BoolValue.php

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/BytesValue.php

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/DoubleValue.php

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/Duration.php

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/Enum.php

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/EnumValue.php

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/Field.php

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

php/src/Google/Protobuf/FieldMask.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)