Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"phpstan/extension-installer": "^1.4",
"phpunit/phpunit": "^11.5",
"phpunit/php-invoker" : "^5.0",
"rector/rector": "^2.4"
"rector/rector": "^2.6"
},
"suggest" : {
"hoa/bench" : "If you would like to run the benchmark scripts"
Expand Down
4 changes: 1 addition & 3 deletions lib/Component/VCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,7 @@ public function xmlSerialize(Xml\Writer $writer): void
foreach ($this->children() as $property) {
$group = $property->group;

if (!isset($propertiesByGroup[$group])) {
$propertiesByGroup[$group] = [];
}
$propertiesByGroup[$group] ??= [];

$propertiesByGroup[$group][] = $property;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/DateTimeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public static function parseDate(string $date, ?\DateTimeZone $tz = null): \Date
throw new InvalidDataException('The supplied iCalendar date value is incorrect: '.$date);
}

if (is_null($tz)) {
$tz = new \DateTimeZone('UTC');
}
$tz ??= new \DateTimeZone('UTC');

try {
$date = new \DateTimeImmutable($matches[1].'-'.$matches[2].'-'.$matches[3], $tz);
Expand Down
12 changes: 3 additions & 9 deletions lib/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ public function createComponent(string $name, ?array $children = null, bool $def
if (isset(static::$componentMap[$name])) {
$class = static::$componentMap[$name];
}
if (is_null($children)) {
$children = [];
}
$children ??= [];

return new $class($this, $name, $children, $defaults);
}
Expand Down Expand Up @@ -200,13 +198,9 @@ public function createProperty(string $name, $value = null, ?array $parameters =
// we do not attempt to interpret or parse the datass value as specified in
// https://datatracker.ietf.org/doc/html/rfc5545#section-3.2.20
// So when we so far did not get a class-name, we use the default for the property
if (is_null($class)) {
$class = $this->getClassNameForPropertyName($name);
}
$class ??= $this->getClassNameForPropertyName($name);

if (is_null($parameters)) {
$parameters = [];
}
$parameters ??= [];

return new $class($this, $name, $value, $parameters, $group, $lineIndex, $lineString);
}
Expand Down
4 changes: 1 addition & 3 deletions lib/FreeBusyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ public function __construct(?\DateTimeInterface $start = null, ?\DateTimeInterfa
if ($objects) {
$this->setObjects($objects);
}
if (is_null($timeZone)) {
$timeZone = new \DateTimeZone('UTC');
}
$timeZone ??= new \DateTimeZone('UTC');
$this->setTimeZone($timeZone);
}

Expand Down
4 changes: 1 addition & 3 deletions lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,7 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,

// We're adding PARTSTAT=NEEDS-ACTION to ensure that
// iOS shows an "Inbox Item"
if (!isset($currentEventAttendee['PARTSTAT'])) {
$currentEventAttendee['PARTSTAT'] = 'NEEDS-ACTION';
}
$currentEventAttendee['PARTSTAT'] ??= 'NEEDS-ACTION';
}
}

Expand Down
8 changes: 2 additions & 6 deletions lib/Parser/MimeDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,7 @@ protected function readProperty(string $line)
}
if (isset($match['paramName'])) {
$lastParam = strtoupper($match['paramName']);
if (!isset($property['parameters'][$lastParam])) {
$property['parameters'][$lastParam] = null;
}
$property['parameters'][$lastParam] ??= null;
$lastToken = self::TOKEN_PARAMNAME;
continue;
}
Expand All @@ -440,9 +438,7 @@ protected function readProperty(string $line)
// @codeCoverageIgnoreEnd
}

if (\is_null($property['value'])) {
$property['value'] = '';
}
$property['value'] ??= '';
if (!isset($property['name']) || 0 === strlen($property['name'])) {
if ($this->options & self::OPTION_IGNORE_INVALID_LINES) {
return false;
Expand Down
4 changes: 1 addition & 3 deletions lib/Recur/EventIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ class EventIterator implements \Iterator
*/
public function __construct($input, ?string $uid = null, ?\DateTimeZone $timeZone = null)
{
if (is_null($timeZone)) {
$timeZone = new \DateTimeZone('UTC');
}
$timeZone ??= new \DateTimeZone('UTC');
$this->timeZone = $timeZone;

if (is_array($input)) {
Expand Down
4 changes: 1 addition & 3 deletions lib/TimeZoneUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ private function __construct()

private static function getInstance(): self
{
if (null === self::$instance) {
self::$instance = new self();
}
self::$instance ??= new self();

return self::$instance;
}
Expand Down