Time\Duration::__construct
(PHP 8 >= 8.6.0)
Time\Duration::__construct — Private constructor to disallow direct instantiation
Description
This private constructor prevents Time\Duration
objects from being created with new.
Use one of the factory methods instead, which make the unit of the given
value explicit:
Time\Duration::fromSeconds(),
Time\Duration::fromNanoseconds(),
Time\Duration::fromMicroseconds(),
Time\Duration::fromMilliseconds(),
Time\Duration::fromMinutes(),
Time\Duration::fromHours(), or
Time\Duration::fromIso8601DurationString().
Parameters
This function has no parameters.
Errors/Exceptions
Attempting to instantiate the class with new throws an
Error.
See Also
- Time\Duration::fromSeconds() - Creates a duration from a number of seconds and nanoseconds
- Time\Duration::fromIso8601DurationString() - Creates a duration from an ISO 8601 duration string
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
