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
220
補完したい話
第127回PHP勉強会
PHPカンファレンス福岡2018 AfterHack
で発表した資料です。
chiroruxx
June 27, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
eBPF with PHPをさわる
chiroruxx
0
81
sl完全に理解したつもり
chiroruxx
0
75
命名をリントする
chiroruxx
1
680
良い命名かを調べるリンターを作った + α
chiroruxx
0
77
GoLandを布教する会
chiroruxx
0
23
PHPはいつから死んでいるかの調査
chiroruxx
3
610
元phperから見たGoの良いところ
chiroruxx
0
73
Go Connectへの想い
chiroruxx
0
440
GraphQLに入門してみた
chiroruxx
2
310
Other Decks in Programming
See All in Programming
Ça bouge du côté des animations CSS !
goetter
2
140
楽しく向き合う例外対応
okutsu
0
570
PHPのバージョンアップ時にも役立ったAST
matsuo_atsushi
0
210
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
110
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
440
バッチを作らなきゃとなったときに考えること
irof
2
490
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
40
16k
sappoRo.R #12 初心者セッション
kosugitti
0
270
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
170
技術を改善し続ける
gumioji
0
110
『品質』という言葉が嫌いな理由
korimu
0
180
Go 1.24でジェネリックになった型エイリアスの紹介
syumai
2
260
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
How GitHub (no longer) Works
holman
314
140k
How to Ace a Technical Interview
jacobian
276
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
Into the Great Unknown - MozCon
thekraken
35
1.6k
Six Lessons from altMBA
skipperchong
27
3.6k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Building an army of robots
kneath
303
45k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
640
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」というファイルを書けば補完ができる! ▪ 引数の型も補完してくれる! ▪ 書くの大変だから自動化できるといいね