Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge 3.x into master
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Feb 13, 2020
2 parents 3306f9a + 4b6bd48 commit 5b01906
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 51 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on: [push, pull_request]

name: Lint

jobs:
php-cs-fixer:
name: PHP-CS-Fixer

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Run PHP-CS-Fixer"
uses: docker://oskarstark/php-cs-fixer-ga:2.16.1
with:
args: --ansi --verbose --diff --dry-run

composer-normalize:
name: composer-normalize

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Run composer-normalize"
uses: docker://localheinz/composer-normalize-action:0.5.2
with:
args: --dry-run

yaml-files:
name: YAML files

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Install Ruby 2.6"
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- run: gem install yaml-lint
- name: "Linting..."
run: make lint-yaml

xml-files:
name: XML files

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- run: sudo apt-get install libxml2-utils

- name: "Linting..."
run: make lint-xml
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $rules = [
'header_comment' => [
'header' => $header,
],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_extra_blank_lines' => true,
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
Expand Down
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ php:

dist: xenial

addons:
apt:
packages:
- libxml2-utils

cache:
pip: true
directories:
Expand All @@ -38,8 +33,6 @@ env:
matrix:
fast_finish: true
include:
- php: '7.3'
env: TARGET=lint
- php: '7.2'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.3'
Expand Down
6 changes: 0 additions & 6 deletions .travis/check_relevant_lint.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/install_lint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ all:
@echo "Please choose a task."
.PHONY: all

lint: lint-composer lint-yaml lint-composer lint-xml lint-php
lint: lint-composer lint-yaml lint-xml lint-php
.PHONY: lint

lint-composer:
Expand Down
15 changes: 10 additions & 5 deletions src/Component/Generator/PostgresReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ public function invoice(InvoiceInterface $invoice): void
throw new \RuntimeException('The invoice is not persisted into the database');
}

$this->generateReference($invoice,
$this->registry->getManager()->getClassMetadata(\get_class($invoice))->table['name']);
$this->generateReference(
$invoice,
$this->registry->getManager()->getClassMetadata(\get_class($invoice))->table['name']
);
}

public function order(OrderInterface $order): void
Expand All @@ -45,8 +47,10 @@ public function order(OrderInterface $order): void
throw new \RuntimeException('The order is not persisted into the database');
}

$this->generateReference($order,
$this->registry->getManager()->getClassMetadata(\get_class($order))->table['name']);
$this->generateReference(
$order,
$this->registry->getManager()->getClassMetadata(\get_class($order))->table['name']
);
}

/**
Expand Down Expand Up @@ -75,7 +79,8 @@ private function generateReference($object, $tableName)
$statement = $this->registry->getConnection()->query($sql);
$row = $statement->fetch();

$reference = sprintf('%02d%02d%02d%06d',
$reference = sprintf(
'%02d%02d%02d%06d',
$date->format('y'),
$date->format('n'),
$date->format('j'),
Expand Down
3 changes: 2 additions & 1 deletion src/Component/Payment/Scellius/ScelliusPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ public function applyTransactionId(TransactionInterface $transaction): void
*/
private function getResponseData(TransactionInterface $transaction)
{
$cmd = sprintf('cd %s && %s pathfile=%s message=%s ',
$cmd = sprintf(
'cd %s && %s pathfile=%s message=%s ',
$this->getOption('base_folder'),
$this->getOption('response_command'),
$this->getOption('pathfile'),
Expand Down
4 changes: 3 additions & 1 deletion src/CustomerBundle/Twig/Extension/AddressExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public function renderAddress(\Twig_Environment $environment, $address, $showNam
];
}

return $environment->render('@SonataCustomer/Addresses/_address.html.twig', [
return $environment->render(
'@SonataCustomer/Addresses/_address.html.twig',
[
'address' => $addressArray,
'showName' => $showName,
'showEdit' => $showEdit,
Expand Down
6 changes: 4 additions & 2 deletions src/ProductBundle/Admin/ProductVariationAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function getBaseRoutePattern()
if ('sonata.product.admin.product.variation' === $this->getCode() && !$this->isChild()) { // variation
$this->baseRoutePattern = '/sonata/product/variation';
} elseif ('sonata.product.admin.product.variation' === $this->getCode() && $this->isChild()) { // variation
$this->baseRoutePattern = sprintf('%s/{id}/%s',
$this->baseRoutePattern = sprintf(
'%s/{id}/%s',
$this->getParent()->getBaseRoutePattern(),
$this->urlize('variation', '-')
);
Expand All @@ -56,7 +57,8 @@ public function getBaseRouteName()
if ('sonata.product.admin.product.variation' === $this->getCode() && !$this->isChild()) { // variation
$this->baseRouteName = 'admin_sonata_product_variation';
} elseif ('sonata.product.admin.product.variation' === $this->getCode() && $this->isChild()) { // variation
$this->baseRouteName = sprintf('%s_%s',
$this->baseRouteName = sprintf(
'%s_%s',
$this->getParent()->getBaseRouteName(),
$this->urlize('variation')
);
Expand Down
11 changes: 7 additions & 4 deletions src/ProductBundle/Command/GenerateProductCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): void
{
// find a better way to detect the Application folder
$bundle_dir = sprintf('%s/src/Sonata/ProductBundle',
$this->kernel->getProjectDir()
$bundle_dir = sprintf(
'%s/src/Sonata/ProductBundle',
$this->kernel->getProjectDir()
);

if (!is_dir($bundle_dir)) {
Expand Down Expand Up @@ -137,7 +138,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void

$service = $input->getArgument('service_id');

$output->write(Mustache::renderString(<<<CONFIG
$output->write(Mustache::renderString(
<<<CONFIG
<info>1. Add this service definition</info>
Expand Down Expand Up @@ -176,7 +178,8 @@ class: App\Sonata\ProductBundle\Provider\{{ product }}ProductProvider
CONFIG
, ['service' => $service, 'product' => $product]
,
['service' => $service, 'product' => $product]
));
}
}
10 changes: 5 additions & 5 deletions src/ProductBundle/Controller/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class CollectionController extends Controller
private $productSetManager;

public function __construct(
SeoPage $sonataSeoPage = null,
CurrencyDetectorInterface $currencyDetector = null,
CollectionManagerInterface $collectionManagerInterface = null,
ProductSetManager $productSetManager = null
) {
SeoPage $sonataSeoPage = null,
CurrencyDetectorInterface $currencyDetector = null,
CollectionManagerInterface $collectionManagerInterface = null,
ProductSetManager $productSetManager = null
) {
$this->sonataSeoPage = $sonataSeoPage;
$this->currencyDetector = $currencyDetector;
$this->collectionManagerInterface = $collectionManagerInterface;
Expand Down
15 changes: 10 additions & 5 deletions src/ProductBundle/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function viewAction($productId, $slug)
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand All @@ -87,7 +88,8 @@ public function renderFormBasketElementAction(FormView $formView, BasketElementI
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$basketElement->getProductCode(),
$basketElement->getProductId(),
$action,
Expand Down Expand Up @@ -159,7 +161,8 @@ public function renderFinalReviewBasketElementAction(BasketElementInterface $bas
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$basketElement->getProductCode(),
$basketElement->getProductId(),
$action,
Expand Down Expand Up @@ -194,7 +197,8 @@ public function viewVariationsAction($productId, $slug)
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand Down Expand Up @@ -262,7 +266,8 @@ public function variationToProductAction(Request $request, $productId, $slug)
]);

if ($this->get('kernel')->isDebug() && !($response instanceof JsonResponse)) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand Down
3 changes: 2 additions & 1 deletion src/ProductBundle/Entity/BaseDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ abstract class BaseDelivery implements DeliveryInterface
*/
public function __toString()
{
return sprintf('%s-%s%s',
return sprintf(
'%s-%s%s',
$this->getCode(),
$this->getCountryCode(),
$this->getZone() ? sprintf('%s', $this->getZone()) : ''
Expand Down
2 changes: 1 addition & 1 deletion src/ProductBundle/Model/BaseProductProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ public function defineAddBasketForm(ProductInterface $product, FormBuilder $form
} else {
$transformer = new QuantityTransformer();
$formBuilder->add(
$formBuilder->create('quantity', HiddenType::class, ['data' => 1])
$formBuilder->create('quantity', HiddenType::class, ['data' => 1])
->addModelTransformer($transformer)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function createCollectionController(
?CurrencyDetectorInterface $currencyDetector = null,
?CollectionManagerInterface $collectionManagerInterface = null,
?ProductSetManager $productSetManager = null
): CollectionController {
): CollectionController {
if (!$sonataSeoPage) {
$sonataSeoPage = new SeoPage('Collection page');
}
Expand Down

0 comments on commit 5b01906

Please sign in to comment.