diff --git a/src/Eccube/Entity/OrderItem.php b/src/Eccube/Entity/OrderItem.php index 2665c85a820..99b22d9224d 100644 --- a/src/Eccube/Entity/OrderItem.php +++ b/src/Eccube/Entity/OrderItem.php @@ -509,7 +509,7 @@ public function setQuantity($quantity) /** * Get quantity. * - * @return string + * @return string|float|int */ public function getQuantity() { diff --git a/src/Eccube/Service/MailService.php b/src/Eccube/Service/MailService.php index 0e34e76d04e..35691fc9b32 100644 --- a/src/Eccube/Service/MailService.php +++ b/src/Eccube/Service/MailService.php @@ -28,7 +28,6 @@ use Eccube\Repository\MailHistoryRepository; use Eccube\Repository\MailTemplateRepository; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\MailerInterface; @@ -56,7 +55,7 @@ class MailService protected $mailHistoryRepository; /** - * @var EventDispatcher + * @var EventDispatcherInterface */ protected $eventDispatcher; @@ -113,8 +112,14 @@ public function __construct( /** * Send customer confirm mail. * - * @param $Customer 会員情報 + * @param Customer $Customer 会員情報 * @param string $activateUrl アクティベート用url + * + * @return void + * + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendCustomerConfirmMail(Customer $Customer, $activateUrl) { @@ -174,7 +179,11 @@ public function sendCustomerConfirmMail(Customer $Customer, $activateUrl) /** * Send customer complete mail. * - * @param $Customer 会員情報 + * @param Customer $Customer 会員情報 + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendCustomerCompleteMail(Customer $Customer) { @@ -233,6 +242,10 @@ public function sendCustomerCompleteMail(Customer $Customer) * * @param $Customer Customer * @param $email string + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendCustomerWithdrawMail(Customer $Customer, string $email) { @@ -290,7 +303,11 @@ public function sendCustomerWithdrawMail(Customer $Customer, string $email) /** * Send contact mail. * - * @param $formData お問い合わせ内容 + * @param array $formData お問い合わせ内容 + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendContactMail($formData) { @@ -423,8 +440,12 @@ public function sendOrderMail(Order $Order) /** * Send admin customer confirm mail. * - * @param $Customer 会員情報 + * @param Customer $Customer 会員情報 * @param string $activateUrl アクティベート用url + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendAdminCustomerConfirmMail(Customer $Customer, $activateUrl) { @@ -487,13 +508,10 @@ public function sendAdminCustomerConfirmMail(Customer $Customer, $activateUrl) * Send admin order mail. * * @param Order $Order 受注情報 - * @param $formData 入力内容 + * @param array $formData 入力内容 * * @return Email * - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Runtime - * @throws \Twig_Error_Syntax */ public function sendAdminOrderMail(Order $Order, $formData) { @@ -532,8 +550,12 @@ public function sendAdminOrderMail(Order $Order, $formData) /** * Send password reset notification mail. * - * @param $Customer 会員情報 + * @param Customer $Customer 会員情報 * @param string $reset_url + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendPasswordResetNotificationMail(Customer $Customer, $reset_url) { @@ -594,8 +616,12 @@ public function sendPasswordResetNotificationMail(Customer $Customer, $reset_url /** * Send password reset notification mail. * - * @param $Customer 会員情報 + * @param Customer $Customer 会員情報 * @param string $password + * @return void + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function sendPasswordResetCompleteMail(Customer $Customer, $password) { @@ -657,6 +683,7 @@ public function sendPasswordResetCompleteMail(Customer $Customer, $password) * 発送通知メールは受注ごとに送られる * * @param Shipping $Shipping + * @return void * * @throws \Twig_Error */ @@ -753,10 +780,7 @@ public function getShippingNotifyMailBody(Shipping $Shipping, Order $Order, $tem * 会員情報変更時にメール通知 * * @param Customer $Customer - * @param array $userData - * - userAgent - * - ipAddress - * - preEmail + * @param array{userAgent: string, ipAddress: string, preEmail: string|null} $userData * @param string $eventName * * @return void diff --git a/src/Eccube/Service/OrderHelper.php b/src/Eccube/Service/OrderHelper.php index 8c6b6675612..6472964f9ab 100644 --- a/src/Eccube/Service/OrderHelper.php +++ b/src/Eccube/Service/OrderHelper.php @@ -23,10 +23,10 @@ use Eccube\Entity\Master\DeviceType; use Eccube\Entity\Master\OrderItemType; use Eccube\Entity\Master\OrderStatus; +use Eccube\Entity\Master\TaxDisplayType; use Eccube\Entity\Order; use Eccube\Entity\OrderItem; use Eccube\Entity\Shipping; -use Eccube\Entity\Master\TaxDisplayType; use Eccube\EventListener\SecurityListener; use Eccube\Repository\DeliveryRepository; use Eccube\Repository\Master\DeviceTypeRepository; @@ -110,7 +110,7 @@ class OrderHelper protected $deviceTypeRepository; /** - * @var MobileDetector + * @var MobileDetect */ protected $mobileDetector; @@ -315,6 +315,9 @@ public function initializeOrder(Cart $Cart, Customer $Customer) return $Order; } + /** + * @return void + */ public function removeSession() { $this->session->remove(self::SESSION_ORDER_ID); @@ -327,6 +330,7 @@ public function removeSession() * * @param Order $Order * @param Customer $Customer + * @return void */ public function updateCustomerInfo(Order $Order, Customer $Customer) { @@ -335,6 +339,9 @@ public function updateCustomerInfo(Order $Order, Customer $Customer) } } + /** + * @return string + */ public function createPreOrderId() { // ランダムなpre_order_idを作成 @@ -351,6 +358,12 @@ public function createPreOrderId() return $preOrderId; } + /** + * @param Order $Order + * @param Customer $Customer + * + * @return void + */ protected function setCustomer(Order $Order, Customer $Customer) { if ($Customer->getId()) { @@ -369,7 +382,7 @@ protected function setCustomer(Order $Order, Customer $Customer) } /** - * @param Collection|ArrayCollection|CartItem[] $CartItems + * @param Collection|ArrayCollection|CartItem[]|array $CartItems * * @return OrderItem[] */ @@ -434,6 +447,8 @@ protected function createShippingFromCustomer(Customer $Customer) /** * @param Shipping $Shipping + * + * @return void */ protected function setDefaultDelivery(Shipping $Shipping) { @@ -458,6 +473,8 @@ protected function setDefaultDelivery(Shipping $Shipping) /** * @param Order $Order + * + * @return void */ protected function setDefaultPayment(Order $Order) { @@ -494,7 +511,8 @@ protected function setDefaultPayment(Order $Order) /** * @param Order $Order * @param Shipping $Shipping - * @param array $OrderItems + * @param array $OrderItems + * @return void */ protected function addOrderItems(Order $Order, Shipping $Shipping, array $OrderItems) { @@ -507,6 +525,9 @@ protected function addOrderItems(Order $Order, Shipping $Shipping, array $OrderI } /** + * @param mixed $attribute + * @param null $subject + * @return bool * @see Symfony\Bundle\FrameworkBundle\Controller\AbstractController */ private function isGranted($attribute, $subject = null): bool @@ -516,6 +537,7 @@ private function isGranted($attribute, $subject = null): bool /** * @see Symfony\Bundle\FrameworkBundle\Controller\AbstractController + * @return UserInterface|null */ private function getUser(): ?UserInterface { @@ -539,7 +561,7 @@ private function getUser(): ?UserInterface * - 手数料: 税込 * - ポイント値引き: 税込 * - * @param $OrderItemType + * @param OrderItemType $OrderItemType * * @return TaxDisplayType */ diff --git a/src/Eccube/Service/OrderPdfService.php b/src/Eccube/Service/OrderPdfService.php index 0d918e02376..2ac39f02219 100644 --- a/src/Eccube/Service/OrderPdfService.php +++ b/src/Eccube/Service/OrderPdfService.php @@ -23,6 +23,11 @@ use Eccube\Repository\ShippingRepository; use Eccube\Twig\Extension\EccubeExtension; use Eccube\Twig\Extension\TaxExtension; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; +use setasign\Fpdi\PdfParser\Filter\FilterException; +use setasign\Fpdi\PdfParser\PdfParserException; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; +use setasign\Fpdi\PdfReader\PdfReaderException; use setasign\Fpdi\Tcpdf\Fpdi; /** @@ -78,16 +83,16 @@ class OrderPdfService extends Fpdi public $baseInfoRepository; /** 購入詳細情報 ラベル配列 - * @var array + * @var array */ protected $labelCell = []; - /*** 購入詳細情報 幅サイズ配列 - * @var array + /** 購入詳細情報 幅サイズ配列 + * @var array */ protected $widthCell = []; - /** 最後に処理した注文番号 @var string */ + /** @var string|null 最後に処理した注文番号 */ protected $lastOrderId = null; // -------------------------------------- @@ -96,18 +101,24 @@ class OrderPdfService extends Fpdi protected $bakFontFamily; /** @var string フォントスタイル */ protected $bakFontStyle; - /** @var string フォントサイズ */ + /** @var string|float|null フォントサイズ */ protected $bakFontSize; // -------------------------------------- // lfTextのoffset + /** + * @var int + */ protected $baseOffsetX = 0; + /** + * @var int + */ protected $baseOffsetY = -4; - /** ダウンロードファイル名 @var string */ + /** @var string|null ダウンロードファイル名 */ protected $downloadFileName = null; - /** 発行日 @var string */ + /** @var string 発行日 */ protected $issueDate = ''; /** @@ -161,19 +172,35 @@ public function __construct(EccubeConfig $eccubeConfig, OrderRepository $orderRe /** * 注文情報からPDFファイルを作成する. * - * @param array $formData - * [KEY] - * ids: 注文番号 - * issue_date: 発行日 - * title: タイトル - * message1: メッセージ1行目 - * message2: メッセージ2行目 - * message3: メッセージ3行目 - * note1: 備考1行目 - * note2: 備考2行目 - * note3: 備考3行目 + * @param array{ + * ids: string, + * issue_date: \DateTime, + * title: string, + * message1: string, + * message2: string, + * message3: string, + * note1: string, + * note2: string, + * note3: string + * } $formData + * [KEY] + * ids: + * issue_date: 発行日 + * title: タイトル + * message1: メッセージ1行目 + * message2: メッセージ2行目 + * message3: メッセージ3行目 + * note1: 備考1行目 + * note2: 備考2行目 + * note3: 備考3行目 * * @return bool + * + * @throws CrossReferenceException + * @throws FilterException + * @throws PdfParserException + * @throws PdfReaderException + * @throws PdfTypeException */ public function makePdf(array $formData) { @@ -194,7 +221,7 @@ public function makePdf(array $formData) $this->lastOrderId = $id; // 出荷番号から出荷情報を取得する - /** @var Shipping $Shipping */ + /** @var Shipping|null $Shipping */ $Shipping = $this->shippingRepository->find($id); if (!$Shipping) { // 出荷情報の取得ができなかった場合 @@ -267,6 +294,8 @@ public function getPdfFileName() /** * フッターに発行日を出力する. + * + * @return void */ public function Footer() { @@ -275,6 +304,14 @@ public function Footer() /** * 作成するPDFのテンプレートファイルを指定する. + * + * @return void + * + * @throws CrossReferenceException + * @throws FilterException + * @throws PdfParserException + * @throws PdfTypeException + * @throws PdfReaderException */ protected function addPdfPage() { @@ -292,6 +329,8 @@ protected function addPdfPage() /** * PDFに店舗情報を設定する * ショップ名、ロゴ画像以外はdtb_helpに登録されたデータを使用する. + * + * @return void */ protected function renderShopData() { @@ -301,9 +340,8 @@ protected function renderShopData() // ショップ名 $this->lfText(125, 58, $this->baseInfoRepository->getShopName(), 8, 'B'); - //郵便番号 - $this->lfText(121, 63, "\u{3012}". ' ' . mb_substr($this->baseInfoRepository->getPostalCode(), 0, 3) . ' - ' . mb_substr($this->baseInfoRepository->getPostalCode(), 3, 4), 8); - + // 郵便番号 + $this->lfText(121, 63, "\u{3012}".' '.mb_substr($this->baseInfoRepository->getPostalCode(), 0, 3).' - '.mb_substr($this->baseInfoRepository->getPostalCode(), 3, 4), 8); // 都道府県+所在地 $text = $this->baseInfoRepository->getPref().$this->baseInfoRepository->getAddr01(); @@ -339,7 +377,9 @@ protected function renderShopData() /** * メッセージを設定する. * - * @param array $formData + * @param array $formData + * + * @return void */ protected function renderMessageData(array $formData) { @@ -351,18 +391,20 @@ protected function renderMessageData(array $formData) /** * PDFに備考を設定数. * - * @param array $formData + * @param array $formData + * + * @return void */ protected function renderEtcData(array $formData) { // フォント情報のバックアップ $this->backupFont(); - $this->Cell(0, 10, '', 0, 1, 'C', 0, ''); + $this->Cell(0, 10, '', 0, 1, 'C', false, ''); // 行頭近くの場合、表示崩れがあるためもう一個字下げする if (270 <= $this->GetY()) { - $this->Cell(0, 10, '', 0, 1, 'C', 0, ''); + $this->Cell(0, 10, '', 0, 1, 'C', false, ''); } $this->SetFont(self::FONT_GOTHIC, 'B', 9); $this->MultiCell(0, 6, '< 備考 >', 'T', 2, 'L', 0, ''); @@ -382,6 +424,8 @@ protected function renderEtcData(array $formData) * タイトルをPDFに描画する. * * @param string $title + * + * @return void */ protected function renderTitle($title) { @@ -405,6 +449,8 @@ protected function renderTitle($title) * 購入者情報を設定する. * * @param Shipping $Shipping + * + * @return void */ protected function renderOrderData(Shipping $Shipping) { @@ -421,7 +467,7 @@ protected function renderOrderData(Shipping $Shipping) $Order = $Shipping->getOrder(); // 購入者郵便番号(3012は郵便マークのUTFコード) - $text = "\u{3012}" . ' ' . mb_substr($Shipping->getPostalCode(), 0, 3) . ' - ' . mb_substr($Shipping->getPostalCode(), 3, 4); + $text = "\u{3012}".' '.mb_substr($Shipping->getPostalCode(), 0, 3).' - '.mb_substr($Shipping->getPostalCode(), 3, 4); $this->lfText(22, 43, $text, 10); // 購入者都道府県+住所1 @@ -477,6 +523,8 @@ protected function renderOrderData(Shipping $Shipping) * 購入商品詳細情報を設定する. * * @param Shipping $Shipping + * + * @return void */ protected function renderOrderDetailData(Shipping $Shipping) { @@ -634,11 +682,13 @@ protected function renderOrderDetailData(Shipping $Shipping) /** * PDFへのテキスト書き込み * - * @param int $x X座標 - * @param int $y Y座標 - * @param string $text テキスト - * @param int $size フォントサイズ + * @param int $x X座標 + * @param int $y Y座標 + * @param string $text テキスト + * @param int $size フォントサイズ * @param string $style フォントスタイル + * + * @return void */ protected function lfText($x, $y, $text, $size = 0, $style = '') { @@ -656,9 +706,11 @@ protected function lfText($x, $y, $text, $size = 0, $style = '') /** * Colored table. * - * @param array $header 出力するラベル名一覧 - * @param array $data 出力するデータ - * @param array $w 出力するセル幅一覧 + * @param array $header 出力するラベル名一覧 + * @param array> $data 出力するデータ + * @param array $w 出力するセル幅一覧 + * + * @return void */ protected function setFancyTable($header, $data, $w) { @@ -690,7 +742,7 @@ protected function setFancyTable($header, $data, $w) $this->SetFont(''); // Data $fill = 0; - $writeRow = function($row, $cellHeight, $fill, $isBorder) use($w) { + $writeRow = function ($row, $cellHeight, $fill, $isBorder) use ($w) { $i = 0; $h = 0; foreach ($row as $col) { @@ -720,6 +772,7 @@ protected function setFancyTable($header, $data, $w) $h = $this->getLastH(); $i++; } + return $cellHeight; }; @@ -753,8 +806,10 @@ protected function setFancyTable($header, $data, $w) /** * 基準座標を設定する. * - * @param int $x - * @param int $y + * @param int|float|null $x + * @param int|float|null $y + * + * @return void */ protected function setBasePosition($x = null, $y = null) { @@ -770,6 +825,8 @@ protected function setBasePosition($x = null, $y = null) /** * Font情報のバックアップ. + * + * @return void */ protected function backupFont() { @@ -781,6 +838,8 @@ protected function backupFont() /** * Font情報の復元. + * + * @return void */ protected function restoreFont() { diff --git a/src/Eccube/Service/OrderStateMachine.php b/src/Eccube/Service/OrderStateMachine.php index dec1b931310..49fd46b1b62 100644 --- a/src/Eccube/Service/OrderStateMachine.php +++ b/src/Eccube/Service/OrderStateMachine.php @@ -57,6 +57,7 @@ public function __construct(StateMachine $_orderStateMachine, OrderStatusReposit * * @param Order $Order 受注 * @param OrderStatus $OrderStatus 遷移先ステータス + * @return void */ public function apply(Order $Order, OrderStatus $OrderStatus) { @@ -82,6 +83,11 @@ public function can(Order $Order, OrderStatus $OrderStatus) return !is_null($this->getTransition($this->newContext($Order), $OrderStatus)); } + /** + * @param OrderStateMachineContext $context + * @param OrderStatus $OrderStatus + * @return mixed|\Symfony\Component\Workflow\Transition|null + */ private function getTransition(OrderStateMachineContext $context, OrderStatus $OrderStatus) { $transitions = $this->machine->getEnabledTransitions($context); @@ -118,6 +124,7 @@ public static function getSubscribedEvents() * 入金日を更新する. * * @param Event $event + * @return void */ public function updatePaymentDate(Event $event) { @@ -130,7 +137,7 @@ public function updatePaymentDate(Event $event) * 会員の保有ポイントを減らす. * * @param Event $event - * + * @return void * @throws PurchaseFlow\PurchaseException */ public function commitUsePoint(Event $event) @@ -142,8 +149,8 @@ public function commitUsePoint(Event $event) /** * 利用ポイントを会員に戻す. - * * @param Event $event + * @return void */ public function rollbackUsePoint(Event $event) { @@ -156,6 +163,7 @@ public function rollbackUsePoint(Event $event) * 在庫を減らす. * * @param Event $event + * @return void * * @throws PurchaseFlow\PurchaseException */ @@ -170,6 +178,7 @@ public function commitStock(Event $event) * 在庫を戻す. * * @param Event $event + * @return void */ public function rollbackStock(Event $event) { @@ -182,6 +191,7 @@ public function rollbackStock(Event $event) * 会員に加算ポイントを付与する. * * @param Event $event + * @return void */ public function commitAddPoint(Event $event) { @@ -197,6 +207,7 @@ public function commitAddPoint(Event $event) * 会員に付与した加算ポイントを取り消す. * * @param Event $event + * @return void */ public function rollbackAddPoint(Event $event) { @@ -213,16 +224,21 @@ public function rollbackAddPoint(Event $event) * {@link StateMachine}によって遷移が終了したときには{@link Order#OrderStatus}のidが変更されるだけなのでOrderStatusを設定し直す. * * @param Event $event + * @return void */ public function onCompleted(Event $event) { - /** @var $context OrderStateMachineContext */ + /** @var OrderStateMachineContext $context */ $context = $event->getSubject(); $Order = $context->getOrder(); $CompletedOrderStatus = $this->orderStatusRepository->find($context->getStatus()); $Order->setOrderStatus($CompletedOrderStatus); } + /** + * @param Order $Order + * @return OrderStateMachineContext + */ private function newContext(Order $Order) { return new OrderStateMachineContext((string) $Order->getOrderStatus()->getId(), $Order); @@ -259,6 +275,7 @@ public function getStatus() /** * @param string $status + * @return void */ public function setStatus($status) { diff --git a/src/Eccube/Service/Payment/Method/Cash.php b/src/Eccube/Service/Payment/Method/Cash.php index 6c1f5389c36..b248210b6a7 100644 --- a/src/Eccube/Service/Payment/Method/Cash.php +++ b/src/Eccube/Service/Payment/Method/Cash.php @@ -31,7 +31,7 @@ class Cash implements PaymentMethodInterface /** @var FormInterface */ private $form; - /** @var */ + /** @var PurchaseFlow */ private $purchaseFlow; /** @@ -81,6 +81,13 @@ public function setFormType(FormInterface $form) return $this; } + /** + * @return FormInterface + */ + public function getFormType() { + return $this->form; + } + /** * {@inheritdoc} */ diff --git a/src/Eccube/Service/Payment/PaymentDispatcher.php b/src/Eccube/Service/Payment/PaymentDispatcher.php index 034f511c902..53039e8451d 100644 --- a/src/Eccube/Service/Payment/PaymentDispatcher.php +++ b/src/Eccube/Service/Payment/PaymentDispatcher.php @@ -36,12 +36,12 @@ class PaymentDispatcher private $route; /** - * @var array + * @var array */ private $pathParameters = []; /** - * @var array + * @var array */ private $queryParameters = []; @@ -98,7 +98,7 @@ public function setRoute($route) /** * クエリパラメータの配列を返します. * - * @return array + * @return array */ public function getQueryParameters() { @@ -108,7 +108,7 @@ public function getQueryParameters() /** * クエリパラメータの配列を設定します. * - * @param array + * @param array $queryParameters * * @return PaymentDispatcher */ @@ -122,7 +122,7 @@ public function setQueryParameters(array $queryParameters) /** * パスパラメータの配列を返します. * - * @return array + * @return array */ public function getPathParameters() { @@ -132,7 +132,7 @@ public function getPathParameters() /** * パスパラメータの配列を設定します. * - * @param array + * @param array $pathParameters * * @return PaymentDispatcher */ @@ -150,7 +150,7 @@ public function setPathParameters(array $pathParameters) * * @param Response $response * - * @return PaymentResult + * @return PaymentDispatcher */ public function setResponse(Response $response) { diff --git a/src/Eccube/Service/Payment/PaymentMethodInterface.php b/src/Eccube/Service/Payment/PaymentMethodInterface.php index 5a8cde08f43..8a08277d082 100644 --- a/src/Eccube/Service/Payment/PaymentMethodInterface.php +++ b/src/Eccube/Service/Payment/PaymentMethodInterface.php @@ -28,7 +28,7 @@ interface PaymentMethodInterface * * 主にクレジットカードの有効性チェック等を実装します. * - * @return PaymentResult + * @return PaymentResult|false */ public function verify(); @@ -46,16 +46,16 @@ public function checkout(); * * PaymentDispatcher に遷移先の情報を設定することで, 他のコントローラに処理を移譲できます. * - * @return PaymentDispatcher + * @return PaymentDispatcher|false */ public function apply(); /** * PaymentMethod の処理に必要な FormInterface を設定します. * - * @param FormInterface + * @param $form FormInterface * - * @return PaymentMethod + * @return PaymentMethodInterface */ public function setFormType(FormInterface $form); @@ -64,7 +64,7 @@ public function setFormType(FormInterface $form); * * @param Order * - * @return PaymentMethod + * @return PaymentMethodInterface */ public function setOrder(Order $Order); }