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

[4.2]Apply php cs fixer #5471

Merged
merged 2 commits into from
Jul 22, 2022
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ node_modules
###< symfony/phpunit-bridge ###

###> friendsofphp/php-cs-fixer ###
.php_cs
.php_cs.cache
/.php-cs-fixer.cache
/.php-cs-fixer.*.php
###< friendsofphp/php-cs-fixer ###
9 changes: 7 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

if (php_sapi_name() !== 'cli') {
throw new \LogicException();
}

$header = <<<EOL
This file is part of EC-CUBE

Expand All @@ -24,14 +28,15 @@
'header_comment' => ['header' => $header],
];

$finder = PhpCsFixer\Finder::create()
$finder = \PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->in(__DIR__.'/app')
->in(__DIR__.'/codeception')
->name('*.php')
;
return PhpCsFixer\Config::create()
$config = new \PhpCsFixer\Config();
return $config
->setRules($rules)
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rm -rf $WORKSPACE/.editorconfig
rm -rf $WORKSPACE/.gitignore
rm -rf $WORKSPACE/.buildpath
rm -rf $WORKSPACE/.gitmodules
rm -rf $WORKSPACE/.php_cs.dist
rm -rf $WORKSPACE/.php-cs-fixler.*
rm -rf $WORKSPACE/phpunit.xml.dist
rm -rf $WORKSPACE/phpstan.neon.dist
rm -rf $WORKSPACE/app.json
Expand Down
8 changes: 4 additions & 4 deletions src/Eccube/Common/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ class Constant
/**
* EC-CUBE VERSION.
*/
const VERSION = '4.2.0-beta';
public const VERSION = '4.2.0-beta';

/**
* Enable value.
*/
const ENABLED = 1;
public const ENABLED = 1;

/**
* Disable value.
*/
const DISABLED = 0;
public const DISABLED = 0;

/**
* Csrf Token Name.
*/
const TOKEN_NAME = '_token';
public const TOKEN_NAME = '_token';
}
5 changes: 2 additions & 3 deletions src/Eccube/Controller/Admin/Content/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Validator\Constraints as Assert;

class FileController extends AbstractController
{
const SJIS = 'sjis-win';
const UTF = 'UTF-8';
public const SJIS = 'sjis-win';
public const UTF = 'UTF-8';
private $errors = [];
private $encode = '';

Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Controller/Admin/Content/LayoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

class LayoutController extends AbstractController
{
const DUMMY_BLOCK_ID = 9999999999;
public const DUMMY_BLOCK_ID = 9999999999;

/**
* @var BlockRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function disableMaintenance(Request $request, $mode, SystemService $syste
} else {
$maintenanceMode = [
'auto_maintenance' => SystemService::AUTO_MAINTENANCE,
'auto_maintenance_update' => SystemService::AUTO_MAINTENANCE_UPDATE
'auto_maintenance_update' => SystemService::AUTO_MAINTENANCE_UPDATE,
];
$systemService->disableMaintenance($maintenanceMode[$mode]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function export(Request $request)
$ExportCsvRow->pushData();
}

//$row[] = number_format(memory_get_usage(true));
// $row[] = number_format(memory_get_usage(true));
// 出力.
$csvService->fputcsv($ExportCsvRow->getRow());
});
Expand Down
2 changes: 0 additions & 2 deletions src/Eccube/Controller/Admin/Order/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
use Eccube\Service\MailService;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment;

Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Controller/Admin/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ protected function exportCsv(Request $request, $csvTypeId, $fileName)
$ExportCsvRow->pushData();
}

//$row[] = number_format(memory_get_usage(true));
// $row[] = number_format(memory_get_usage(true));
// 出力.
$csvService->fputcsv($ExportCsvRow->getRow());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Controller/Admin/Product/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public function export(Request $request)
$ExportCsvRow->pushData();
}

//$row[] = number_format(memory_get_usage(true));
// $row[] = number_format(memory_get_usage(true));
// 出力.
$csvService->fputcsv($ExportCsvRow->getRow());
});
Expand Down
6 changes: 3 additions & 3 deletions src/Eccube/Controller/Admin/Product/CsvImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public function csvProduct(Request $request, CacheUtil $cacheUtil)
// 商品カテゴリ登録
$this->createProductCategory($row, $Product, $data, $headerByKey);

//タグ登録
// タグ登録
$this->createProductTag($row, $Product, $data, $headerByKey);

// 商品規格が存在しなければ新規登録
Expand Down Expand Up @@ -1359,7 +1359,7 @@ protected function updateProductClass($row, Product $Product, ProductClass $Prod
if (isset($row[$headerByKey['price01']])) {
if ($row[$headerByKey['price01']] != '') {
$price01 = str_replace(',', '', $row[$headerByKey['price01']]);
$errors = $this->validator->validate($price01, new GreaterThanOrEqual(['value' => 0]));
$errors = $this->validator->validate($price01, new GreaterThanOrEqual(['value' => 0]));
if ($errors->count() === 0) {
$ProductClass->setPrice01($price01);
} else {
Expand Down Expand Up @@ -1639,7 +1639,7 @@ public function splitCsv(Request $request)
// stream filter を適用して文字エンコーディングと改行コードの変換を行う
// see https://github.com/EC-CUBE/ec-cube/issues/5252
$filters = [
ConvertLineFeedFilter::class
ConvertLineFeedFilter::class,
];

if (!\mb_check_encoding($file->current(), 'UTF-8')) {
Expand Down
5 changes: 2 additions & 3 deletions src/Eccube/Controller/Admin/Product/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -332,7 +331,7 @@ public function imageProcess(Request $request)
if (count($images) > 0) {
foreach ($images as $img) {
foreach ($img as $image) {
//ファイルフォーマット検証
// ファイルフォーマット検証
$mimeType = $image->getMimeType();
if (0 !== strpos($mimeType, 'image')) {
throw new UnsupportedMediaTypeHttpException();
Expand Down Expand Up @@ -378,7 +377,7 @@ public function imageLoad(Request $request)

$dirs = [
$this->eccubeConfig['eccube_save_image_dir'],
$this->eccubeConfig['eccube_temp_image_dir']
$this->eccubeConfig['eccube_temp_image_dir'],
];

foreach ($dirs as $dir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function imageProcess(Request $request)
if (isset($images['payment_image_file'])) {
$image = $images['payment_image_file'];

//ファイルフォーマット検証
// ファイルフォーマット検証
$mimeType = $image->getMimeType();
if (0 !== strpos($mimeType, 'image')) {
throw new UnsupportedMediaTypeHttpException();
Expand Down Expand Up @@ -221,7 +221,7 @@ public function imageLoad(Request $request)

$dirs = [
$this->eccubeConfig['eccube_save_image_dir'],
$this->eccubeConfig['eccube_temp_image_dir']
$this->eccubeConfig['eccube_temp_image_dir'],
];

foreach ($dirs as $dir) {
Expand Down
20 changes: 14 additions & 6 deletions src/Eccube/Controller/Admin/Setting/Shop/TradeLawController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Eccube\Controller\Admin\Setting\Shop;

use Eccube\Controller\AbstractController;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Form\Type\Admin\OrderStatusSettingType;
use Eccube\Form\Type\Admin\TradeLawType;
use Eccube\Form\Type\Front\ForgotType;
use Eccube\Repository\TradeLawRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class TradeLawController extends AbstractController
{
Expand All @@ -32,6 +41,7 @@ public function __construct(
*
* @Route("/%eccube_admin_route%/setting/shop/tradelaw", name="admin_setting_shop_tradelaw", methods={"GET", "POST"})
* @Template("@admin/Setting/Shop/tradelaw.twig")
*
* @param Request $request
*/
public function index(Request $request)
Expand All @@ -57,8 +67,6 @@ public function index(Request $request)
$request
);



$form = $builder->getForm();
$form->handleRequest($request);

Expand All @@ -80,7 +88,7 @@ public function index(Request $request)

return [
'form' => $form->createView(),
'tradeLawDetails' => $tradeLawDetails
'tradeLawDetails' => $tradeLawDetails,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public function __construct(
EncoderFactoryInterface $encoderFactory,
MemberRepository $memberRepository,
TokenStorageInterface $tokenStorage
)
{
) {
$this->encoderFactory = $encoderFactory;
$this->memberRepository = $memberRepository;
$this->tokenStorage = $tokenStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function index(Request $request, CacheUtil $cacheUtil)
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
//.envファイルが存在しないときに設定は失敗する
// .envファイルが存在しないときに設定は失敗する
if (file_exists($this->getParameter('kernel.project_dir').'/.env') === false) {
$this->addError('admin.common.save_error', 'admin');

Expand All @@ -75,7 +75,7 @@ public function index(Request $request, CacheUtil $cacheUtil)
$env = StringUtil::replaceOrAddEnv($env, [
'ECCUBE_ADMIN_ALLOW_HOSTS' => "'{$adminAllowHosts}'",
'ECCUBE_ADMIN_DENY_HOSTS' => "'{$adminDenyHosts}'",
'ECCUBE_FORCE_SSL' => $data['force_ssl'] ? '1' : '0',
'ECCUBE_FORCE_SSL' => $data['force_ssl'] ? '1' : '0',
'TRUSTED_HOSTS' => $data['trusted_hosts'],
]);

Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Controller/Admin/Store/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ protected function getUnregisteredPlugins(array $plugins)
try {
$this->pluginService->checkPluginArchiveContent($dir->getRealPath());
} catch (PluginException $e) {
//config.yamlに不備があった際は全てスキップ
// config.yamlに不備があった際は全てスキップ
log_warning($e->getMessage());
continue;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Eccube/Controller/EntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function index(Request $request)
'Status' => [
CustomerStatus::PROVISIONAL,
CustomerStatus::REGULAR,
]
],
]);

if ($existCustomer) {
Expand Down Expand Up @@ -350,6 +350,7 @@ private function getQuantityInCart(): int
*
* @param Customer $Customer
* @param Request $request
*
* @return void
*/
private function doLogin(Customer $Customer, Request $request): void
Expand All @@ -363,6 +364,7 @@ private function doLogin(Customer $Customer, Request $request): void
* 本会員へ更新する.
*
* @param Customer $Customer
*
* @return void
*/
private function updateRegularCustomer(Customer $Customer): void
Expand Down
6 changes: 2 additions & 4 deletions src/Eccube/Controller/Install/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
namespace Eccube\Controller\Install;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Types\Type;
Expand Down Expand Up @@ -48,10 +46,10 @@ class InstallController extends AbstractController
/**
* default value of auth magic
*/
const DEFAULT_AUTH_MAGIC = '<change.me>';
public const DEFAULT_AUTH_MAGIC = '<change.me>';

/** @var string */
const TRANSACTION_CHECK_FILE = '/var/.httransaction';
public const TRANSACTION_CHECK_FILE = '/var/.httransaction';

protected $requiredModules = [
'pdo',
Expand Down
2 changes: 0 additions & 2 deletions src/Eccube/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Form\Type\AddCartType;
use Eccube\Form\Type\Master\ProductListMaxType;
use Eccube\Form\Type\Master\ProductListOrderByType;
use Eccube\Form\Type\SearchProductType;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\CustomerFavoriteProductRepository;
Expand Down
Loading