Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
PHPのアノテーションの仕組みとメリット・デメリット / About PHP annotations
YAMAOKA Hiroyuki
February 09, 2020
Programming
1
5.3k
PHPのアノテーションの仕組みとメリット・デメリット / About PHP annotations
2020年2月9日、PHPerKaigi 2020・Day 0での発表資料です。
https://phperkaigi.jp/2020/
YAMAOKA Hiroyuki
February 09, 2020
Tweet
Share
More Decks by YAMAOKA Hiroyuki
See All by YAMAOKA Hiroyuki
PHPのバージョンアップ実際のところどうなの? / How actually upgrade of PHP is
hiro_y
2
480
PHPのDI、attributesとこれから / PHP DI with attributes
hiro_y
1
1.3k
株式会社 USEN Media - PHPカンファレンス北海道2019 / 2019-09-21_phpcondo-2019_usen-media
hiro_y
0
92
PHPのmiddlewareを 使いこなすために
hiro_y
3
1.9k
Slim Frameworkで始めるPHPのmiddleware
hiro_y
4
1.7k
Node.jsやPHPでも こわくないHeroku
hiro_y
1
1.3k
やりたいことがひとつではない会社のはなし
hiro_y
0
710
Other Decks in Programming
See All in Programming
OSSから学んだPR Descriptionの書き方
fugakkbn
4
140
子育てとEMと転職と
_atsushisakai
1
410
Qiita Night PHP 2023
fuwasegu
0
11k
2023年にクル(かもしれない)通信ミドルウェア技術(仮)
s_hosoai
0
220
How to Fight Production Incidents?
asatarin
0
210
tidy_rpart
bk_18
0
600
OIDC仕様に準拠した Makuake ID連携基盤構築の裏側
ymtdzzz
0
570
まだ日本国内で利用できないAppActionsにトライしてみた / MoT TechTalk #15
mot_techtalk
0
120
PHPアプリケーションにおけるアーキテクチャメトリクスについて / Architecture Metrics in PHP Applications
isanasan
1
270
良質な技術記事を量産する秘訣 / #MeetsPro
jnchito
11
3.6k
エンジニア向け会社紹介資料/engineer-recruiting-pitch
xmile
PRO
0
100
Zynq MP SoC で楽しむエッジコンピューティング ~RTLプログラミングのススメ~
ryuz88
0
380
Featured
See All Featured
How to name files
jennybc
47
73k
Art, The Web, and Tiny UX
lynnandtonic
284
18k
The Mythical Team-Month
searls
210
40k
Automating Front-end Workflow
addyosmani
1351
200k
The Straight Up "How To Draw Better" Workshop
denniskardys
226
130k
How to train your dragon (web standard)
notwaldorf
66
4.3k
Why Our Code Smells
bkeepers
PRO
326
55k
What’s in a name? Adding method to the madness
productmarketing
12
1.9k
Done Done
chrislema
178
14k
Designing for humans not robots
tammielis
245
24k
Adopting Sorbet at Scale
ufuk
65
7.8k
We Have a Design System, Now What?
morganepeng
37
5.9k
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