Skip to content
Closed
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
25 changes: 9 additions & 16 deletions app/functions.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* @deprecated The global function __() is now loaded via Composer in the 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
*/

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

$text = array_shift($argc);
if (!empty($argc) && is_array($argc[0])) {
$argc = $argc[0];
$vendorDir = require VENDOR_PATH;
if (!function_exists('__')) {
if (file_exists(BP . '/lib/internal/Magento/Framework/Phrase/__.php')) {
require BP . '/lib/internal/Magento/Framework/Phrase/__.php';
} elseif (file_exists(BP . "/{$vendorDir}/magento/framework/Phrase/__.php")) {
require BP . "/{$vendorDir}/magento/framework/Phrase/__.php";
}

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
*
* @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/Phrase/registration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
if (!function_exists('__')) {
require '__.php';
}
3 changes: 2 additions & 1 deletion lib/internal/Magento/Framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"Magento\\Framework\\": ""
},
"files": [
"registration.php"
"registration.php",
"Phrase/__.php"
]
}
}