Skip to content

Commit

Permalink
readability
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Jan 20, 2022
1 parent f9ee559 commit afe3f0f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Generation/FieldDetails.php
Expand Up @@ -170,17 +170,16 @@ private function determineIsRequired(DescriptorProto $containingMessage, FieldDe
{
$isRequired = ProtoHelpers::isRequired($field);
$fullName = $containingMessage->desc->getFullName();
$methodName = $field->getName();
if ($isRequired) {
if (isset(self::$optionalToRequiredFixes[$fullName])) {
if (in_array($methodName, self::$optionalToRequiredFixes[$fullName])) {
if (in_array($field->getName(), self::$optionalToRequiredFixes[$fullName])) {
// Force field to be optional (even though it's required) to preserve BC
return false;
}
}
} else {
if (isset(self::$requiredToOptionalFixes[$fullName])) {
if (in_array($methodName, self::$requiredToOptionalFixes[$fullName])) {
if (in_array($field->getName(), self::$requiredToOptionalFixes[$fullName])) {
// Force field to be required (even though it's optional) to preserve BC
return true;
}
Expand Down

0 comments on commit afe3f0f

Please sign in to comment.