Skip to content

Conversation

@backportbot-libresign
Copy link

Backport of PR #5991

Breaking changes:
- getFooter() now accepts only array $dimensions parameter
- UUID must be set via setTemplateVar('uuid', $uuid) before calling getFooter()

Changes:
- Remove FileEntity dependency from getFooter() signature
- Allow customization of all template variables via setTemplateVar()
- Only fetch default values from appConfig if not already customized
- Check if 'uuid' exists in templateVars before building validationSite

Benefits:
- Reduced coupling - no dependency on FileEntity
- More flexible - all variables customizable via same API
- Cleaner design - consistent use of setTemplateVar() for all variables
- Easier testing - no need to mock FileEntity

Signed-off-by: Vitor Mattos <[email protected]>
- Use setTemplateVar('uuid') to pass UUID to FooterHandler
- Call getFooter() with only dimensions parameter
- Maintains all existing functionality

Signed-off-by: Vitor Mattos <[email protected]>
- Use setTemplateVar('uuid') before calling getFooter()
- Remove FileEntity mock creation
- Simplify test setup

Signed-off-by: Vitor Mattos <[email protected]>
Only generate QR code if validationSite is available in templateVars.
This prevents undefined array key error when uuid is not set.

Signed-off-by: Vitor Mattos <[email protected]>
Add tests for specific edge cases:
- testGetFooterWithoutUuid: ensures no error when uuid is not set
- testCustomValidationSiteNotOverwritten: validates that custom
  validationSite set via setTemplateVar() is not overwritten by
  appConfig defaults

These tests complement the existing dataProvider tests and ensure
the refactored code handles edge cases properly.

Signed-off-by: Vitor Mattos <[email protected]>
Introduces a type-safe collection class for footer template variables
using magic methods (__call) with runtime type validation.

Benefits:
- Whitelist of allowed variables with expected types
- Runtime type checking for all setters
- Fluent interface for method chaining
- Clean API with only ~70 lines of code
- Prevents invalid variables or type mismatches

Signed-off-by: Vitor Mattos <[email protected]>
Replace raw array with TemplateVariables class for better type safety
and explicit contract of available template variables.

Changes:
- Use TemplateVariables instance instead of array
- Replace array access with typed getters/setters
- Maintain backward compatibility via setTemplateVar()
- Improved code readability with explicit method names

Signed-off-by: Vitor Mattos <[email protected]>
Add 21 tests with 53 assertions covering:
- Setters/getters for all 9 variables (via DataProvider)
- Null returns for unset variables
- Array conversion and merge functionality
- Whitelist validation (rejects unknown variables)
- Type validation (rejects wrong types)
- Invalid method calls

Use PHP 8 attributes for DataProviders for cleaner syntax.

Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Dec 4, 2025
@backportbot-libresign backportbot-libresign bot added this to the Next Patch (32) milestone Dec 4, 2025
@vitormattos vitormattos merged commit 302911f into stable32 Dec 4, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/5991/stable32 branch December 4, 2025 17:19
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

2 participants