Skip to content

Commit 434251f

Browse files
Merge branch 'develop' of https://github.com/magento/magento2ce into MAGETWO-58729
2 parents 5e73f19 + 535860a commit 434251f

File tree

40 files changed

+838
-334
lines changed

40 files changed

+838
-334
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ atlassian*
2525
/.grunt
2626
/Gruntfile.js
2727
/package.json
28+
/.php_cs
29+
/.php_cs.cache
30+
/grunt-config.json
31+
/dev/tools/grunt/configs/local-themes.js
2832

2933
/pub/media/*.*
3034
!/pub/media/.htaccess

.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
order allow,deny
223223
deny from all
224224
</Files>
225-
<Files .php_cs>
225+
<Files .php_cs.dist>
226226
order allow,deny
227227
deny from all
228228
</Files>

.htaccess.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
order allow,deny
199199
deny from all
200200
</Files>
201-
<Files .php_cs>
201+
<Files .php_cs.dist>
202202
order allow,deny
203203
deny from all
204204
</Files>

.php_cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.php_cs.dist

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Pre-commit hook installation:
9+
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
10+
*/
11+
$finder = PhpCsFixer\Finder::create()
12+
->name('*.phtml')
13+
->exclude('dev/tests/functional/generated')
14+
->exclude('dev/tests/functional/var')
15+
->exclude('dev/tests/functional/vendor')
16+
->exclude('dev/tests/integration/tmp')
17+
->exclude('dev/tests/integration/var')
18+
->exclude('lib/internal/Cm')
19+
->exclude('lib/internal/Credis')
20+
->exclude('lib/internal/Less')
21+
->exclude('lib/internal/LinLibertineFont')
22+
->exclude('pub/media')
23+
->exclude('pub/static')
24+
->exclude('setup/vendor')
25+
->exclude('var');
26+
27+
return PhpCsFixer\Config::create()
28+
->setFinder($finder)
29+
->setRules([
30+
'@PSR2' => true,
31+
'array_syntax' => ['syntax' => 'short'],
32+
'concat_space' => ['spacing' => 'one'],
33+
'include' => true,
34+
'new_with_braces' => true,
35+
'no_empty_statement' => true,
36+
'no_extra_consecutive_blank_lines' => true,
37+
'no_leading_import_slash' => true,
38+
'no_leading_namespace_whitespace' => true,
39+
'no_multiline_whitespace_around_double_arrow' => true,
40+
'no_multiline_whitespace_before_semicolons' => true,
41+
'no_singleline_whitespace_before_semicolons' => true,
42+
'no_trailing_comma_in_singleline_array' => true,
43+
'no_unused_imports' => true,
44+
'no_whitespace_in_blank_line' => true,
45+
'object_operator_without_whitespace' => true,
46+
'ordered_imports' => true,
47+
'standardize_not_equals' => true,
48+
'ternary_operator_spaces' => true,
49+
]);
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"Read Details","Read Details"
22
"Mark as Read","Mark as Read"
33
"Are you sure?","Are you sure?"
4-
Remove,Remove
4+
"Remove","Remove"
55
"Messages Inbox","Messages Inbox"
66
"You have %1 new system messages","You have %1 new system messages"
77
"You have %1 new system message","You have %1 new system message"
88
"Incoming Message","Incoming Message"
9-
close,close
10-
Notifications,Notifications
9+
"close","close"
10+
"Notifications","Notifications"
1111
"The message has been marked as Read.","The message has been marked as Read."
1212
"We couldn't mark the notification as Read because of an error.","We couldn't mark the notification as Read because of an error."
1313
"Please select messages.","Please select messages."
@@ -20,10 +20,10 @@ Notifications,Notifications
2020
"6 Hours","6 Hours"
2121
"12 Hours","12 Hours"
2222
"24 Hours","24 Hours"
23-
critical,critical
24-
major,major
25-
minor,minor
26-
notice,notice
23+
"critical","critical"
24+
"major","major"
25+
"minor","minor"
26+
"notice","notice"
2727
"Wrong message type","Wrong message type"
2828
"Wrong notification ID specified.","Wrong notification ID specified."
2929
"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>.","{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>."
@@ -33,7 +33,7 @@ notice,notice
3333
"Synchronization of media storages has been completed.","Synchronization of media storages has been completed."
3434
"Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider.","Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider."
3535
"Close popup","Close popup"
36-
Close,Close
36+
"Close","Close"
3737
"System Messages:","System Messages:"
3838
"Critical System Messages","Critical System Messages"
3939
"Major System Messages","Major System Messages"
@@ -45,7 +45,7 @@ Close,Close
4545
"Use HTTPS to Get Feed","Use HTTPS to Get Feed"
4646
"Update Frequency","Update Frequency"
4747
"Last Update","Last Update"
48-
Severity,Severity
48+
"Severity","Severity"
4949
"Date Added","Date Added"
50-
Message,Message
51-
Actions,Actions
50+
"Message","Message"
51+
"Actions","Actions"

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Minute,Minute
250250
"JavaScript may be disabled in your browser.","JavaScript may be disabled in your browser."
251251
"To use this website you must first enable JavaScript in your browser.","To use this website you must first enable JavaScript in your browser."
252252
"This is only a demo store. You can browse and place orders, but nothing will be processed.","This is only a demo store. You can browse and place orders, but nothing will be processed."
253-
"Report a Bug","Report a Bug"
253+
"Report an Issue","Report an Issue"
254254
"Store View:","Store View:"
255255
"Stores Configuration","Stores Configuration"
256256
"Please confirm scope switching. All data that hasn\'t been saved will be lost.","Please confirm scope switching. All data that hasn\'t been saved will be lost."

app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
?>
1010
<?php if ($block->getBugreportUrl()): ?>
11-
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report a Bug') ?></a>
11+
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report an Issue') ?></a>
1212
<?php endif; ?>
Loading

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
public function apply(\Magento\Framework\App\RequestInterface $request)
5454
{
5555
$attributeValue = $request->getParam($this->_requestVar);
56-
if (empty($attributeValue)) {
56+
if (empty($attributeValue) && !is_numeric($attributeValue)) {
5757
return $this;
5858
}
5959
$attribute = $this->getAttributeModel();
@@ -84,9 +84,10 @@ protected function _getItemsData()
8484
->getProductCollection();
8585
$optionsFacetedData = $productCollection->getFacetedData($attribute->getAttributeCode());
8686

87-
if (count($optionsFacetedData) === 0
88-
&& $this->getAttributeIsFilterable($attribute) !== static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
89-
) {
87+
$isAttributeFilterable =
88+
$this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS;
89+
90+
if (count($optionsFacetedData) === 0 && !$isAttributeFilterable) {
9091
return $this->itemDataBuilder->build();
9192
}
9293

@@ -95,28 +96,64 @@ protected function _getItemsData()
9596
$options = $attribute->getFrontend()
9697
->getSelectOptions();
9798
foreach ($options as $option) {
98-
if (empty($option['value'])) {
99-
continue;
100-
}
99+
$this->buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize);
100+
}
101101

102-
$value = $option['value'];
102+
return $this->itemDataBuilder->build();
103+
}
103104

104-
$count = isset($optionsFacetedData[$value]['count'])
105-
? (int)$optionsFacetedData[$value]['count']
106-
: 0;
107-
// Check filter type
108-
if ($this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
109-
&& (!$this->isOptionReducesResults($count, $productSize) || $count === 0)
110-
) {
111-
continue;
112-
}
113-
$this->itemDataBuilder->addItemData(
114-
$this->tagFilter->filter($option['label']),
115-
$value,
116-
$count
117-
);
105+
/**
106+
* Build option data
107+
*
108+
* @param array $option
109+
* @param boolean $isAttributeFilterable
110+
* @param array $optionsFacetedData
111+
* @param int $productSize
112+
* @return void
113+
*/
114+
private function buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize)
115+
{
116+
$value = $this->getOptionValue($option);
117+
if ($value === false) {
118+
return;
119+
}
120+
$count = $this->getOptionCount($value, $optionsFacetedData);
121+
if ($isAttributeFilterable && (!$this->isOptionReducesResults($count, $productSize) || $count === 0)) {
122+
return;
118123
}
119124

120-
return $this->itemDataBuilder->build();
125+
$this->itemDataBuilder->addItemData(
126+
$this->tagFilter->filter($option['label']),
127+
$value,
128+
$count
129+
);
130+
}
131+
132+
/**
133+
* Retrieve option value if it exists
134+
*
135+
* @param array $option
136+
* @return bool|string
137+
*/
138+
private function getOptionValue($option)
139+
{
140+
if (empty($option['value']) && !is_numeric($option['value'])) {
141+
return false;
142+
}
143+
return $option['value'];
144+
}
145+
146+
/**
147+
* Retrieve count of the options
148+
*
149+
* @param int|string $value
150+
* @param array $optionsFacetedData
151+
* @return int
152+
*/
153+
private function getOptionCount($value, $optionsFacetedData)
154+
{
155+
return isset($optionsFacetedData[$value]['count'])
156+
? (int)$optionsFacetedData[$value]['count']
157+
: 0;
121158
}
122159
}

0 commit comments

Comments
 (0)