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
YAMAOKA Hiroyuki
February 09, 2020
Programming
10k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
160
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
450
エンジニアの「センス」とは何か / What is the sense of engineers
hiro_y
21
10k
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.3k
PHPのバージョンアップ実際のところどうなの? / How actually upgrade of PHP is
hiro_y
3
880
PHPのDI、attributesとこれから / PHP DI with attributes
hiro_y
1
2.8k
株式会社 USEN Media - PHPカンファレンス北海道2019 / 2019-09-21_phpcondo-2019_usen-media
hiro_y
0
350
PHPのmiddlewareを 使いこなすために
hiro_y
4
2.7k
Other Decks in Programming
See All in Programming
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.2k
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
130
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.4k
MySQLとPostgreSQLって何が違うの?
akagami
0
150
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
260
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.9k
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
280
ALB ログから Trace を気合で繋げる技術
fohte
7
840
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
260
[GopherCon 2026] Unlocking Real-World Go Mutex Usage Patterns by Writing a Mutex Linter
palkan
0
100
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
800
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
150
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
260
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Navigating Team Friction
lara
192
16k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
Statistics for Hackers
jakevdp
799
230k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Done Done
chrislema
186
16k
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