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
48
命名をリントする
chiroruxx
1
450
良い命名かを調べるリンターを作った + α
chiroruxx
0
67
GoLandを布教する会
chiroruxx
0
19
PHPはいつから死んでいるかの調査
chiroruxx
3
580
元phperから見たGoの良いところ
chiroruxx
0
64
Go Connectへの想い
chiroruxx
0
420
GraphQLに入門してみた
chiroruxx
2
300
ドキュメンテーションコメント再入門
chiroruxx
0
210
Other Decks in Technology
See All in Technology
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
330
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
120
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
140
Qiita埋め込み用スライド
naoki_0531
0
5.3k
なぜCodeceptJSを選んだか
goataka
0
180
OCI技術資料 : ファイル・ストレージ 概要
ocise
3
11k
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
39
16k
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
160
Yahoo! ズバトクにおけるフロントエンド開発
lycorptech_jp
PRO
0
100
12 Days of OpenAIから読み解く、生成AI 2025年のトレンド
shunsukeono_am
0
140
20241220_S3 tablesの使い方を検証してみた
handy
4
700
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
150
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Six Lessons from altMBA
skipperchong
27
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Optimising Largest Contentful Paint
csswizardry
33
3k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Pragmatic Product Professional
lauravandoore
32
6.3k
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 ྻͷཁૉͷܕΛറΓ͍ͨͱ͖