Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 +96,6 @@ function ($file) {
);
}

public function testAppCodeUsage()
{
$files = Files::init();
$componentRegistrar = new ComponentRegistrar();
$libPaths = $componentRegistrar->getPaths(ComponentRegistrar::LIBRARY);
$invoker = new AggregateInvoker($this);
$invoker(
function ($file) use ($libPaths) {
$content = file_get_contents($file);
foreach ($libPaths as $libPath) {
if (strpos($file, $libPath) === 0) {
$this->assertSame(
0,
preg_match('~(?<![a-z\\d_:]|->|function\\s)__\\s*\\(~iS', $content),
'Function __() is defined outside of the library and must not be used there. ' .
'Replacement suggestion: new \\Magento\\Framework\\Phrase()'
);
}
}
},
$files->getPhpFiles(
Files::INCLUDE_PUB_CODE |
Files::INCLUDE_LIBS |
Files::AS_DATA_SET |
Files::INCLUDE_NON_CLASSES
)
);
}

/**
* @inheritdoc
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ protected function _toHtml()
if ($this->isCurrent()) {
$html = '<li class="nav item current">';
$html .= '<strong>'
. $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()))
. $this->escapeHtml(__($this->getLabel()))
. '</strong>';
$html .= '</li>';
} else {
$html = '<li class="nav item' . $highlight . '"><a href="' . $this->escapeHtml($this->getHref()) . '"';
$html .= $this->getTitle()
? ' title="' . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getTitle())) . '"'
? ' title="' . $this->escapeHtml(__($this->getTitle())) . '"'
: '';
$html .= $this->getAttributesHtml() . '>';

if ($this->getIsHighlighted()) {
$html .= '<strong>';
}

$html .= $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()));
$html .= $this->escapeHtml(__($this->getLabel()));

if ($this->getIsHighlighted()) {
$html .= '</strong>';
Expand Down