PHP variable after class name (Class $var)

2729 views php

I'm sure there is somewhere an answer to my question, but since I don't know how it's called, it is hard to search for it.

In Laravel, there are methods that look like this:

public function edit(Post $post)

What does the Post in front of the $post variable do?

Thank in advance!

answered question

2 Answers


It's an object type hint definition. <- There you can find more informations.

posted this

Have an answer?


Please login first before posting an answer.