Traits do become part of the object when they are used in a class. It's helpful that the documentation lists them because each of these traits has additional methods and properties that are available to the class. Without listing them, you wouldn't know about these methods and properties.
Jun 9, 2018
2
Level 1
traits in laravel
My understanding of PHP traits are they are like snippets of code which can be inserted using a use statement inside of a class and the effect is as if you had copy/pasted the code in at the point. The same as if you use include() or require()
so why is it that some of the laravel API documentation pages list traits associated with classes? example https://laravel.com/api/5.6/Illuminate/Database/Eloquent/Model.html
listing methods and properties makes sense because these things are a part of an object. traits however are not
Please or to participate in this conversation.