Skip to content

Commit

Permalink
Fix Implicitly marking parameter $param as nullable is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Sep 4, 2024
1 parent 7148cf5 commit 0795cd7
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/Component/VCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function getBaseComponent($componentName = null)
*
* @return VCalendar
*/
public function expand(DateTimeInterface $start, DateTimeInterface $end, DateTimeZone $timeZone = null)
public function expand(DateTimeInterface $start, DateTimeInterface $end, ?DateTimeZone $timeZone = null)
{
$newChildren = [];
$recurringEvents = [];
Expand Down
4 changes: 2 additions & 2 deletions lib/DateTimeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DateTimeParser
*
* @return DateTimeImmutable
*/
public static function parseDateTime($dt, DateTimeZone $tz = null)
public static function parseDateTime($dt, ?DateTimeZone $tz = null)
{
// Format is YYYYMMDD + "T" + hhmmss
$result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/', $dt, $matches);
Expand Down Expand Up @@ -61,7 +61,7 @@ public static function parseDateTime($dt, DateTimeZone $tz = null)
*
* @return DateTimeImmutable
*/
public static function parseDate($date, DateTimeZone $tz = null)
public static function parseDate($date, ?DateTimeZone $tz = null)
{
// Format is YYYYMMDD
$result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches);
Expand Down
4 changes: 2 additions & 2 deletions lib/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function create($name)
*
* @return Component
*/
public function createComponent($name, array $children = null, $defaults = true)
public function createComponent($name, ?array $children = null, $defaults = true)
{
$name = strtoupper($name);
$class = Component::class;
Expand Down Expand Up @@ -187,7 +187,7 @@ public function createComponent($name, array $children = null, $defaults = true)
* @param array $parameters
* @param string $valueType Force a specific valuetype, such as URI or TEXT
*/
public function createProperty($name, $value = null, array $parameters = null, $valueType = null, int $lineIndex = null, string $lineString = null): Property
public function createProperty($name, $value = null, ?array $parameters = null, $valueType = null, ?int $lineIndex = null, ?string $lineString = null): Property
{
// If there's a . in the name, it means it's prefixed by a groupname.
if (false !== ($i = strpos($name, '.'))) {
Expand Down
4 changes: 2 additions & 2 deletions lib/FreeBusyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class FreeBusyGenerator
* @param mixed $objects
* @param DateTimeZone $timeZone
*/
public function __construct(DateTimeInterface $start = null, DateTimeInterface $end = null, $objects = null, DateTimeZone $timeZone = null)
public function __construct(?DateTimeInterface $start = null, ?DateTimeInterface $end = null, $objects = null, ?DateTimeZone $timeZone = null)
{
$this->setTimeRange($start, $end);

Expand Down Expand Up @@ -158,7 +158,7 @@ public function setObjects($objects)
* @param DateTimeInterface $start
* @param DateTimeInterface $end
*/
public function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null)
public function setTimeRange(?DateTimeInterface $start = null, ?DateTimeInterface $end = null)
{
if (!$start) {
$start = new DateTimeImmutable(Settings::$minDate);
Expand Down
10 changes: 5 additions & 5 deletions lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Broker
*
* @return VCalendar|null
*/
public function processMessage(Message $itipMessage, VCalendar $existingObject = null)
public function processMessage(Message $itipMessage, ?VCalendar $existingObject = null)
{
// We only support events at the moment.
if ('VEVENT' !== $itipMessage->component) {
Expand Down Expand Up @@ -266,7 +266,7 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null)
*
* @return VCalendar|null
*/
protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null)
protected function processMessageRequest(Message $itipMessage, ?VCalendar $existingObject = null)
{
if (!$existingObject) {
// This is a new invite, and we're just going to copy over
Expand Down Expand Up @@ -301,7 +301,7 @@ protected function processMessageRequest(Message $itipMessage, VCalendar $existi
*
* @return VCalendar|null
*/
protected function processMessageCancel(Message $itipMessage, VCalendar $existingObject = null)
protected function processMessageCancel(Message $itipMessage, ?VCalendar $existingObject = null)
{
if (!$existingObject) {
// The event didn't exist in the first place, so we're just
Expand All @@ -326,7 +326,7 @@ protected function processMessageCancel(Message $itipMessage, VCalendar $existin
*
* @return VCalendar|null
*/
protected function processMessageReply(Message $itipMessage, VCalendar $existingObject = null)
protected function processMessageReply(Message $itipMessage, ?VCalendar $existingObject = null)
{
// A reply can only be processed based on an existing object.
// If the object is not available, the reply is ignored.
Expand Down Expand Up @@ -807,7 +807,7 @@ protected function parseEventForAttendee(VCalendar $calendar, array $eventInfo,
*
* @return array
*/
protected function parseEventInfo(VCalendar $calendar = null)
protected function parseEventInfo(?VCalendar $calendar = null)
{
$uid = null;
$organizer = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract class Property extends Node
* @param array $parameters List of parameters
* @param string $group The vcard property group
*/
public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null, int $lineIndex = null, string $lineString = null)
public function __construct(Component $root, $name, $value = null, array $parameters = [], $group = null, ?int $lineIndex = null, ?string $lineString = null)
{
$this->name = $name;
$this->group = $group;
Expand Down
4 changes: 2 additions & 2 deletions lib/Property/ICalendar/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function isFloating()
*
* @return \DateTimeImmutable
*/
public function getDateTime(DateTimeZone $timeZone = null)
public function getDateTime(?DateTimeZone $timeZone = null)
{
$dt = $this->getDateTimes($timeZone);
if (!$dt) {
Expand All @@ -153,7 +153,7 @@ public function getDateTime(DateTimeZone $timeZone = null)
* @return \DateTimeImmutable[]
* @return \DateTime[]
*/
public function getDateTimes(DateTimeZone $timeZone = null)
public function getDateTimes(?DateTimeZone $timeZone = null)
{
// Does the property have a TZID?
$tzid = $this['TZID'];
Expand Down
2 changes: 1 addition & 1 deletion lib/Recur/EventIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class EventIterator implements \Iterator
* @param DateTimeZone $timeZone reference timezone for floating dates and
* times
*/
public function __construct($input, $uid = null, DateTimeZone $timeZone = null)
public function __construct($input, $uid = null, ?DateTimeZone $timeZone = null)
{
if (is_null($timeZone)) {
$timeZone = new DateTimeZone('UTC');
Expand Down
4 changes: 2 additions & 2 deletions lib/TimeZoneUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private function addFinder(string $key, TimezoneFinder $finder): void
* Alternatively, if $failIfUncertain is set to true, it will throw an
* exception if we cannot accurately determine the timezone.
*/
private function findTimeZone(string $tzid, Component $vcalendar = null, bool $failIfUncertain = false): DateTimeZone
private function findTimeZone(string $tzid, ?Component $vcalendar = null, bool $failIfUncertain = false): DateTimeZone
{
foreach ($this->timezoneFinders as $timezoneFinder) {
$timezone = $timezoneFinder->find($tzid, $failIfUncertain);
Expand Down Expand Up @@ -126,7 +126,7 @@ public static function addTimezoneFinder(string $key, TimezoneFinder $finder): v
*
* @return DateTimeZone
*/
public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
public static function getTimeZone($tzid, ?Component $vcalendar = null, $failIfUncertain = false)
{
return self::getInstance()->findTimeZone($tzid, $vcalendar, $failIfUncertain);
}
Expand Down

0 comments on commit 0795cd7

Please sign in to comment.