Skip to content

Conversation

@Oliboy50
Copy link
Contributor

@Oliboy50 Oliboy50 commented Mar 12, 2020

Why

  • if ($reason === '') can't be true after if (empty($reason))
    => because empty() already test all falsy values (including '')

How

  • add tests for current @deprecated printing behavior
  • remove the useless condition replace empty() with === null

@Oliboy50 Oliboy50 requested a review from simPod March 12, 2020 16:04
Copy link
Member

@vladar vladar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

The previous version probably contained a bug. We should allow $reason === '' and it should print @deprecated. I added suggestions inline.

Technically this is a breaking change but this will go to the next major so it's OK. But we should also add a note about this in https://github.com/webonyx/graphql-php/blob/master/CHANGELOG.md

@Oliboy50 Oliboy50 changed the title test(deprecated): add @deprecated directive tests for SchemaPrinter fix(deprecated): put @deprecated directive when deprecationReason is empty string Mar 13, 2020
@Oliboy50 Oliboy50 requested a review from vladar March 13, 2020 15:31
@Oliboy50 Oliboy50 changed the title fix(deprecated): put @deprecated directive when deprecationReason is empty string put @deprecated directive when deprecationReason is empty string Mar 16, 2020
@Oliboy50 Oliboy50 changed the title put @deprecated directive when deprecationReason is empty string print @deprecated directive when deprecationReason is empty string Mar 16, 2020
@Oliboy50
Copy link
Contributor Author

Oliboy50 commented Mar 20, 2020

Is there anything else you want me to do, here? 🙏

@vladar
Copy link
Member

vladar commented Apr 10, 2020

Great job! Let's ship it 🚢 And sorry for the delay.

@vladar vladar merged commit ab5b950 into webonyx:master Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants