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
Prettier
Search
chiroruxx
April 25, 2018
Technology
0
130
Prettier
chiroruxx
April 25, 2018
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
Go Connectへの想い
chiroruxx
0
170
eBPF with PHPをさわる
chiroruxx
0
120
sl完全に理解したつもり
chiroruxx
0
100
命名をリントする
chiroruxx
1
790
良い命名かを調べるリンターを作った + α
chiroruxx
0
110
GoLandを布教する会
chiroruxx
0
37
PHPはいつから死んでいるかの調査
chiroruxx
3
650
元phperから見たGoの良いところ
chiroruxx
0
94
Go Connectへの想い
chiroruxx
0
480
Other Decks in Technology
See All in Technology
オフィスビルを監視しよう:フィジカル×デジタルにまたがるSLI/SLO設計と運用の難しさ / Monitoring Office Buildings: The Challenge of Physical-Digital SLI/SLO Design & Operation
bitkey
1
290
Getting to Know Your Legacy (System) with AI-Driven Software Archeology (WeAreDevelopers World Congress 2025)
feststelltaste
1
180
United Airlines Customer Service– Call 1-833-341-3142 Now!
airhelp
0
170
大量配信システムにおけるSLOの実践:「見えない」信頼性をSLOで可視化
plaidtech
PRO
0
260
PO初心者が考えた ”POらしさ”
nb_rady
0
220
SEQUENCE object comparison - db tech showcase 2025 LT2
nori_shinoda
0
270
[SRE NEXT] ARR150億円_エンジニア140名_27チーム_17プロダクトから始めるSLO.pdf
satos
3
1.7k
Enhancing SaaS Product Reliability and Release Velocity through Optimized Testing Approach
ropqa
1
250
VS CodeとGitHub Copilotで爆速開発!アップデートの波に乗るおさらい会 / Rapid Development with VS Code and GitHub Copilot: Catch the Latest Wave
yamachu
2
290
CDK Toolkit Libraryにおけるテストの考え方
smt7174
1
360
サイバーエージェントグループのSRE10年の歩みとAI時代の生存戦略
shotatsuge
4
700
事例で学ぶ!B2B SaaSにおけるSREの実践例/SRE for B2B SaaS: A Real-World Case Study
bitkey
1
270
Featured
See All Featured
Writing Fast Ruby
sferik
628
62k
Being A Developer After 40
akosma
90
590k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
980
Six Lessons from altMBA
skipperchong
28
3.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Visualization
eitanlees
146
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
The Language of Interfaces
destraynor
158
25k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Raft: Consensus for Rubyists
vanstee
140
7k
Transcript
PRETTIER PHP勉強会@東京 前田 和人
自己紹介 ▪ 前田 和人 ▪ @chiroruxxxx ▪ 弁護士ドットコム株式会社 ▪ Android派
None
Prettierってなに
Prettierとは? ▪ JavaScript®界隈で有名なコードフォーマッター ▪ Gopherの人はgofmtを思い浮かべてくれるといいです ▪ それのPHP版が出たという話
インストール $ yarn add --dev prettier/prettier @prettier/plugin-php ▪ これだけ!
実行 ▪ $ yarn run prettier /path/to/file –write ▪ Writeオプションがない場合は結果が出力されて終わる
▪ Writeオプションがある場合はファイルが書き換わる
使用例 <?php $indent = function () { return 2; };
<?php $indent=function(){return 2;};
php-cbfやphp-cs-fixerで 良いのでは
他ツールとの違い ▪ php-cbf・php-cs-fixer – PSRなどの様々なコーディング規約に則っているかを チェックする – 多くのオプションがあり独自カスタマイズ可能 – 違反をチェックしてくれる
▪ pritter – 対応しているものはPSR-1, PSR-2, PSR-12のみ – なるべくオプションを制限 – 違反という概念がない
その他の魅力 ▪ 長い行の自動改行 <?php $result = preg_match('@.*/ab.@', 'tooLongStriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing!'); <?php $result
= preg_match( '@.*/ab.@', 'tooLongStriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing!' );
その他の魅力 ▪ 無駄なスペースの除去 <?php $a = 'b’; <?php $a =
'b';
まとめ ▪ 良い – 細かい部分までフォーマットしてくれる – 設定がほぼ要らない ▪ 悪い –
JavaScript®依存 – ドキュメントが少ない – 細かい設定ができない ▪ アルファ版なので、今後を見守りたいですね