Skip to content

Fixes deprecations errors on php 8.1 #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cmfcmf/OpenWeatherMap/CurrentWeatherGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function __construct(\stdClass $json, $units)
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
Expand All @@ -63,6 +64,7 @@ public function rewind()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->currentWeathers[$this->position];
Expand All @@ -71,6 +73,7 @@ public function current()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->current()->city->id;
Expand All @@ -79,6 +82,7 @@ public function key()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
Expand All @@ -87,6 +91,7 @@ public function next()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->currentWeathers[$this->position]);
Expand Down
2 changes: 1 addition & 1 deletion Cmfcmf/OpenWeatherMap/Forecast.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(\SimpleXMLElement $xml, $units)
$this->clouds = new Unit($xml->clouds['all'], $xml->clouds['unit'], $xml->clouds['value']);
$this->precipitation = new Unit($xml->precipitation['value'], null, $xml->precipitation['type']);
$this->weather = new Weather($xml->symbol['number'], $xml->symbol['name'], $xml->symbol['var']);
$this->lastUpdate = new \DateTime($xml->lastupdate['value'], $utctz);
$this->lastUpdate = new \DateTime($xml->lastupdate['value'] ?? 'now', $utctz);

if (isset($xml['from'])) {
$this->time = new Time($xml['from'], $xml['to']);
Expand Down
1 change: 1 addition & 0 deletions Cmfcmf/OpenWeatherMap/Util/Unit.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public function getFormatted()
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return [
Expand Down
5 changes: 5 additions & 0 deletions Cmfcmf/OpenWeatherMap/WeatherForecast.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function __construct($xml, $units, $days)
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
Expand All @@ -107,6 +108,7 @@ public function rewind()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->forecasts[$this->position];
Expand All @@ -115,6 +117,7 @@ public function current()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -123,6 +126,7 @@ public function key()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
Expand All @@ -131,6 +135,7 @@ public function next()
/**
* @internal
*/
#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->forecasts[$this->position]);
Expand Down