-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feature/faker #2
base: master
Are you sure you want to change the base?
Conversation
using hoa/regex to use same regex as NirValidator using phpspec and NirValidator to test the generator qual and test passed todo : generate InvalidNir generate ValidNir from parameters
review clean comments and fix Co-authored-by: Dylan Broussard <[email protected]>
fix cs fixer Co-authored-by: Dylan Broussard <[email protected]>
NirProvider.php Provider for Faker to create nir from Params (gender, datebirth,departement) NnpProvider.php Provider for Faker to create nnp TDD for thoses Providers NirProviderSpec.php NnpProviderSpec.php revert on qual overrride add NnpProvider.php suppress warning for psalm
{ | ||
return [ | ||
'beNirFromParams' => function (string $value, \DateTime $dateNaissance, string $departement) { | ||
$bool = preg_match(NirValidator::NIR_REGEX, $value, $matches); |
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.
Est-ce qu'on ne pourrait pas mettre un nom plus explicite que $bool
? Je ne comprends pas vraiment à quoi correspond la valeur
*/ | ||
public function nnp(string $gender = null): string | ||
{ | ||
// Gender |
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.
Du coup même remarque sur le fait de stocker chaque valeur dans une variable et concaténer à la fin
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.
donc tu preferes que je stocke les parts dans des var ? car la je renvois direct la concatenation
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.
Il faudrait aussi revoir les commentaires, car certains sont en anglais et d'autres en français.
Il faudrait ne choisir qu'une seule langue.
src/Faker/NirProvider.php
Outdated
$nir = $this->numberBetween(1, 2); | ||
} | ||
|
||
if ($date === null) { |
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.
Il serait préférable de faire la condition comme au dessus, c'est à dire de vérifier si c'est bien un DatetimeInterface.
} | ||
|
||
/** | ||
* Valide un NIR généré à partir du validateur du package |
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.
Il faudrait revoir cette phrase car elle ne veut pas dire grand chose, le concept de package
est très lié à Java, pas au monde PHP.
return [ | ||
'beNirFromParams' => function (string $value, \DateTime $dateNaissance, string $departement) { | ||
$bool = preg_match(NirValidator::NIR_REGEX, $value, $matches); | ||
$verifYear = $matches['moisNaissance'] === $dateNaissance->format('m'); |
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.
C'est du franglais pour le coup
first pass on cs fixer Co-authored-by: Dylan Broussard <[email protected]> Co-authored-by: Mathias STRASSER <[email protected]>
change NirProvider to AssureProvider as it override nir methode refacto code update qual setup
simplify test on NnpProviderSpec.php
Co-authored-by: Mathias STRASSER <[email protected]>
with qual ok
class AssureProvider extends Person | ||
{ | ||
/* @phpstan-ignore-next-line */ | ||
public function nir($gender = null, $formatted = false, \DateTime $birthday = null, string $departmentCode = null): string |
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.
pourquoi ne pas typer gender et formatted ?
Have a faker Adding nir support for parameter
Have a faker Adding nnp provider