Skip to content

Commit 152dd5d

Browse files
nanasessclaude
andcommitted
fix(deps-dev): rector を 2.5.8 に更新し phpstan 2.2 との非互換による fatal error を解消
rector 2.5.7 は phpstan 2.2 で削除された `PHPStan\Parser\RichParser` の private プロパティ `$container` を PrivatesAccessor 経由で参照するため, DI コンテナ構築時に MissingPrivatePropertyException で fatal error になり Rector ジョブが失敗していた. composer の制約上は矛盾がない (rector 2.5.7 の要求は phpstan ^2.2.2) ため dependabot が壊れた組み合わせの lock を生成していた. rector 2.5.8 (rectorphp/rector-src#8208 "Bump to PHPStan ^2.2.6 and Fix its Container compatibility in RichParser") で `$nodeVisitors` を参照する実装に 修正されているため 2.5.8 へ更新する. rector 2.3.9 への据え置きは phpstan を ^2.1.40 に固定する意味になり本 PR の phpstan 2.2 更新と両立しない. あわせて 2.3.9 → 2.5.8 で追加された新ルールの指摘に追従する. RemoveDefaultValueFromAssignedPropertyRector は以下の理由でスキップする. - Entity (Order::$delivery_fee_total, Customer::$buy_times 等) の初期化子は `#[ORM\Column(options: ['default' => 0])]` と対になる初期値の表明である - LoggerFacade / TranslatorFacade の static プロパティは init() 前にも参照され得るため, 初期化子を消すと nullable 型なのに未初期化アクセスの Error になる TwigInitializeListener では `@var Page $Page` の削除により `$Page->getPageLayouts()` の native 型が解決されるようになり, 不正確な `@var PageLayout[]` が PHPStan で検出されたため削除した (`Page::getPageLayouts()` は `@return Collection<int, PageLayout>` を持つ). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 655c429 commit 152dd5d

96 files changed

Lines changed: 27 additions & 411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎codeception/acceptance/EA09ShippingCest.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313

1414
use Codeception\Util\Fixtures;
15-
use Eccube\Entity\Customer;
1615
use Eccube\Entity\Master\OrderStatus;
1716
use Eccube\Entity\Order;
1817
use Page\Admin\OrderEditPage;

‎composer.lock‎

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎rector.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
1919
use Rector\Config\RectorConfig;
2020
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
21+
use Rector\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector;
2122
use Rector\Doctrine\Bundle210\Rector\Class_\EventSubscriberInterfaceToAttributeRector;
2223
use Rector\Doctrine\Set\DoctrineSetList;
2324
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
@@ -82,6 +83,12 @@
8283
// 8.3以上で対応可能
8384
AddTypeToConstRector::class, // [BC]定数に型を追加する PHP 8.3 以降で有効
8485
RenameMethodRector::class, //addがaddCommandに変換されてしまうため一旦スキップ
86+
// プロパティ初期化子の削除はエンティティと static Facade で不都合が出るためスキップする。
87+
// - Entity (Order::$delivery_fee_total, Customer::$buy_times 等) は
88+
// #[ORM\Column(options: ['default' => 0])] と対になる初期値の表明であり削除しない
89+
// - LoggerFacade / TranslatorFacade の static プロパティは init() 前にも参照され得るため,
90+
// 初期化子を消すと nullable 型なのに未初期化アクセスの Error になる
91+
RemoveDefaultValueFromAssignedPropertyRector::class,
8592
])
8693
// 個別にルールを追加する場合はここに記述
8794
->withRules([

‎src/Eccube/Command/GenerateProxyCommand.php‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ public function __construct(private readonly EntityProxyService $entityProxyServ
2828
parent::__construct();
2929
}
3030

31-
#[\Override]
32-
protected function configure(): void
33-
{
34-
}
35-
3631
#[\Override]
3732
protected function execute(InputInterface $input, OutputInterface $output): int
3833
{

‎src/Eccube/Command/InstallerCommand.php‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ public function updateEnvFile(): void
117117
};
118118
}
119119

120-
#[\Override]
121-
protected function configure(): void
122-
{
123-
}
124-
125120
#[\Override]
126121
protected function interact(InputInterface $input, OutputInterface $output): void
127122
{
@@ -302,8 +297,6 @@ protected function getDatabaseName(string $databaseUrl): string
302297
}
303298

304299
/**
305-
* @return false|string
306-
*
307300
* @throws \Doctrine\DBAL\Exception
308301
*/
309302
protected function getDatabaseServerVersion(string $databaseUrl): false|string

‎src/Eccube/Command/PluginSchemaUpdateCommand.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Eccube\Command;
1515

16-
use Eccube\Entity\Plugin;
1716
use Symfony\Component\Console\Attribute\AsCommand;
1817
use Symfony\Component\Console\Command\Command;
1918
use Symfony\Component\Console\Input\InputArgument;
@@ -40,7 +39,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4039

4140
$code = $input->getArgument('code');
4241

43-
/** @var Plugin|null $Plugin */
4442
$Plugin = $this->pluginRepository->findByCode($code);
4543
if (!$Plugin) {
4644
$io->error("No such plugin `{$code}`.");

‎src/Eccube/Command/PluginUpdateCommand.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Eccube\Command;
1515

16-
use Eccube\Entity\Plugin;
1716
use Symfony\Component\Console\Attribute\AsCommand;
1817
use Symfony\Component\Console\Command\Command;
1918
use Symfony\Component\Console\Input\InputArgument;
@@ -40,7 +39,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4039

4140
$code = $input->getArgument('code');
4241

43-
/** @var Plugin|null $Plugin */
4442
$Plugin = $this->pluginRepository->findByCode($code);
4543

4644
if (!$Plugin) {

‎src/Eccube/Controller/AbstractShoppingController.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function setPurchaseFlow(PurchaseFlow $shoppingPurchaseFlow): void
3535
*/
3636
protected function executePurchaseFlow(ItemHolderInterface $itemHolder, bool $returnResponse = true): PurchaseFlowResult|RedirectResponse|null
3737
{
38-
/** @var PurchaseFlowResult $flowResult */
3938
$flowResult = $this->purchaseFlow->validate($itemHolder, new PurchaseContext(clone $itemHolder, $itemHolder->getCustomer()));
4039
foreach ($flowResult->getWarning() as $warning) {
4140
$this->addWarning($warning->getMessage());

‎src/Eccube/Controller/Admin/AbstractCsvImportController.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public function setBaseInfoRepository(BaseInfoRepository $baseInfoRepository): v
4040

4141
/**
4242
* アップロードされたCSVファイルの行ごとの処理
43-
*
44-
* @return CsvImportService<int, mixed>|bool
4543
*/
4644
protected function getImportData(UploadedFile $formFile): CsvImportService|bool
4745
{

‎src/Eccube/Controller/Admin/Content/FileController.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ private function getTree(string $topDir, Request $request): array
417417
'path' => $path,
418418
'type' => $type,
419419
'depth' => $depth,
420-
'open' => (in_array($path, $openDirs)) ? true : false,
420+
'open' => in_array($path, $openDirs),
421421
];
422422
}
423423

@@ -477,7 +477,7 @@ private function getFileList(string $nowDir): array
477477
'file_size' => FilesystemUtil::sizeToHumanReadable($dir->getSize()),
478478
'file_time' => $dir->getmTime(),
479479
'is_dir' => true,
480-
'is_empty' => $countNumber == 0 ? true : false,
480+
'is_empty' => $countNumber == 0,
481481
];
482482
}
483483
foreach ($files as $file) {

0 commit comments

Comments
 (0)