Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
assertぐらいでエバルんじゃねえ!
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Atsushi Takayama
December 15, 2016
Technology
970
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
assertぐらいでエバルんじゃねえ!
〜Phanがもたらす堅牢なPHP〜
Atsushi Takayama
December 15, 2016
More Decks by Atsushi Takayama
See All by Atsushi Takayama
最高の開発者体験の追求が開発生産性を改善し続ける文化を生み出した話
edvakf
3
1.9k
NeurIPS 2021 論文読み会: How Modular should Neural Module Networks Be for Systematic Generalization?
edvakf
0
240
8年物のJavaのシステムをKotlinに変えていく選択に至るまで
edvakf
2
1.1k
ピクシブ社内のImageFlux利用事例紹介
edvakf
2
3.2k
学びの文化を育む社内読書会のススメ
edvakf
0
320
フルCDNアーキテクチャでサービス設計した話
edvakf
5
4.2k
Goでバイナリを読む+α
edvakf
1
1k
お前はこれまでに作ったAPIの数を覚えているのか?
edvakf
0
2.8k
「ふつうのRailsアプリケーション」についての考え方
edvakf
2
960
Other Decks in Technology
See All in Technology
「大丈夫そう?」をObservabilityで確かめる
mrmtsu
0
240
Azure Copilot Resiliency Agentをいろいろ試してみる
tomokusaba
0
140
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
490
Making AI Agents Safe and Fast- Jev, Obsidian, and the Meta-Harness
x5gtrn
PRO
0
160
LT:「このままでいいのかな?」から一歩踏み出した私のデータキャリア選択〜社会人3年目に上京を決意したリアル〜Snowflake女子会 vol.8
snowwmn0824
0
110
AIに書かせて、プラットフォームで縛る ― EKSプラットフォームで実践した責任境界と権限設計
elmodev09
1
1.1k
可視化から始めたAI駆動開発_ochi_ver1.01 / AI-Driven Development Starting with Visualization_ver1.01
yayoi_dd
0
110
2026-09-26 Platform Engineering Kaigi 2026 インフラとアプリの境界線と委譲の設計 / Drawing the Infra and App Line
masasuzu
0
500
AWS FinOps Agent 結局何が得意なの?
siromi
0
220
Amazon Bedrock Agents ClassicからAmazon Bedrock AgentCoreへ移行した際、ガードレール設定が2箇所に割れた話
matsunobu
0
160
IR Today: Theory, Practice, and Agents
dtunkelang
0
260
AIに賢く動いてもらうためのコンテキスト〜Snowflake女子会 vol.8
snowwmn0824
0
200
Featured
See All Featured
How to Ace a Technical Interview
jacobian
280
24k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
350
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
250
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
4 Signs Your Business is Dying
shpigford
187
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
530
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
HDC tutorial
michielstock
2
930
Transcript
assert͙Β͍Ͱ ΤόϧΜ͡ΌͶ͑ʂ ʙPhan͕ͨΒ͢ݎ࿚ͳPHPʙ
ࣗݾհ ߴࢁԹ @edvakf ϐΫγϒגࣜձࣾ ࣥߦһ CTO ISUCON6ຊબग़͠·ͨ͠ JavaScript, PHP, Ruby,
Go, Scala ͋ͨΓ͕कඋൣғ
assertศརͰ͢Ͷ
function div($a, $b) { assert($b !== 0); return $a /
$b; }
assertͷ᠘
None
ʊਓਓਓਓਓਓʊ ʼɹΤϰΝϧɹʻ ʉ:?:?:?:?:ʉ
ͭ·Γ
͜͏ॻ͚Δ function div($a, $b) { assert(“{$b} !== 0”); return $a
/ $b; }
͜͏͢Δͱassertͷத͕ධՁ͞Εͳ͍ assert_options(ASSERT_ACTIVE, false); function div($a, $b) { assert(“{$b} !== 0”);
return $a / $b; }
pixivͷϙϦγʔͰɺ։ൃڥͱϓϩμΫγϣϯͷࠩ ҟͷ࠷খԽͷͨΊɺͰ͖ΕASSERT_ACTIVEΛfalse ʹͨ͘͠ͳ͍ assertʹ͞ΕΔ͕ʢকདྷʹͬͯʣ֎෦ೖྗʹ༝ དྷ͢ΔͰͳ͍͜ͱΛอূ͢Δͷඇৗʹࠔ ·ͨɺassert͕ग़ͯ͘Δͨͼʹ͞ΕΔ͕֎෦ೖྗ ༝དྷ͔Ͳ͏͔ΛϨϏϡʔͰݟΔඞཁ͕͋Γɺίετ ͕͔͔Δ
ͱ͍͏Θ͚Ͱ pixivͰಠࣗͷassertʹ૬͢ΔؔΛఆٛͯ͠ɺ PHPͷΈࠐΈͷassertΘͳ͘ͳΓ·ͨ͠
ΊͰͨ͠ΊͰͨ͠
Ͱͳ͘
ϨϏϡʔͷίετΛ্͛ͣʹ assertΛ͑ͳ͍͔ߟ͑ͯΈͨ
ҾΛboolඞਢʹ͍ͨ͠ assert($a === 1); // OK assert(empty($a)); // OK assert(!is_null($a));
// OK assert(“$b !== 1”); // NG assert(someFunction($a)); // ?
Phan ੩తղੳπʔϧ PHP7͔Βಋೖ͞Εͨ෦ASTΛPHPଆ͔Β৮ΕΔΑ ͏ʹ͢ΔͨΊͷphp-astͱ͍͏C֦ுʹґଘ
$ phan some.php some.php:5 PhanTypeMismatchArgumentInternal Argument 1 (assertion) is int
but \assert() takes bool|string PHPͷඪ४ؔͷҾͱฦΓͷܕͷҰཡΛ࣋ͬͯ ͍ͯɺܕਪͯ͘͠ΕΔ
assertͷҾ͕boolͰ͋Δ͜ ͱΛอূ͢Δʹ
→PhanϓϥάΠϯͰ % tree -a . !"" .phan # !"" config.php
# $"" plugins # $"" NonBoolAssertPlugin.php $"" some.php
None
$ phan some.php some.php:5 PhanPluginNonBoolAssert Non bool value passed to
assert some.php:5 PhanTypeMismatchArgumentInternal Argument 1 (assertion) is int but \assert() takes bool|string
·ͱΊ PhanͰ੩తղੳͯ͠ϨϏϡʔͷίετΛԼ͛Α͏ Phan͕௨Βͳ͚ΕCI͕௨Βͳ͍Α͏ʹ͠Α͏ PhanϓϥάΠϯͰಠࣗίʔσΟϯάنlintԽͯ͠ ϨϏϡʔ࣌ͷ҉ΛݮΒͦ͏
ฐࣾͷ৽ଔ͕ࣥච͠·ͨ͠