[PHP] PHP8 Static Return Type 미리 알아보기


[PHP] PHP8 Static Return Type 미리 알아보기

Static Return Type란? # "self"를 반환하는 것은 이미 가능했지만, "PHP8"에서 "static"은 유효한 반환 유형이 아니었습니다. PHP의 동적 유형 특성을 감안할 때 많은 개발자에게 유용한 기능입니다. class Foo { public function test(): static { return new static(); } } class Foo { public function test(): static { return $this; } } # 내용이 허술하여 보충 내용 필요(업데이트 예정)... 참고 링크 PHP: rfc:static_return_type PHP RFC: Static return type Date: 2020-01-08 Author: Nikita Popov [email protected] Target Version: PHP 8.0 Status: Implemented Implementation: https://github.com/php/php-src/pu...



원문링크 : [PHP] PHP8 Static Return Type 미리 알아보기