Fix 'Undefined array key completed' warning in Platform Order Decorator#585
Open
proteusbr1 wants to merge 1 commit intopagarme:masterfrom
Open
Fix 'Undefined array key completed' warning in Platform Order Decorator#585proteusbr1 wants to merge 1 commit intopagarme:masterfrom
proteusbr1 wants to merge 1 commit intopagarme:masterfrom
Conversation
This commit adds the missing 'completed' status to the status-to-state mapping and implements a safe fallback using the null coalescing operator. This prevents warnings when unknown statuses are encountered.
|
Por favor, catalogue-o seguindo as instruções nesta documentação. [Via VPN]. 💁 Qualquer problema ou dúvida, estamos no Slack, basta abrir um ticket no canal #help-foundation-platform. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a PHP warning that occurred when the getState() method received the WooCommerce 'completed' status, which was not mapped in the status-to-state conversion array.
Key changes:
- Added mapping for WooCommerce
'completed'status to'complete'state - Replaced incorrectly used ternary operator with null coalescing operator for safer fallback handling
- Added trailing comma to last array element following PHP best practices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qual o tipo de PR é esse? (marque todos os aplicáveis)
Descrição
Este PR corrige um
Warning: Undefined array key "completed"que ocorria quando o métodogetStaterecebia um status do WooCommerce que não estava mapeado (neste caso,completed).Alterações realizadas:
completed=>completeao array$statusToState.operator null coalescing (??)como fallback seguro. Caso o plugin receba um status desconhecido no futuro, ele retornará'processing'em vez de gerar um Warning.Cenários testados
completedagora é mapeado corretamente e status desconhecidos não geram mais warnings.