-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Move functions.php into Framework #16705
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
Conversation
Hi @fooman. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
This is not critical due to Composer cache. @fooman please clarify steps: how can we run Magento module without Magento application itself? |
My module should only require on modules that it needs to work. So for example
should be sufficient for my module to declare all it's dependencies. Due to the homeless Another argument for the above change is that technically nearly all This is for running unit tests which should not require the complete Magento application. |
Aside from relying on a cache as a solution it makes a huge difference for PhpStorm if it needs to index 100 modules or only 1 though. |
Still quite fast, isn't it? Is it possible to have magento-base as external library instead of indexing it in vendor folder maybe? Do you have any idea how to get rid of |
I think the |
Replacing is not a big problem, at least we can deprecate it and not use in new code. New translation mechanism should provide some killer features like context-dependent translation or something.
Ok, that's another case, but to have a proper unit tests bootstrap you should require base anyway. Can we have this function as a separate Composer component? Probably bootstrap for unit tests or at least additional logic on top of
|
@fooman ok, looks like I've figured out a solution I would really like.
|
Then |
@orlangur good idea on the naming. I have updated this pull request (squashed commits) with your suggestions as well as created #16800 for 2.2 Installations via Composer (ie vendor/magento/framework) Installations via git clone (ie lib/internal/Magento/Framework) Other uses utilising the old app/etc/functions.php and expecting |
Closing this pull request in favour of forward porting the final implementation in #16800 |
Description
functions.php
provides the custom Magento function__()
to trigger translations. For some unknown reason this file lives under app/code. As such it is only distributed via the full magento distribution package. This in turn makes it a lot harder for developers to work with Magento in a modular fashion.Ideally I want to be able to run .
composer require magento/framework .
run my unit tests
Due to
__()
only being available in the complete distribution I need to require all of Magento for 1 single file. A difference of 100+ modules.I currently do not see any rationale for why this file is not part of any module. This PR proposes to move it into the Framework module. It also simplifies the bootstrapping processing as this file can be autoloaded. Happy to move it into any other module if desired.
Fixed Issues (if relevant)
Manual testing scenarios
composer require splendidinternet/mage2-locale-de-de
Contribution checklist
Port for: #16800