Welcome Guest, Not a member yet? Register   Sign In
Using ::class in Model's $returnType instead of string - bad?
#1

Before I go abound and create a PR for a documentation change, I have to ask if I have misunderstood something.
I am refactoring my CI 4.1.9 project in PHPstorm and found out that
PHP Code:
protected $returnType App\Entities\SomeEntity::class; 
 is an excellent way of writing this instead of specifying this as a string 
PHP Code:
protected $returnType 'App\Entities\SomeEntity'

As I read it from the documentation, "::class" expands at compile time so it can't be for performance reasons - https://www.php.net/manual/en/language.oop5.basic.php
What am I missing?
/Mattias
Reply


Messages In This Thread
Using ::class in Model's $returnType instead of string - bad? - by tgix - 06-15-2022, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB