[PHP] PHP8 Attributes 미리 알아보기


[PHP] PHP8 Attributes 미리 알아보기

Attributes란? https://365ok.co.kr/tj/okdown/7046 # Attributes는 "주석"이라고도 하는 이러한 속성의 목적은 메타데이터를 클래스, 메서드, 변수 등에 체계적으로 추가하는 것입니다. # 즉, 기존에 사용하던 "PHP DocBlock" 방식인 주석을 기억하시나요? 예로들면 아래와 같은 겁니다. /** * @Route("/about") */ # 위의 주석은 실제로 실행되지는 않지만, "Reflection API" 제공하여 주석을 편리하게 검색 할 수 있습니다. 위의 주석을 아래와 같이 바꿀 수 있습니다. <<Route('/about')>> 쉬운 예제 https://365ok.co.kr/tj/okdown/7046 class AboutPage extends AbstractController { /** * @Route("/about") */ public function page() {} } => class AboutPage extends Abstra...


#attributes #php #php8 #주석

원문링크 : [PHP] PHP8 Attributes 미리 알아보기