Skip to content

[Notifier] [DX] Dsn::getRequiredOption() #39457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2021

Conversation

OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Dec 11, 2020

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
Tickets ---
License MIT
Doc PR ---

Todo

  • use the new method in all available bridges and bump composer.json files to notifer:5.3
  • add tests

This will lead to a much cleaner "communication" between the factory and the transport which option is required and which is optional. This method will also reduce the code duplication in the bridges.

IMHO we should add more of those convenient "helpers" to lower the burden for new bridges.

@carsonbot carsonbot added Status: Needs Review Notifier DX DX = Developer eXperience (anything that improves the experience of using Symfony) Feature labels Dec 11, 2020
@carsonbot carsonbot changed the title [Notifier][DX] Dsn::getRequiredOption() [Notifier] [DX] Dsn::getRequiredOption() Dec 11, 2020
Comment on lines -37 to +35
$consumerKey = $dsn->getOption('consumer_key');

if (!$consumerKey) {
throw new IncompleteDsnException('Missing consumer_key.', $dsn->getOriginalDsn());
}

$serviceName = $dsn->getOption('service_name');

if (!$serviceName) {
throw new IncompleteDsnException('Missing service_name.', $dsn->getOriginalDsn());
}

$consumerKey = $dsn->getRequiredOption('consumer_key');
$serviceName = $dsn->getRequiredOption('service_name');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Less noise by using the new method

@OskarStark OskarStark force-pushed the getRequiredOption branch 2 times, most recently from c2b70b5 to 9c82bd1 Compare December 11, 2020 12:29
Copy link
Member

@jderusse jderusse left a comment

Choose a reason for hiding this comment

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

Please fix all the components in the same PR.

@OskarStark
Copy link
Contributor Author

Will fix all bridges 👍🏻

@jderusse jderusse added this to the 5.x milestone Dec 12, 2020
@OskarStark OskarStark closed this Dec 21, 2020
@OskarStark OskarStark reopened this Dec 21, 2020
@OskarStark OskarStark force-pushed the getRequiredOption branch 4 times, most recently from e4de080 to 2b43adc Compare December 28, 2020 07:09
@OskarStark OskarStark force-pushed the getRequiredOption branch 2 times, most recently from cd13710 to ee16a5d Compare January 4, 2021 07:20
@OskarStark
Copy link
Contributor Author

Ready to merge from my side ✌🏻

@fabpot
Copy link
Member

fabpot commented Jan 6, 2021

@OskarStark Looks like the failing tests are related to the changes of this PR. Can you have a look?

@OskarStark
Copy link
Contributor Author

Sure will do later, will ping you when done

@OskarStark
Copy link
Contributor Author

All green now @fabpot 👍

@fabpot fabpot force-pushed the getRequiredOption branch from f04d08d to 3f095bf Compare January 6, 2021 12:35
@fabpot
Copy link
Member

fabpot commented Jan 6, 2021

Thank you @OskarStark.

@fabpot fabpot merged commit fe91b86 into symfony:5.x Jan 6, 2021
@OskarStark OskarStark deleted the getRequiredOption branch January 6, 2021 12:50
@fabpot fabpot mentioned this pull request Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Feature Notifier Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants