Skip to content
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

[php-di v7] Optimize compiled string definitions #16

Open
wants to merge 4 commits into
base: mod7
Choose a base branch
from

Conversation

partikus
Copy link
Collaborator

@partikus partikus commented Jan 13, 2023

Version compatible with PHP ^8.0 as a successor of #5

Details (copied from #5)

  • run preg_replace_callback already during compilation

from:

    protected function get5ce3da5dc66c0791095127()
    {
        return \DI\Definition\StringDefinition::resolveExpression('path.cache', '{BASE_PATH}/application/cache', $this->delegateContainer);
    }

    protected function get5ce3da5dc66c3314070297()
    {
        return \DI\Definition\StringDefinition::resolveExpression('path.cache.app', '{path.cache}/file', $this->delegateContainer);
    }

to:

    protected function get5ce3da5dc66c0791095127()
    {
        return ''.$this->resolveStringPlaceholder('BASE_PATH', 'path.cache').'/application/cache';
    }

    protected function get5ce3da5dc66c3314070297()
    {
        return ''.$this->resolveStringPlaceholder('path.cache', 'path.cache.app').'/file';
    }

where resolveStringPlaceholder proxies to $this->delegateContainer->get()

@partikus partikus self-assigned this Jan 13, 2023
@partikus partikus force-pushed the feature/php-di-7-compiler-optimize-string-definitions branch from b206c41 to 3ed2725 Compare January 10, 2024 07:56
@partikus partikus force-pushed the feature/php-di-7-compiler-optimize-string-definitions branch from 3ed2725 to beab0a9 Compare January 10, 2024 08:38
1. Detected deprecations in use:
- Rule "braces" is deprecated. Use "single_space_around_construct", "control_structure_braces", "control_structure_continuation_position", "declare_parentheses", "no_multiple_statements_per_line", "curly_braces_position", "statement_indentation" and "no_extra_blank_lines" instead.

2. Detected deprecations in use:
- Rule "curly_braces_position" is deprecated. Use "braces_position" instead.
@partikus partikus force-pushed the feature/php-di-7-compiler-optimize-string-definitions branch 2 times, most recently from c18f7c0 to 8c11c17 Compare January 10, 2024 12:54
@partikus partikus force-pushed the feature/php-di-7-compiler-optimize-string-definitions branch from 8c11c17 to 06a8229 Compare January 11, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants