Skip to content

Commit

Permalink
Add support for PHP 8.3 and 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Dec 18, 2024
1 parent 6749f45 commit 7705102
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 74 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/buildcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
composer:
- ""
- "--prefer-lowest"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Changelog

--------

## 2.2.6 - 2024-12-18

### Changed

* [Support] Added support for PHP 8.3 and 8.4.

--------

## 2.2.5 - 2024-12-18

### Changed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"phpstan/phpstan-mockery": "^0.12.14",
"phpstan/phpstan-phpunit": "^0.12.22",
"squizlabs/php_codesniffer": "^3.6",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {"duncan3dc\\Sonos\\": "src/"}
Expand Down
40 changes: 20 additions & 20 deletions src/Alarm.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ public function setFrequency(int $frequency): AlarmInterface
* Check or set whether this alarm is active on a particular day.
*
* @param int $day Which day to check/set
* @param bool $set Set this alarm to be active or not on the specified day
* @param ?bool $set Set this alarm to be active or not on the specified day
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
protected function onHandler(int $day, bool $set = null)
protected function onHandler(int $day, ?bool $set = null)
{
$frequency = $this->getFrequency();
if ($set === null) {
Expand All @@ -293,11 +293,11 @@ protected function onHandler(int $day, bool $set = null)
/**
* Check or set whether this alarm is active on mondays.
*
* @param bool $set Set this alarm to be active or not on mondays
* @param ?bool $set Set this alarm to be active or not on mondays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onMonday(bool $set = null)
public function onMonday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::MONDAY, $set);
}
Expand All @@ -306,11 +306,11 @@ public function onMonday(bool $set = null)
/**
* Check or set whether this alarm is active on tuesdays.
*
* @param bool $set Set this alarm to be active or not on tuesdays
* @param ?bool $set Set this alarm to be active or not on tuesdays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onTuesday(bool $set = null)
public function onTuesday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::TUESDAY, $set);
}
Expand All @@ -319,11 +319,11 @@ public function onTuesday(bool $set = null)
/**
* Check or set whether this alarm is active on wednesdays.
*
* @param bool $set Set this alarm to be active or not on wednesdays
* @param ?bool $set Set this alarm to be active or not on wednesdays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onWednesday(bool $set = null)
public function onWednesday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::WEDNESDAY, $set);
}
Expand All @@ -332,11 +332,11 @@ public function onWednesday(bool $set = null)
/**
* Check or set whether this alarm is active on thursdays.
*
* @param bool $set Set this alarm to be active or not on thursdays
* @param ?bool $set Set this alarm to be active or not on thursdays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onThursday(bool $set = null)
public function onThursday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::THURSDAY, $set);
}
Expand All @@ -345,11 +345,11 @@ public function onThursday(bool $set = null)
/**
* Check or set whether this alarm is active on fridays.
*
* @param bool $set Set this alarm to be active or not on fridays
* @param ?bool $set Set this alarm to be active or not on fridays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onFriday(bool $set = null)
public function onFriday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::FRIDAY, $set);
}
Expand All @@ -358,11 +358,11 @@ public function onFriday(bool $set = null)
/**
* Check or set whether this alarm is active on saturdays.
*
* @param bool $set Set this alarm to be active or not on saturdays
* @param ?bool $set Set this alarm to be active or not on saturdays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onSaturday(bool $set = null)
public function onSaturday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::SATURDAY, $set);
}
Expand All @@ -371,11 +371,11 @@ public function onSaturday(bool $set = null)
/**
* Check or set whether this alarm is active on sundays.
*
* @param bool $set Set this alarm to be active or not on sundays
* @param ?bool $set Set this alarm to be active or not on sundays
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function onSunday(bool $set = null)
public function onSunday(?bool $set = null)
{
return $this->onHandler(AlarmInterface::SUNDAY, $set);
}
Expand All @@ -384,11 +384,11 @@ public function onSunday(bool $set = null)
/**
* Check or set whether this alarm is a one time only alarm.
*
* @param bool $set Set this alarm to be a one time only alarm
* @param ?bool $set Set this alarm to be a one time only alarm
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function once(bool $set = null)
public function once(?bool $set = null)
{
if ($set) {
return $this->setFrequency(AlarmInterface::ONCE);
Expand All @@ -400,11 +400,11 @@ public function once(bool $set = null)
/**
* Check or set whether this alarm runs every day or not.
*
* @param bool $set Set this alarm to be active every day
* @param ?bool $set Set this alarm to be active every day
*
* @return bool|AlarmInterface Returns true/false when checking, or AlarmInterface when setting
*/
public function daily(bool $set = null)
public function daily(?bool $set = null)
{
if ($set) {
return $this->setFrequency(AlarmInterface::DAILY);
Expand Down
8 changes: 4 additions & 4 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ public function useStream(Stream $stream): ControllerInterface
*
* If no speaker is passed then the current controller's is used.
*
* @param SpeakerInterface|null $speaker The speaker to get the line-in from
* @param ?SpeakerInterface $speaker The speaker to get the line-in from
*
* @return static
*/
public function useLineIn(SpeakerInterface $speaker = null): ControllerInterface
public function useLineIn(?SpeakerInterface $speaker = null): ControllerInterface
{
if ($speaker === null) {
$speaker = $this;
Expand Down Expand Up @@ -649,11 +649,11 @@ public function restoreState(ControllerStateInterface $state): ControllerInterfa
* This is useful for making announcements over the Sonos network.
*
* @param UriInterface $track The track to play
* @param int $volume The volume to play the track at
* @param ?int $volume The volume to play the track at
*
* @return $this
*/
public function interrupt(UriInterface $track, int $volume = null): ControllerInterface
public function interrupt(UriInterface $track, ?int $volume = null): ControllerInterface
{
/**
* Ensure the track has been generated.
Expand Down
4 changes: 2 additions & 2 deletions src/Devices/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ final class Collection implements CollectionInterface
/**
* Create a new instance.
*
* @param FactoryInterface $factory The factory to create new devices from
* @param ?FactoryInterface $factory The factory to create new devices from
*/
public function __construct(FactoryInterface $factory = null)
public function __construct(?FactoryInterface $factory = null)
{
if ($factory === null) {
$factory = new Factory();
Expand Down
6 changes: 3 additions & 3 deletions src/Devices/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ final class Device implements DeviceInterface
* Create an instance of the Device class.
*
* @param string $ip The ip address that the device is listening on
* @param CacheInterface $cache The cache object to use for finding Sonos devices on the network
* @param LoggerInterface $logger A logging object
* @param ?CacheInterface $cache The cache object to use for finding Sonos devices on the network
* @param ?LoggerInterface $logger A logging object
*/
public function __construct(string $ip, CacheInterface $cache = null, LoggerInterface $logger = null)
public function __construct(string $ip, ?CacheInterface $cache = null, ?LoggerInterface $logger = null)
{
$this->ip = $ip;

Expand Down
4 changes: 2 additions & 2 deletions src/Devices/Discovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ final class Discovery implements CollectionInterface
/**
* Create a new instance.
*
* @param CollectionInterface $collection The device collection to actually use
* @param ?CollectionInterface $collection The device collection to actually use
*/
public function __construct(CollectionInterface $collection = null)
public function __construct(?CollectionInterface $collection = null)
{
if ($collection === null) {
$collection = new Collection();
Expand Down
6 changes: 3 additions & 3 deletions src/Devices/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ final class Factory implements FactoryInterface
/**
* Create a new instance.
*
* @param CacheInterface $cache The cache object to use for finding Sonos devices on the network
* @param LoggerInterface $logger A logging object
* @param ?CacheInterface $cache The cache object to use for finding Sonos devices on the network
* @param ?LoggerInterface $logger A logging object
*/
public function __construct(CacheInterface $cache = null, LoggerInterface $logger = null)
public function __construct(?CacheInterface $cache = null, ?LoggerInterface $logger = null)
{
if ($cache === null) {
$cache = new ArrayPool();
Expand Down
4 changes: 2 additions & 2 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ public static function setMode(array $options): string
* @param string $id The ID of the track
* @param string $parent The ID of the parent
* @param array<string, mixed> $extra An xml array of extra attributes for this item
* @param string $service The Sonos service ID to use
* @param ?string $service The Sonos service ID to use
*
* @return string
*/
public static function createMetaDataXml(
string $id,
string $parent = "-1",
array $extra = [],
string $service = null
?string $service = null
): string {
if ($service !== null) {
$extra["desc"] = [
Expand Down
36 changes: 18 additions & 18 deletions src/Interfaces/AlarmInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,91 +126,91 @@ public function setFrequency(int $frequency): AlarmInterface;
/**
* Check or set whether this alarm is active on mondays.
*
* @param bool $set Set this alarm to be active or not on mondays
* @param ?bool $set Set this alarm to be active or not on mondays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onMonday(bool $set = null);
public function onMonday(?bool $set = null);


/**
* Check or set whether this alarm is active on tuesdays.
*
* @param bool $set Set this alarm to be active or not on tuesdays
* @param ?bool $set Set this alarm to be active or not on tuesdays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onTuesday(bool $set = null);
public function onTuesday(?bool $set = null);


/**
* Check or set whether this alarm is active on wednesdays.
*
* @param bool $set Set this alarm to be active or not on wednesdays
* @param ?bool $set Set this alarm to be active or not on wednesdays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onWednesday(bool $set = null);
public function onWednesday(?bool $set = null);


/**
* Check or set whether this alarm is active on thursdays.
*
* @param bool $set Set this alarm to be active or not on thursdays
* @param ?bool $set Set this alarm to be active or not on thursdays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onThursday(bool $set = null);
public function onThursday(?bool $set = null);


/**
* Check or set whether this alarm is active on fridays.
*
* @param bool $set Set this alarm to be active or not on fridays
* @param ?bool $set Set this alarm to be active or not on fridays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onFriday(bool $set = null);
public function onFriday(?bool $set = null);


/**
* Check or set whether this alarm is active on saturdays.
*
* @param bool $set Set this alarm to be active or not on saturdays
* @param ?bool $set Set this alarm to be active or not on saturdays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onSaturday(bool $set = null);
public function onSaturday(?bool $set = null);


/**
* Check or set whether this alarm is active on sundays.
*
* @param bool $set Set this alarm to be active or not on sundays
* @param ?bool $set Set this alarm to be active or not on sundays
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function onSunday(bool $set = null);
public function onSunday(?bool $set = null);


/**
* Check or set whether this alarm is a one time only alarm.
*
* @param bool $set Set this alarm to be a one time only alarm
* @param ?bool $set Set this alarm to be a one time only alarm
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function once(bool $set = null);
public function once(?bool $set = null);


/**
* Check or set whether this alarm runs every day or not.
*
* @param bool $set Set this alarm to be active every day
* @param ?bool $set Set this alarm to be active every day
*
* @return bool|static Returns true/false when checking, or static when setting
*/
public function daily(bool $set = null);
public function daily(?bool $set = null);


/**
Expand Down
Loading

0 comments on commit 7705102

Please sign in to comment.