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
PHPのアノテーションの仕組みとメリット・デメリット / About PHP annotations
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
YAMAOKA Hiroyuki
February 09, 2020
Programming
9.8k
1
Share
PHPのアノテーションの仕組みとメリット・デメリット / About PHP annotations
2020年2月9日、PHPerKaigi 2020・Day 0での発表資料です。
https://phperkaigi.jp/2020/
YAMAOKA Hiroyuki
February 09, 2020
More Decks by YAMAOKA Hiroyuki
See All by YAMAOKA Hiroyuki
『タイタン』 - PHPer Book Revue
hiro_y
0
110
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
390
エンジニアの「センス」とは何か / What is the sense of engineers
hiro_y
21
9.9k
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
32
31k
PHPで任意精度演算を行って「正しい」金額計算をする方法 / Perform arbitrary precision arithmetic in PHP to achieve "accurate" monetary calculations
hiro_y
2
4.1k
PHPのバージョンアップ実際のところどうなの? / How actually upgrade of PHP is
hiro_y
3
850
PHPのDI、attributesとこれから / PHP DI with attributes
hiro_y
1
2.7k
株式会社 USEN Media - PHPカンファレンス北海道2019 / 2019-09-21_phpcondo-2019_usen-media
hiro_y
0
340
PHPのmiddlewareを 使いこなすために
hiro_y
4
2.7k
Other Decks in Programming
See All in Programming
今さら聞けないCancellationToken
htkym
0
180
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
240
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
720
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
630
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.6k
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
850
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
230
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
210
AWSはOSSをどのように 考えているのか?
akihisaikeda
1
140
Inside Stream API
skrb
1
130
Modding RubyKaigi for Myself
yui_knk
0
430
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
340
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5k
Practical Orchestrator
shlominoach
191
11k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
340
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
140
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
190
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
230
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
250
A designer walks into a library…
pauljervisheath
211
24k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
140
Transcript
PHP 2020 2 9 / PHPerKaigi Day
- / @hiro_y - PHP Node.js - PHP 3 -
- - CTO - - iruca mimemo -
PHP
- PHP 2019 - PHP middleware https://speakerdeck.com/hiro_y/phpfalsemiddlewarewo-shi-ikonasutameni - middleware PSR-
& -
- - - -
None
None
PHP /** * @param string $input * @param int $expectedLength
* @testWith ["test", 4]["longer-string", 13] */ public function testStringLength(string $input, int $expectedLength): void { $this->assertEquals($expectedLength, \strlen($input)); }
- - -
Java
Java : Javadoc /** * αϯϓϧΫϥε * @author Hiroyuki YAMAOKA
* @version 1.0 */ public class Sample { /** * @param width ෯ * @param height ߴ͞ */ public void setSize(int width, int height) { } }
Javadoc - javadoc API -
java.lang.Annotation - : - : XDoclet - Java SE java.lang.Annotation
-
: Servlet @WebServlet(urlPatterns = {"/hello"}) public class HelloServlet extends HttpServlet
{ @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ॲཧΛॻ͘… } }
:
Java annotation - AOP - annotation -
PHP
PHPDoc - phpDocumentator https://www.phpdoc.org/ - Javadoc PHP - PhpStorm IDE
- Phan PHPStan
: PHPDoc /** * ച্ֹΛܭࢉ͢Δɻ * * @param int $price
୯Ձ * @param int $unit ചΕͨݸ * @return int ച্ֹ */ public function int calcSales(int $price, int $unit): int {
: PSR- & - PSR- PHPDoc Standard (DRAFT) https://github.com/php- g/
g-standards/blob/master/proposed/phpdoc.md - PSR- PHPDoc tags (DRAFT) https://github.com/php- g/ g-standards/blob/master/proposed/phpdoc-tags.md
PSR- & - 2018 PHPDoc PSR- - Qiita https://qiita.com/tadsan/items/ b
d ca d - PSR- : PHPDoc tags - BASE https://devblog.thebase.in/entry/ / / /
PSR - PHPDoc - - IDE - PhpStorm Phan PHPStan
- DRAFT OK
- - PHPDoc: -
: PHPUnit - @test https://phpunit.readthedocs.io/en/ . /writing-tests-for-phpunit.html - @depends -
@before @after @beforeClass @afterClass - xture
: PHPUnit - @dataProvider - - @testWith - dataProvider
: Symfony (core) - Creating Routes as Annotations https://symfony.com/doc/current/routing.html#creating-routes-as- annotations
-
: SensioFrameworkExtraBundle - Symfony https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html
: LaravelCollective/annotations - Laravel https://github.com/laravelcollective/annotations
: BEAR.Sunday - Ray.DI Ray.Aop https://bearsunday.github.io/manuals/ . /ja/di.html
PHP - Re ection API https://www.php.net/manual/ja/book.re ection.php - Re ectionClass::getDocComment
- - : Doctrine/annotations https://github.com/doctrine/annotations
- PHP - - - Ray.Aop
- OK - - -
- - -
- - PHP - OPcache https://www.php.net/manual/ja/book.opcache.php - opcache.preload 7.4
None
: PHP DocComment
- : - :
None