-
Notifications
You must be signed in to change notification settings - Fork 348
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
Added medical extension to core #232
Added medical extension to core #232
Conversation
This would be a good example of a super standard extension. |
Tbh i don't see added value in adding extensions for everything. Since the fact that this is not language specific and generic we could just leave it in Core? Size wise it is not an issue where the only real problems there are with the actual realText methods |
Just a terminology check. The We need to add an extension interface to everything that has a "helper method" in |
src/Faker/Core/Medical.php
Outdated
/** | ||
* @inheritDoc | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @inheritDoc | |
*/ |
Can we remove this?
This information is automatically inherited, and these DocBlocks are generally useless.
test/Faker/Core/MedicalTest.php
Outdated
{ | ||
public function testBloodType(): void | ||
{ | ||
self::assertContains($this->faker->bloodType(), ['A', 'AB', 'B', 'O']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a more appropriate assertion?
As far as I am concerned, when using assertContains()
, then $needle
would be the expected value here, whereas $haystack
is the actual value.
Right now it is the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The needle is always the value and the haystack the expected? In this case needle also needs to be a string.
This is a 1:1 copy from the existing tests so i wonder where you want to?
src/Faker/Core/Medical.php
Outdated
/** | ||
* @experimental This class is experimental and does not fall under our BC promise | ||
*/ | ||
final class Medical implements Extension\MedicalExtension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a Blood
extension would make more sense?
All of the methods in this class share the blood
prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed and reword to Blood instead
Understand what you mean @Nyholm. What approach will we take here since i do not really see value in splitting the not language specific things as well. Or will we put the code in Faker\Extension\Medical itself |
@pimjansen - I think it's fine to use a |
I argue that we dont need to add this extension to a language specific package.
No, never, we must use an interface because we define methods in |
@@ -62,6 +62,7 @@ public static function defaultExtensions(): array | |||
{ | |||
return [ | |||
FileExtension::class => Core\File::class, | |||
MedicalExtension::class => Core\Medical::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you rename this to BloodExtension
, then make sure this is in alphabetical order. It would please my OCD =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about Medical\BloodExtension
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the list of the current features we have, there is nothing else that would fit in Medical
namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a list of deceases, but that would be localized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather keep the list of features as small as possible.
I am more than happy to add all kinds of medical related stuff in a separate package. Ie fakerphp/medical
.
Lets focus on the current features and this PR at the moment and later we can discuss if this belongs to core or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep this in a fakerphp/medical, this doesn’t feel like something that every application would need. Which is kind of the point of our “core”, to keep general and commonly needed extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that last one a bit since it brings the ease of use. Nobody wants to have 6 extra dependencies for a package like this.
I ofc agree to split of all the language specifics where it is impossible to maintain centralised and also all the language packs holds a lot of storage but for all other generic stuff?
Since for example when i need to create a dummy person with all its info i need a for example Swedish pack, Faker core and a medical extension to add its blood type
Pim, could you please rename this extension to |
@@ -62,6 +62,7 @@ public static function defaultExtensions(): array | |||
{ | |||
return [ | |||
FileExtension::class => Core\File::class, | |||
MedicalExtension::class => Core\Medical::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep this in a fakerphp/medical, this doesn’t feel like something that every application would need. Which is kind of the point of our “core”, to keep general and commonly needed extensions.
Yeah will update and include all the comments somewhere this week |
862cbed
to
8f1badd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I am happy with this PR.
What is the reason for this PR?
Medical added as Core Extension
Author's checklist
Summary of changes
Medical added as Core Extension
Review checklist