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
210
補完したい話
第127回PHP勉強会
PHPカンファレンス福岡2018 AfterHack
で発表した資料です。
chiroruxx
June 27, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
PHPはいつから死んでいるかの調査
chiroruxx
2
440
元phperから見たGoの良いところ
chiroruxx
0
21
Go Connectへの想い
chiroruxx
0
180
GraphQLに入門してみた
chiroruxx
2
210
ドキュメンテーションコメント再入門
chiroruxx
0
100
我流カンファレンス楽しみ術
chiroruxx
0
63
最初の一歩を踏み出す言葉
chiroruxx
4
1.1k
PhpStormをIDEとして使う
chiroruxx
0
64
Goを始めて感じたPHPの魅力
chiroruxx
1
68
Other Decks in Programming
See All in Programming
スタックトレース始めてみた
kuro_kurorrr
5
1.2k
Dev ContainersとTestcontainers
bells17
3
100
Productivity is Messing Around and Having Fun
hollycummins
1
190
仕様と実装で学ぶOpenTelemetry
drumato
2
1.2k
TSKaigi 2024 - 新サービス Progate Path の演習で TypeScript を採用して見えた教材観点からの利点と課題
makotoshimazu
1
230
The grand strategy of Ruby Parser
yui_knk
5
430
The Design of Everyday APIs - PyCon 2024
roguelynn
1
240
Enjoy Creative Coding with Ruby (RubyKaigi2024)
chobishiba
0
1k
Using "modern" Ruby to build a better, faster Homebrew
mikemcquaid
2
300
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
510
WinActorの勉強を継続する方法
tamai_63
0
130
[RubyKaigi 2024] Ruby Mixology 101: adding shots of PHP, Elixir, and more
palkan
0
140
Featured
See All Featured
Statistics for Hackers
jakevdp
790
220k
Six Lessons from altMBA
skipperchong
22
3k
Robots, Beer and Maslow
schacon
PRO
155
8k
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
The Invisible Customer
myddelton
114
12k
How GitHub (no longer) Works
holman
305
140k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
9
1.3k
The Cost Of JavaScript in 2023
addyosmani
21
4k
jQuery: Nuts, Bolts and Bling
dougneiner
60
7.2k
YesSQL, Process and Tooling at Scale
rocio
165
13k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
14
8.4k
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」というファイルを書けば補完ができる! ▪ 引数の型も補完してくれる! ▪ 書くの大変だから自動化できるといいね