Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
補完したい話
Search
chiroruxx
June 27, 2018
Programming
1
200
補完したい話
第127回PHP勉強会
PHPカンファレンス福岡2018 AfterHack
で発表した資料です。
chiroruxx
June 27, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
PHPはいつから死んでいるかの調査
chiroruxx
1
400
元phperから見たGoの良いところ
chiroruxx
0
19
Go Connectへの想い
chiroruxx
0
140
GraphQLに入門してみた
chiroruxx
2
200
ドキュメンテーションコメント再入門
chiroruxx
0
88
我流カンファレンス楽しみ術
chiroruxx
0
58
最初の一歩を踏み出す言葉
chiroruxx
4
1.1k
PhpStormをIDEとして使う
chiroruxx
0
58
Goを始めて感じたPHPの魅力
chiroruxx
1
65
Other Decks in Programming
See All in Programming
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
PostmanでAPIの動作確認が楽になった話
h455h1
0
170
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
790
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
370
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.4k
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4.1k
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
490
Snowflakeで眠ったデータを起こそう!
estie
0
120
障害対応を起点としたもっといい開発と運用のサイクル作りのためにできること / Hatena Enginner Seminar #29
polamjag
0
170
Node.js v22 で変わること
yosuke_furukawa
PRO
9
3.4k
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
710
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
180
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Embracing the Ebb and Flow
colly
80
4.1k
Web development in the modern age
philhawksworth
202
10k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
Bash Introduction
62gerente
604
210k
Typedesign – Prime Four
hannesfritz
36
2.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
20
1.9k
Art, The Web, and Tiny UX
lynnandtonic
289
19k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
Producing Creativity
orderedlist
PRO
337
39k
Transcript
補完したい話 6/27 PHP勉強会@東京 前田 和人
PHP Conference スポンサー募集中
自己紹介 ▪ 前田 和人 ▪ @chiroruxxxx ▪ 弁護士ドットコム株式会社 ▪ 補完機能依存
補完機能依存 ▪ もはや補完がないと生きていけない – すべてPhpStormのせい ▪ シェルも補完がないとつらい – fish最高! ▪
今日はPhpStormの話をするよ(fishはまた今度)
補完が効かないやつら ▪ factory ▪ サービスコンテナ ▪ 「引数によって返す型が違う」メソッドから生成されたインスタンスが補完で きない $user =
factory(User::class)->create(); $api = resolve(API::class);
つらい
頑張れば補完できるけど・・・ ▪ PHPDocで型を明示してあげれば補完できるけど・・・ ▪ 毎回これ書くのはちょっとしんどい ▪ 補完のためにコード長くするのも・・・ /** @var ¥App¥User
$user */ $user = factory(User::class)->create();
.phpstorm.meta.php ▪ .phpstorm.meta.phpというファイルを作成することで対応できる! ▪ WI-6027により実装された機能 ▪ factory design patternを補完する
.phpstorm.meta.php <?php namespace PHPSTORM_META { override(¥ServiceLocatorInterface::get(0), map([ "special" => ¥Exception::class,
¥ExampleFactory::EXAMPLE_B => ExampleB::class, ¥EXAMPLE_B => ¥ExampleB::class, ])); }
.phpstorm.meta.php <?php namespace PHPSTORM_META { override(¥ServiceLocatorInterface::getByPattern(0), map([ '' => '@Iterator|¥Iterator',
])); }
まとめ ▪ 「.phpstorm.meta.php」というファイルを書けば補完ができる! ▪ 引数の型も補完してくれる! ▪ 書くの大変だから自動化できるといいね