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
eBPF with PHPをさわる
chiroruxx
0
81
sl完全に理解したつもり
chiroruxx
0
75
命名をリントする
chiroruxx
1
680
良い命名かを調べるリンターを作った + α
chiroruxx
0
77
GoLandを布教する会
chiroruxx
0
23
PHPはいつから死んでいるかの調査
chiroruxx
3
610
元phperから見たGoの良いところ
chiroruxx
0
73
Go Connectへの想い
chiroruxx
0
440
GraphQLに入門してみた
chiroruxx
2
310
Other Decks in Technology
See All in Technology
OpenID Connect for Identity Assurance の概要と翻訳版のご紹介 / 20250219-BizDay17-OIDC4IDA-Intro
oidfj
0
470
デスクトップだけじゃないUbuntu
mtyshibata
0
690
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
1.2k
AWSアカウントのセキュリティ自動化、どこまで進める? 最適な設計と実践ポイント
yuobayashi
5
150
Autonomous Database Serverless 技術詳細 / adb-s_technical_detail_jp
oracle4engineer
PRO
17
45k
コンテナサプライチェーンセキュリティ
kyohmizu
1
130
ウォンテッドリーのデータパイプラインを支える ETL のための analytics, rds-exporter / analytics, rds-exporter for ETL to support Wantedly's data pipeline
unblee
0
110
AI Agent時代なのでAWSのLLMs.txtが欲しい!
watany
2
170
データエンジニアリング領域におけるDuckDBのユースケース
chanyou0311
7
2k
脳波を用いた嗜好マッチングシステム
hokkey621
0
280
EDRの検知の仕組みと検知回避について
chayakonanaika
11
4.3k
AWSではじめる Web APIテスト実践ガイド / A practical guide to testing Web APIs on AWS
yokawasa
5
260
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.6k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Building an army of robots
kneath
303
45k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
Facilitating Awesome Meetings
lara
52
6.2k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Making Projects Easy
brettharned
116
6k
Building Your Own Lightsaber
phodgson
104
6.2k
Why Our Code Smells
bkeepers
PRO
336
57k
Building Adaptive Systems
keathley
40
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
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®依存 – ドキュメントが少ない – 細かい設定ができない ▪ アルファ版なので、今後を見守りたいですね