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

[2.2-dev] Move functions.php into Framework #16800

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

require_once BP . '/app/functions.php';

/* Custom umask value may be provided in optional mage_umask file in root */
$umaskFile = BP . '/magento_umask';
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
Expand Down
23 changes: 14 additions & 9 deletions app/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@

/**
* Create value-object \Magento\Framework\Phrase
*
* @deprecated The global function __() is now loaded via Magento Framework, the below require is only
* for backwards compatibility reasons and this file will be removed in a future version
* @see Magento\Framework\Phrase\__.php
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return \Magento\Framework\Phrase
*/
function __()
{
$argc = func_get_args();
if (!function_exists('__')) {
function __()
{
$argc = func_get_args();

$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
$argc = $argc[0];
}
$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
$argc = $argc[0];
}

return new \Magento\Framework\Phrase($text, $argc);
return new \Magento\Framework\Phrase($text, $argc);
}
}
1 change: 0 additions & 1 deletion dev/tests/unit/framework/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}

require_once __DIR__ . '/autoload.php';
require BP . '/app/functions.php';

setCustomErrorHandler();

Expand Down
22 changes: 22 additions & 0 deletions lib/internal/Magento/Framework/Phrase/__.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Create value-object \Magento\Framework\Phrase
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return \Magento\Framework\Phrase
*/
function __()
{
$argc = func_get_args();

$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
$argc = $argc[0];
}

return new \Magento\Framework\Phrase($text, $argc);
}
4 changes: 4 additions & 0 deletions lib/internal/Magento/Framework/registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
'magento/framework',
__DIR__
);

if (!function_exists('__')) {
require 'Phrase/__.php';
}