Support dynamic tempDir parameter in TranslationExtension#151
Merged
Conversation
Restore support for using `tempDir` as a dynamic container parameter. The strict is_string() check rejected DynamicParameter values; instead build the default cache dir as a dynamic concatenation when tempDir is not a plain string. https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
Rename the tempDir test cases to intent-revealing methods and build the containers with Contributte\Tester\Utils\ContainerBuilder (buildWith for the dynamic-parameter scenario). https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
contributte/tester requires PHP >=8.2; build the test containers with Nette\DI\ContainerLoader directly instead. https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
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.
Summary
Updated
TranslationExtensionto support dynamictempDirparameters that are resolved at container build time, rather than requiring a static string value.Key Changes
cache.dirconfiguration schema to accept bothstringandStatementtypes, allowing for dynamic parameter resolutiontempDirparameter retrieval to use null coalescing (?? null) instead of throwing an exception when the parameter is not settempDirvalues and dynamicStatementinstances:Statementwithimplodeto concatenate at runtimetest13()to verify the extension works correctly whentempDiris configured as a dynamic parameterImplementation Details
The change allows the translation cache directory to be properly configured even when
tempDiris a dynamic parameter (e.g., when usingsetDynamicParameterNames()in the compiler). This is achieved by deferring the path concatenation to runtime via aStatementobject when the parameter cannot be resolved statically.https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB