We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a682aa commit b485207Copy full SHA for b485207
Cmfcmf/OpenWeatherMap/Util/Sun.php
@@ -37,10 +37,14 @@ class Sun
37
* @param \DateTime $rise The time of the sun rise
38
* @param \DateTime $set The time of the sun set.
39
*
40
+ * @throws \LogicException If sunset is before sunrise.
41
* @internal
42
*/
43
public function __construct(\DateTime $rise, \DateTime $set)
44
{
45
+ if ($set < $rise) {
46
+ throw new \LogicException('Sunset cannot be before sunrise!');
47
+ }
48
$this->rise = $rise;
49
$this->set = $set;
50
}
0 commit comments