-
Notifications
You must be signed in to change notification settings - Fork 0
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
Corrige la duplication d'un arreté #1025
Conversation
mmarchois
commented
Oct 22, 2024
- Closes Erreur 500 lors de la duplication d'un arrêté : "Cannot assign null to property App\Application\Regulation\Command\SaveRegulationGeneralInfoCommand::$additionalVisas of type array" #1023
753d7f9
to
aa31d2d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1025 +/- ##
=========================================
Coverage 99.00% 99.00%
Complexity 1666 1666
=========================================
Files 326 326
Lines 7212 7212
=========================================
Hits 7140 7140
Misses 72 72 ☔ View full report in Codecov by Sentry. |
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.
J'approuve pour ne pas bloquer mais une suggestion si jamais elle fait sens
@@ -55,8 +55,8 @@ private function duplicateRegulationOrderRecord( | |||
$generalInfo->description = $originalRegulationOrder->getDescription(); | |||
$generalInfo->startDate = $originalRegulationOrder->getStartDate(); | |||
$generalInfo->endDate = $originalRegulationOrder->getEndDate(); | |||
$generalInfo->additionalVisas = $originalRegulationOrder->getAdditionalVisas(); | |||
$generalInfo->additionalReasons = $originalRegulationOrder->getAdditionalReasons(); | |||
$generalInfo->additionalVisas = $originalRegulationOrder->getAdditionalVisas() ?? []; |
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.
Ça corrige mais je me demandais si ça faisait sens de mettre ce ?? []
directement dans getAdditionalVisas()
et getAdditionalReasons()
?
Car en réalité on ne veut jamais manipuler null
sur ces arrays, c'est une source d'erreur, il faut un array quitte à ce qu'il soit vide
Or en l'état on devrait se rappeler d'utiliser ?? []
chaque fois qu'on appelle un de ces deux getters
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.
Disons que nous l'avons déjà fait à différents endroits. Je ne suis absolument pas contre le fait de faire évoluer les getters devant retourner des tableaux.
Je pense faire une PR à part pour avoir une refacto plus large. Mais je partage ton avis !
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.
OK !
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.