Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ jobs:
- name: Codeception
env:
GROUP: ${{ matrix.group }}
SYMFONY_DEPRECATIONS_HELPER: weak
SYMFONY_DEPRECATIONS_HELPER: 'max[direct]=0'
continue-on-error: true
run: |
sed -i "s|%GITHUB_WORKSPACE%|${GITHUB_WORKSPACE}|g" codeception/_envs/github_action.yml
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="KERNEL_CLASS" value="Eccube\Kernel" />
<server name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
Expand Down
20 changes: 0 additions & 20 deletions src/Eccube/Entity/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class Cart extends AbstractEntity implements PurchaseInterface, ItemHolderInterf
#[ORM\JoinColumn(name: 'customer_id', referencedColumnName: 'id')]
private ?Customer $Customer = null;

private bool $lock = false;

/**
* @var Collection<int, CartItem>
*/
Expand Down Expand Up @@ -147,24 +145,6 @@ public function setAgentOwned(bool $agentOwned): Cart
return $this;
}

/**
* @deprecated 使用しないので削除予定
*/
public function getLock(): bool
{
return $this->lock;
}

/**
* @deprecated 使用しないので削除予定
*/
public function setLock(bool $lock): Cart
{
$this->lock = $lock;

return $this;
}

public function getPreOrderId(): ?string
{
return $this->pre_order_id;
Expand Down
14 changes: 0 additions & 14 deletions src/Eccube/Entity/Master/CustomerStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
class CustomerStatus extends AbstractMasterEntity
{
/**
* 仮会員.
*
* @deprecated
*/
public const NONACTIVE = 1;

/**
* 本会員.
*
* @deprecated
*/
public const ACTIVE = 2;

/**
* 仮会員.
*/
Expand Down
12 changes: 0 additions & 12 deletions src/Eccube/Entity/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,6 @@ public function getMergedProductOrderItems(): array
return array_values($orderItemArray);
}

/**
* 合計金額を計算
*
* @deprecated
*/
public function getTotalPrice(): string
{
@trigger_error('The '.__METHOD__.' method is deprecated.', E_USER_DEPRECATED);

return $this->getPaymentTotal();
}

#[ORM\Column(name: 'id', type: Types::INTEGER, options: ['unsigned' => true])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
Expand Down
22 changes: 0 additions & 22 deletions src/Eccube/Entity/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,28 +418,6 @@ public function getTaxAdjust(): string
return $this->tax_adjust;
}

/**
* Set taxRuleId.
*
* @deprecated 税率設定は受注作成時に決定するため廃止予定
*/
public function setTaxRuleId(?int $taxRuleId = null): OrderItem
{
$this->tax_rule_id = $taxRuleId;

return $this;
}

/**
* Get taxRuleId.
*
* @deprecated 税率設定は受注作成時に決定するため廃止予定
*/
public function getTaxRuleId(): ?int
{
return $this->tax_rule_id;
}

/**
* Get currencyCode.
*/
Expand Down
10 changes: 0 additions & 10 deletions src/Eccube/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,6 @@ public function _calc(): void
}
}

/**
* Is Enable
*
* @deprecated
*/
public function isEnable(): bool
{
return $this->getStatus()->getId() === ProductStatus::DISPLAY_SHOW ? true : false;
}

/**
* Get ClassName1
*/
Expand Down
10 changes: 0 additions & 10 deletions src/Eccube/Entity/ProductClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ public function formattedProductName(): string
return $productName;
}

/**
* Is Enable
*
* @deprecated
*/
public function isEnable(): bool
{
return $this->getProduct()->isEnable();
}

/**
* Set price01 IncTax
*/
Expand Down
11 changes: 0 additions & 11 deletions src/Eccube/Resource/functions/trans.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,3 @@ function trans(string|int $id, array $parameters = [], ?string $domain = null, ?

return $Translator->trans($id, $parameters, $domain, $locale);
}

/**
* @param mixed $number - 不要引数
* @param array<mixed> $parameters
*
* @deprecated transを使用してください。
*/
function transChoice(string|int $id, mixed $number, array $parameters = [], ?string $domain = null, ?string $locale = null): string
{
return trans($id, $parameters, $domain, $locale);
}
6 changes: 0 additions & 6 deletions src/Eccube/Service/CartService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Eccube\Entity\Cart;
use Eccube\Entity\CartItem;
use Eccube\Entity\Customer;
use Eccube\Entity\ItemHolderInterface;
use Eccube\Entity\ProductClass;
use Eccube\Repository\CartRepository;
use Eccube\Repository\OrderRepository;
Expand All @@ -39,11 +38,6 @@ class CartService
*/
protected ?array $carts = null;

/**
* @deprecated
*/
protected ItemHolderInterface $cart;

/**
* CartService constructor.
*/
Expand Down
20 changes: 0 additions & 20 deletions src/Eccube/Service/PurchaseFlow/Processor/TaxProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,4 @@ protected function getTaxType(OrderItemType|int $OrderItemType): TaxType

return $this->entityManager->find(TaxType::class, $TaxType);
}

/**
* 税表示区分を取得する.
*
* - 商品: 税抜
* - 送料: 税込
* - 値引き: 税抜
* - 手数料: 税込
* - ポイント値引き: 税込
*
* @param OrderItemType|int $OrderItemType 明細種別
*
* @deprecated OrderHelper::getTaxDisplayTypeを使用してください
*
* @return TaxDisplayType 税表示区分
*/
protected function getTaxDisplayType(OrderItemType|int $OrderItemType): TaxDisplayType
{
return $this->orderHelper->getTaxDisplayType($OrderItemType);
}
}
64 changes: 0 additions & 64 deletions src/Eccube/Util/CacheUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
use Symfony\Component\HttpKernel\Event\TerminateEvent;
use Symfony\Component\HttpKernel\KernelEvents;
Expand Down Expand Up @@ -140,69 +139,6 @@ public function clearTwigCache(): void
$fs->remove($cacheDir);
}

/**
* キャッシュを削除する.
*
* doctrine, profiler, twig によって生成されたキャッシュディレクトリを削除する.
* キャッシュは $app['config']['root_dir'].'/app/cache' に生成されます.
*
* @param Application|array{config: array{root_dir: string}} $app
* @param bool $isAll .gitkeep を残してすべてのファイル・ディレクトリを削除する場合 true, 各ディレクトリのみを削除する場合 false
* @param bool $isTwig Twigキャッシュファイルのみ削除する場合 true
*
* @return bool 削除に成功した場合 true
*
* @deprecated CacheUtil::clearCacheを利用すること
*/
public static function clear(Application|array $app, bool $isAll, bool $isTwig = false): bool
{
$cacheDir = $app['config']['root_dir'].'/app/cache';

$filesystem = new Filesystem();
$finder = Finder::create()->notName('.gitkeep')->files();
if ($isAll) {
$finder = $finder->in($cacheDir);
$filesystem->remove($finder);
} elseif ($isTwig) {
if (is_dir($cacheDir.'/twig')) {
$finder = $finder->in($cacheDir.'/twig');
$filesystem->remove($finder);
}
} else {
if (is_dir($cacheDir.'/doctrine')) {
$finder = $finder->in($cacheDir.'/doctrine');
$filesystem->remove($finder);
}
if (is_dir($cacheDir.'/profiler')) {
$finder = $finder->in($cacheDir.'/profiler');
$filesystem->remove($finder);
}
if (is_dir($cacheDir.'/twig')) {
$finder = $finder->in($cacheDir.'/twig');
$filesystem->remove($finder);
}
if (is_dir($cacheDir.'/translator')) {
$finder = $finder->in($cacheDir.'/translator');
$filesystem->remove($finder);
}
}

if (function_exists('opcache_reset')) {
opcache_reset();
}

if (function_exists('apc_clear_cache')) {
apc_clear_cache('user');
apc_clear_cache();
}

if (function_exists('wincache_ucache_clear')) {
wincache_ucache_clear();
}

return true;
}

/**
* {@inheritdoc}
*/
Expand Down
23 changes: 0 additions & 23 deletions tests/Eccube/Tests/Entity/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use Eccube\Entity\TaxRule;
use Eccube\Service\TaxRuleService;
use Eccube\Tests\EccubeTestCase;
use Eccube\Tests\Fixture\Generator;
use PHPUnit\Framework\Attributes\Group;

/**
Expand Down Expand Up @@ -127,28 +126,6 @@ public function testGetSaleTypes()
$this->verify();
}

#[Group(name: 'decimal')]
public function testGetTotalPrice()
{
$faker = $this->getFaker();
/** @var Order $Order */
$Order = static::getContainer()->get(Generator::class)->createOrder(
$this->Customer,
[],
null,
$faker->randomNumber(5),
$faker->randomNumber(5)
);
// 元の計算式: $Order->getSubTotal() + $Order->getCharge() + $Order->getDeliveryFeeTotal() - $Order->getDiscount();
$this->expected = bcadd(
bcadd(bcadd($Order->getSubTotal(), $Order->getCharge(), 2), $Order->getDeliveryFeeTotal(), 2),
bcsub('0', $Order->getDiscount(), 2),
2
);
$this->actual = $Order->getTotalPrice();
$this->verify();
}

public function testGetMergedProductOrderItems()
{
$quantity = '5'; // 配送先あたりの商品の個数
Expand Down
4 changes: 2 additions & 2 deletions tests/Eccube/Tests/Fixture/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function createCustomer(?string $email = null, bool $flush = true): Custo
} while ($this->customerRepository->findBy(['email' => $email]));
}
$phoneNumber = str_replace('-', '', $faker->phoneNumber);
$Status = $this->entityManager->find(CustomerStatus::class, CustomerStatus::ACTIVE);
$Status = $this->entityManager->find(CustomerStatus::class, CustomerStatus::REGULAR);
$Pref = $this->entityManager->find(Pref::class, $faker->numberBetween(1, 47));
$Sex = $this->entityManager->find(Sex::class, $faker->numberBetween(1, 2));
$Job = $this->entityManager->find(Job::class, $faker->numberBetween(1, 18));
Expand Down Expand Up @@ -909,7 +909,7 @@ public function createCustomers(int $count, array $options = []): array
$Sex = $options['sex'] ?? null;
/** @var CustomerStatus $Status */
$Status = $options['status']
?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::ACTIVE);
?? $this->entityManager->find(CustomerStatus::class, CustomerStatus::REGULAR);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

DocBlockのデフォルト値もREGULARへ更新してください。

実装はCustomerStatus::REGULARをデフォルトにしていますが、createCustomers()のDocBlock(Line 895)は依然としてACTIVEと記載されています。利用者が誤ったステータスを想定しないよう、コメントも同時に更新してください。

修正例
-     *     `@var` CustomerStatus|null $status         全 Customer に設定する CustomerStatus (デフォルト: ACTIVE)
+     *     `@var` CustomerStatus|null $status         全 Customer に設定する CustomerStatus (デフォルト: REGULAR)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Eccube/Tests/Fixture/Generator.php` at line 912,
createCustomers()のDocBlockに記載されたデフォルトステータスをACTIVEからREGULARへ更新し、実装のCustomerStatus::REGULARと説明を一致させてください。

$emailTemplate = $options['emailTemplate']
?? fn (int $i): string => sprintf('bulk-user-%d-%s@example.com', $i, $faker->uuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ public static function dataFormDateTimeProvider(): \Iterator

public function testStatus()
{
$Active = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::ACTIVE);
$NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE);
$Active = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::REGULAR);
$NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL);
$this->Customer->setStatus($Active);
$this->Customer1->setStatus($NonActive);
$this->entityManager->flush();
Expand All @@ -679,7 +679,7 @@ public function testStatus()

public function testStatusWithNonActive()
{
$NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE);
$NonActive = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL);
$this->Customer->setStatus($NonActive);
$this->Customer1->setStatus($NonActive);
$this->entityManager->flush();
Expand Down
2 changes: 1 addition & 1 deletion tests/Eccube/Tests/Repository/CustomerRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testNewCustomer()
public function testGetProvisionalCustomerBySecretKey()
{
$this->expected = $this->Customer->getSecretKey();
$Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::NONACTIVE);
$Status = $this->entityManager->getRepository(CustomerStatus::class)->find(CustomerStatus::PROVISIONAL);
$this->Customer->setStatus($Status);
$this->entityManager->flush();

Expand Down
Loading