Skip to content
Advertisement

Annotations: How to specify timestamps in docblocks in php

I have a mehtod that returns timestamps. I want to do something like this:

JavaScript

However, I don’t think @return array<int, timestamp> is valid.

What is the valid format for specifying timestamps in docblocks?

Advertisement

Answer

You can use int[], there is no valid value for timestamps. You can however create a ValueObject.

JavaScript

If you use a value object:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement