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

[minor] SCA #9539

Merged
merged 1 commit into from
Jul 2, 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
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ public function iShouldSeeTheProductVariantNamedAnd(...$names)
*/
public function iShouldSeeTheProductVariantLabeledAs($label)
{
$itemsLabels = array_map(function ($item) {
return $item['descriptor'];
}, $this->getJSONResponse());
$itemsLabels = array_column($this->getJSONResponse(), 'descriptor');

Assert::oneOf($label, $itemsLabels, 'Expected "%s" to be on the list, found: %s.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ public function iShouldSeeTaxonsInTheList($number)
public function iShouldSeeTheTaxonNamedAnd(...$expectedTaxonNames)
{
$response = json_decode($this->client->getResponse()->getContent(), true);
$taxonNames = array_map(function ($item) {
return $item['name'];
}, $response);
$taxonNames = array_column($response, 'name');

Assert::allOneOf($taxonNames, $expectedTaxonNames);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Context/Setup/ProductContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function theProductHasVariantPricedAt(
$productVariantName,
$price,
StringInflector::nameToUppercaseCode($productVariantName),
(null !== $channel) ? $channel : $this->sharedStorage->get('channel')
$channel ?? $this->sharedStorage->get('channel')
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ public function iShouldNotSeeInformationAboutShipments()
*/
private function assertElementValidationMessage($type, $element, $expectedMessage)
{
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
Assert::true($this->updatePage->checkValidationMessageFor($element, $expectedMessage));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private function createDefaultAddress()
*/
private function assertElementValidationMessage($type, $element, $expectedMessage)
{
$element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
$element = sprintf('%s_%s', $type, str_replace(' ', '_', $element));
Assert::true($this->addressPage->checkValidationMessageFor($element, $expectedMessage));
}
}
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/Admin/Channel/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function isCurrencyChosen($currencyCode)
*/
public function chooseDefaultTaxZone($taxZone)
{
$this->getDocument()->selectFieldOption('Default tax zone', (null === $taxZone) ? '' : $taxZone);
$this->getDocument()->selectFieldOption('Default tax zone', $taxZone ?? '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/Admin/Order/UpdatePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function specifyElementValue($elementName, $value)
*/
private function chooseCountry($country, $addressType)
{
$this->getElement($addressType . '_country')->selectOption((null !== $country) ? $country : 'Select');
$this->getElement($addressType . '_country')->selectOption($country ?? 'Select');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Page/SymfonyPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function getUrl(array $urlParameters = [])
$replace[sprintf('?%s=%s', $key, $value)] = '';
}

$path = str_replace(array_keys($replace), array_values($replace), $path);
$path = str_replace(array_keys($replace), $replace, $path);

return $this->makePathAbsolute($path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ private function removeUnusedQueryArgument(string $url, string $key, string $val
sprintf('?%s=%s', $key, $value) => '',
];

return str_replace(array_keys($replace), array_values($replace), $url);
return str_replace(array_keys($replace), $replace, $url);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function check(ThemeInterface $theme, array $previousThemes = []): void
return;
}

$previousThemes = array_merge($previousThemes, [$theme]);
$previousThemes[] = $theme;
foreach ($theme->getParents() as $parent) {
if (in_array($parent, $previousThemes, true)) {
throw new CircularDependencyFoundException(array_merge($previousThemes, [$parent]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function create(?string $code = null, ?string $name = null, ?string $curr
*/
private function provideCurrency(?string $currencyCode): CurrencyInterface
{
$currencyCode = (null !== $currencyCode) ? $currencyCode : self::DEFAULT_CHANNEL_CURRENCY;
$currencyCode = $currencyCode ?? self::DEFAULT_CHANNEL_CURRENCY;

/** @var CurrencyInterface $currency */
$currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Component/Promotion/Model/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function getPriority(): int
*/
public function setPriority(?int $priority): void
{
$this->priority = null === $priority ? -1 : $priority;
$this->priority = $priority ?? -1;
}

/**
Expand Down