These are the elements of your php docblock that let other developers know about the type that you expect a function or method parameter to be. Here’s an example: @param array $array in the first function above is the type hint for the array parameter.

As a developer, you have to make a choice about how you want to deal with type safety.

The advantage of doing this over doing nothing is that you don’t have to worry about the type of your parameters.

The point of this article and the example was to show that type safety isn’t a binary decision in the WordPress world.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners