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
October 30, 2019
Technology
0
190
...意外に便利だった!!
2019/10/30 PHP勉強会@東京で話したスライドです。
chiroruxx
October 30, 2019
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
sl完全に理解したつもり
chiroruxx
0
59
命名をリントする
chiroruxx
1
630
良い命名かを調べるリンターを作った + α
chiroruxx
0
68
GoLandを布教する会
chiroruxx
0
19
PHPはいつから死んでいるかの調査
chiroruxx
3
600
元phperから見たGoの良いところ
chiroruxx
0
70
Go Connectへの想い
chiroruxx
0
430
GraphQLに入門してみた
chiroruxx
2
300
ドキュメンテーションコメント再入門
chiroruxx
0
220
Other Decks in Technology
See All in Technology
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
430
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
20241228 - 成為最強魔法使!AI 實時生成比賽的策略 @ 2024 SD AI 年會
dpys
0
350
知っててうれしい SQL について
greendrop
0
130
When Windows Meets Kubernetes…
pichuang
0
290
商品レコメンドでのexplicit negative feedbackの活用
alpicola
1
300
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
140
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
800
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
300
Visual StudioとかIDE関連小ネタ話
kosmosebi
1
360
.NET AspireでAzure Functionsやクラウドリソースを統合する
tsubakimoto_s
0
180
実践! ソフトウェアエンジニアリングの価値の計測 ── Effort、Output、Outcome、Impact
nomuson
0
1.9k
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Music & Morning Musume
bryan
46
6.3k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
The Invisible Side of Design
smashingmag
299
50k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Adopting Sorbet at Scale
ufuk
74
9.2k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Being A Developer After 40
akosma
89
590k
Visualization
eitanlees
146
15k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Transcript
ҙ֎ʹศརͩͬͨ 2019/10/30 PHPษڧձ@౦ژ લా ਓ
ࣗݾհ w લాਓ w !DIJSPSVYYYY w 3PYY
w εϙϯαʔืूதͰ͢ʂʂ
ҙ֎ʹศརͩͬͨ
ʮʯҙ֎ʹศརͩͬͨ
1)1ʹ͓͚Δʮʯ ͭ͋Δ
ՄมݸҾؔ function printArgs(...$inputs) { echo $inputs[0]; // apple echo $inputs[1];
// banana echo $inputs[2]; // chocolate } printArgs('apple', 'banana', 'chocolate');
ҾͷΞϯύοΫ function printArgs($a, $b, $c) { // (ུ) } $args
= ['apple', 'banana', 'chocolate']; printArgs(...$args);
͍͕ͬͯͨʜ w ػೳ͕ଘࡏ͢Δ͜ͱͬͯͨ w Ͱ࣮ࡍશવͬͯͳ͔ͬͨ w ΠϚΠν͍Ͳ͜Ζ͕Θ͔Βͳ͔ͬͨ ࠷ۙɺศརͳ͍ํΛݟ͚ͭͨ
ྫ w ࣗͰఆٛͨ͠4UBUVTΫϥε͕͋Δ w 4UBUVTΛෳѻ͏Ϋϥε͕΄͍͠ w ྻΛϥοϓͨ͠Ϋϥε w ཁ݅ҎԼ w
ҙͷͷ4UBUVTΠϯελϯεΛཁૉʹ࣋ͭ w 4UBUVTΠϯελϯεҎ֎Λཁૉʹ͍͚࣋ͬͯͳ͍ w Ωʔ࿈൪ͷΈʹ͢Δ ࿈ྻʹ͠ͳ͍
·ͣී௨ʹ࣮͠·͢
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
ී௨ͷ࣮ class StatusCollection { private $items; public function __construct(array $items)
{ foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = array_values($items); } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection($items);
Λ͍͖ͬͯ·͢ʂ
Λ࣮ͬͨ class StatusCollection { private $items; public function __construct(...$items) {
foreach ($items as $item) { if (!$item instanceof Status) { throw new InvalidArgumentException(); } } $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection(...$items);
Λ࣮ͬͨ class StatusCollection { private $items; public function __construct(Status ...$items)
{ $this->items = $items; } } $items = [Status::random(), Status::random(), Status::random()]; new StatusCollection(...$items);
ศརʂʂ
·ͱΊ w ʮʯΛ͏ͱҎԼͷέʔεͰϥΫʹͳΔ w ྻͷΩʔʹ͍ͭͯߟ͑ͨ͘ͳ͍ͱ͖ w ྻͷཁૉͷܕΛറΓ͍ͨͱ͖