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] Array shapes のサポート #5833

Merged
merged 2 commits into from
Oct 4, 2022
Merged

Conversation

nanasess
Copy link
Contributor

@nanasess nanasess commented Sep 30, 2022

概要(Overview・Refs Issue)

Array shapes を使用して、連想配列の変数を型定義する
see https://phpstan.org/writing-php-code/phpdoc-types#array-shapes

方針(Policy)

とり急ぎ利用頻度の高そうな Repository クラスの $searchData 及び、 PluginManager クラスの $meta を定義する

実装に関する補足(Appendix)

Array shapes で型定義しておくと、連想配列でもコード補完が可能になる。 PHPStorm でも利用できるはず
image

テスト(Test)

PHPStan 及び PhpActor で型定義が有効になっていることを確認

相談(Discussion)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更はありません
  • フックポイントの呼び出しタイミングの変更はありません
  • フックポイントのパラメータの削除・データ型の変更はありません
  • twigファイルに渡しているパラメータの削除・データ型の変更はありません
  • Serviceクラスの公開関数の、引数の削除・データ型の変更はありません
  • 入出力ファイル(CSVなど)のフォーマット変更はありません

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか
    • 権限を超えた操作が可能にならないか
    • 不要なファイルアップロードがないか
    • 外部へ公開されるファイルや機能の追加ではないか
    • テンプレートでのエスケープ漏れがないか

@codecov-commenter
Copy link

Codecov Report

Merging #5833 (575f123) into 4.2 (0fbb7b3) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##                4.2    #5833      +/-   ##
============================================
- Coverage     78.75%   78.75%   -0.01%     
  Complexity     6287     6287              
============================================
  Files           470      470              
  Lines         21096    21096              
============================================
- Hits          16615    16614       -1     
- Misses         4481     4482       +1     
Flag Coverage Δ
E2E 64.75% <ø> (-0.04%) ⬇️
Unit 77.77% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Eccube/Plugin/AbstractPluginManager.php 100.00% <ø> (ø)
src/Eccube/Repository/CustomerRepository.php 98.72% <ø> (ø)
src/Eccube/Repository/OrderRepository.php 95.26% <ø> (ø)
src/Eccube/Repository/ProductRepository.php 97.71% <ø> (ø)
...be/Service/PurchaseFlow/Processor/TaxProcessor.php 82.45% <0.00%> (-1.76%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

* category_id?:Category,
* name?:string,
* pageno?:string,
* disp_number?:ProductListMax,
Copy link
Contributor

Choose a reason for hiding this comment

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

@nanasess
pageno, disp_numberは使ってなさそうです。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chihiro-adachi SearchProductType には pageno, disp_number が含まれており、 $searchData 連想配列には含まれるため記載しました

$builder->add('pageno', HiddenType::class, []);
$builder->add('disp_number', ProductListMaxType::class, [
'label' => false,
'choices' => $this->entityManager->getRepository(ProductListMax::class)->findBy([], ['sort_no' => 'ASC']),
]);

Copy link
Contributor

Choose a reason for hiding this comment

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

なるほど。了解です。

@chihiro-adachi chihiro-adachi added this to the 4.2.1 milestone Oct 4, 2022
@chihiro-adachi chihiro-adachi merged commit 2240963 into EC-CUBE:4.2 Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants