Replies: 6 comments 8 replies
-
ArrayShape. For intelligence. No reflection needed, as it is for IDE's |
Beta Was this translation helpful? Give feedback.
-
Got another use case. In my newly build package I have created an EncryptsData Attribute. The only moment it is used is when you rotate the encryption on your models where you have a mutator that handles encryption. You can also avoid it by creating a full cast object. https://packagist.org/packages/henzeb/laravel-encrypted-data-rotator I think its an exception to the rule. It is not affecting performance of your application when used in a command line or queue. |
Beta Was this translation helpful? Give feedback.
-
@henzeb a colleague found another use case. Open api generation of swagger documentation via attributes. It is under the same logic as is your example for one time command for encrypting data. |
Beta Was this translation helpful? Give feedback.
-
@henzeb bad news |
Beta Was this translation helpful? Give feedback.
-
@marius-mcp Starting from 8.4 Deprecated as well https://www.php.net/manual/en/class.deprecated.php |
Beta Was this translation helpful? Give feedback.
-
Starting from php 8.2 AllowDynamicProperties is another php attribute that might fall into this scenario. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since the introduction of attributes I always stated that they should be used only when they are the only option.
Finally I found one case when they are the only option (that I know of).
https://www.php.net/manual/en/class.override.php
Do you know other situations when the attributes would be the only option?
(side note: this attribute does not need reflection from what I see, it is embedded in php).
@henzeb said also: ArrayShape
@dmitrychurkin said: Deprecated
Beta Was this translation helpful? Give feedback.
All reactions