Skip to content

Commit

Permalink
Merge branch '1.1' into 1.2
Browse files Browse the repository at this point in the history
* 1.1:
  Php Inspections (EA Ultimate): minor code tweaks
  Add label for issues/pr's that should not be staled
  • Loading branch information
pamil committed Jul 2, 2018
2 parents 11a8010 + 790194a commit cceb49e
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/stale.yml
Expand Up @@ -3,6 +3,7 @@ daysUntilClose: 7
exemptLabels:
- Bug
- Critical
- Do not stale
staleLabel: Stale
markComment: >
This issue has been automatically marked as stale because it has not had any
Expand Down
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
4 changes: 1 addition & 3 deletions src/Sylius/Behat/Context/Api/Admin/ManagingTaxonsContext.php
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
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
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));
}
}
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
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
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
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
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);
}
}
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
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
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

0 comments on commit cceb49e

Please sign in to comment.