Skip to content

Commit

Permalink
Merge pull request #620 from phil-davis/cs-fixer-20230628
Browse files Browse the repository at this point in the history
Apply cs-fixer changes
  • Loading branch information
phil-davis committed Jun 28, 2023
2 parents 198196c + d152c68 commit ac56915
Show file tree
Hide file tree
Showing 28 changed files with 70 additions and 105 deletions.
4 changes: 0 additions & 4 deletions lib/BirthdayCalendarGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class BirthdayCalendarGenerator
*
* Check the setTimeRange and setObjects methods for details about the
* arguments.
*
* @param mixed $objects
*/
public function __construct($objects = null)
{
Expand All @@ -49,8 +47,6 @@ public function __construct($objects = null)
*
* You must either supply a vCard as a string or as a Component/VCard object.
* It's also possible to supply an array of strings or objects.
*
* @param mixed $objects
*/
public function setObjects($objects): void
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@ public function __isset(string $name): bool
*
* If the item already exists, it will be removed. If you want to add
* a new item with the same name, always use the add() method.
*
* @param mixed $value
*/
public function __set(string $name, $value): void
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Component/VAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function isInTimeRange(\DateTimeInterface $start, \DateTimeInterface $end
list($effectiveStart, $effectiveEnd) = $this->getEffectiveStartEnd();

return
(is_null($effectiveStart) || $start < $effectiveEnd) &&
(is_null($effectiveEnd) || $end > $effectiveStart)
(is_null($effectiveStart) || $start < $effectiveEnd)
&& (is_null($effectiveEnd) || $end > $effectiveStart)
;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Component/VCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getDocumentType(): int
*
* @return VObject\Component[]
*/
public function getBaseComponents(?string $componentName = null): array
public function getBaseComponents(string $componentName = null): array
{
$isBaseComponent = function ($component): bool {
if (!$component instanceof VObject\Component) {
Expand Down Expand Up @@ -217,7 +217,7 @@ public function getBaseComponents(?string $componentName = null): array
*
* @return VObject\Component|null
*/
public function getBaseComponent(?string $componentName = null): ?Component
public function getBaseComponent(string $componentName = null): ?Component
{
$isBaseComponent = function ($component): bool {
if (!$component instanceof VObject\Component) {
Expand Down Expand Up @@ -275,7 +275,7 @@ public function getBaseComponent(?string $componentName = null): ?Component
* @throws InvalidDataException
* @throws VObject\Recur\MaxInstancesExceededException
*/
public function expand(\DateTimeInterface $start, \DateTimeInterface $end, ?\DateTimeZone $timeZone = null): VCalendar
public function expand(\DateTimeInterface $start, \DateTimeInterface $end, \DateTimeZone $timeZone = null): VCalendar
{
$newChildren = [];
$recurringEvents = [];
Expand Down
6 changes: 3 additions & 3 deletions lib/Component/VCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,17 @@ public function validate(int $options = 0): array
}
$repaired = true;

// Otherwise, the ORG property may work
// Otherwise, the ORG property may work
} elseif (isset($this->ORG)) {
$this->FN = (string) $this->ORG;
$repaired = true;

// Otherwise, the NICKNAME property may work
// Otherwise, the NICKNAME property may work
} elseif (isset($this->NICKNAME)) {
$this->FN = (string) $this->NICKNAME;
$repaired = true;

// Otherwise, the EMAIL property may work
// Otherwise, the EMAIL property may work
} elseif (isset($this->EMAIL)) {
$this->FN = (string) $this->EMAIL;
$repaired = true;
Expand Down
8 changes: 4 additions & 4 deletions lib/Component/VTodo.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function isInTimeRange(\DateTimeInterface $start, \DateTimeInterface $end
return $start <= $effectiveEnd && $end > $dtstart;
} elseif ($due) {
return
($start < $due || $start <= $dtstart) &&
($end > $dtstart || $end >= $due);
($start < $due || $start <= $dtstart)
&& ($end > $dtstart || $end >= $due);
} else {
return $start <= $dtstart && $end > $dtstart;
}
Expand All @@ -63,8 +63,8 @@ public function isInTimeRange(\DateTimeInterface $start, \DateTimeInterface $end
}
if ($completed && $created) {
return
($start <= $created || $start <= $completed) &&
($end >= $created || $end >= $completed);
($start <= $created || $start <= $completed)
&& ($end >= $created || $end >= $completed);
}
if ($completed) {
return $start <= $completed && $end >= $completed;
Expand Down
4 changes: 2 additions & 2 deletions lib/DateTimeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DateTimeParser
*
* @throws InvalidDataException
*/
public static function parseDateTime(string $dt, ?\DateTimeZone $tz = null): \DateTimeImmutable
public static function parseDateTime(string $dt, \DateTimeZone $tz = null): \DateTimeImmutable
{
// 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 All @@ -54,7 +54,7 @@ public static function parseDateTime(string $dt, ?\DateTimeZone $tz = null): \Da
*
* @throws InvalidDataException
*/
public static function parseDate(string $date, ?\DateTimeZone $tz = null): \DateTimeImmutable
public static function parseDate(string $date, \DateTimeZone $tz = null): \DateTimeImmutable
{
// Format is YYYYMMDD
$result = preg_match('/^([0-9]{4})([0-1][0-9])([0-3][0-9])$/', $date, $matches);
Expand Down
7 changes: 2 additions & 5 deletions lib/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public function getDocumentType(): int
*
* If it's a known component, we will automatically call createComponent.
* otherwise, we'll assume it's a property and call createProperty instead.
*
* @return mixed
*/
public function create(string $name)
{
Expand All @@ -142,7 +140,7 @@ public function create(string $name)
* an iCalendar object, this may be something like CALSCALE:GREGORIAN. To
* ensure that this does not happen, set $defaults to false.
*/
public function createComponent(string $name, ?array $children = null, bool $defaults = true): Component
public function createComponent(string $name, array $children = null, bool $defaults = true): Component
{
$name = strtoupper($name);
$class = Component::class;
Expand All @@ -167,12 +165,11 @@ public function createComponent(string $name, ?array $children = null, bool $def
* parameters will automatically be created, or you can just pass a list of
* Parameter objects.
*
* @param mixed $value
* @param string|null $valueType Force a specific valueType, such as URI or TEXT
*
* @throws InvalidDataException
*/
public function createProperty(string $name, $value = null, ?array $parameters = null, ?string $valueType = null): Property
public function createProperty(string $name, $value = null, array $parameters = null, string $valueType = null): Property
{
// If there's a . in the name, it means it's prefixed by a group name.
if (false !== ($i = strpos($name, '.'))) {
Expand Down
3 changes: 1 addition & 2 deletions lib/ElementList.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class ElementList extends \ArrayIterator
/**
* Sets an item through ArrayAccess.
*
* @param int $offset
* @param mixed $value
* @param int $offset
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value): void
Expand Down
12 changes: 4 additions & 8 deletions lib/FreeBusyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ class FreeBusyGenerator
*
* Check the setTimeRange and setObjects methods for details about the
* arguments.
*
* @param mixed $objects
*/
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 @@ -114,8 +112,6 @@ public function setVAvailability(Document $vcalendar): void
* You must either specify a vcalendar object as a string, or as the parse
* Component.
* It's also possible to specify multiple objects as an array.
*
* @param mixed $objects
*/
public function setObjects($objects): void
{
Expand All @@ -142,7 +138,7 @@ public function setObjects($objects): void
*
* @throws \Exception
*/
public function setTimeRange(?\DateTimeInterface $start = null, ?\DateTimeInterface $end = null): void
public function setTimeRange(\DateTimeInterface $start = null, \DateTimeInterface $end = null): void
{
if (!$start) {
$start = new \DateTimeImmutable(Settings::$minDate);
Expand Down Expand Up @@ -243,8 +239,8 @@ function ($a, $b) {
foreach ($new as $higherVavail) {
list($higherStart, $higherEnd) = $higherVavail->getEffectiveStartEnd();
if (
(is_null($higherStart) || $higherStart < $compStart) &&
(is_null($higherEnd) || $higherEnd > $compEnd)
(is_null($higherStart) || $higherStart < $compStart)
&& (is_null($higherEnd) || $higherEnd > $compEnd)
) {
// Component is fully covered by a higher priority
// component. We can skip this component.
Expand Down
20 changes: 10 additions & 10 deletions lib/ITip/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function parseEvent($calendar, $userHref, $oldCalendar = null): array
* This is message from an organizer, and is either a new event
* invite, or an update to an existing one.
*/
protected function processMessageRequest(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar
protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar
{
if (!$existingObject) {
// This is a new invite, and we're just going to copy over
Expand Down Expand Up @@ -296,7 +296,7 @@ protected function processMessageRequest(Message $itipMessage, ?VCalendar $exist
* attendee got removed from an event, or an event got cancelled
* altogether.
*/
protected function processMessageCancel(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar
protected function processMessageCancel(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar
{
if (!$existingObject) {
// The event didn't exist in the first place, so we're just
Expand All @@ -321,7 +321,7 @@ protected function processMessageCancel(Message $itipMessage, ?VCalendar $existi
* @throws MaxInstancesExceededException
* @throws NoInstancesException
*/
protected function processMessageReply(Message $itipMessage, ?VCalendar $existingObject = null): ?VCalendar
protected function processMessageReply(Message $itipMessage, VCalendar $existingObject = null): ?VCalendar
{
// 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 @@ -545,10 +545,10 @@ protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo,
$newAttendeeInstances = array_keys($attendee['newInstances']);

$message->significantChange =
'REQUEST' === $attendee['forceSend'] ||
count($oldAttendeeInstances) != count($newAttendeeInstances) ||
count(array_diff($oldAttendeeInstances, $newAttendeeInstances)) > 0 ||
$oldEventInfo['significantChangeHash'] !== $eventInfo['significantChangeHash'];
'REQUEST' === $attendee['forceSend']
|| count($oldAttendeeInstances) != count($newAttendeeInstances)
|| count(array_diff($oldAttendeeInstances, $newAttendeeInstances)) > 0
|| $oldEventInfo['significantChangeHash'] !== $eventInfo['significantChangeHash'];

foreach ($attendee['newInstances'] as $instanceId => $instanceInfo) {
$currentEvent = clone $eventInfo['instances'][$instanceId];
Expand Down Expand Up @@ -886,9 +886,9 @@ protected function parseEventInfo(VCalendar $calendar): array
}
if (isset($vevent->ATTENDEE)) {
foreach ($vevent->ATTENDEE as $attendee) {
if ($this->scheduleAgentServerRules &&
isset($attendee['SCHEDULE-AGENT']) &&
'CLIENT' === strtoupper($attendee['SCHEDULE-AGENT']->getValue())
if ($this->scheduleAgentServerRules
&& isset($attendee['SCHEDULE-AGENT'])
&& 'CLIENT' === strtoupper($attendee['SCHEDULE-AGENT']->getValue())
) {
continue;
}
Expand Down
9 changes: 3 additions & 6 deletions lib/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ public function offsetExists($offset): bool
* This method just forwards the request to the inner iterator
*
* @param int $offset
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
Expand All @@ -194,8 +192,7 @@ public function offsetGet($offset)
*
* This method just forwards the request to the inner iterator
*
* @param int $offset
* @param mixed $value
* @param int $offset
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value): void
Expand All @@ -204,7 +201,7 @@ public function offsetSet($offset, $value): void
$iterator->offsetSet($offset, $value);

// @codeCoverageIgnoreStart
//
//
// This method always throws an exception, so we ignore the closing
// brace
}
Expand All @@ -225,7 +222,7 @@ public function offsetUnset($offset): void
$iterator->offsetUnset($offset);

// @codeCoverageIgnoreStart
//
//
// This method always throws an exception, so we ignore the closing
// brace
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Parser/MimeDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected function parseLine(string $line)
*
* @return string
*
*@throws EofException|ParseException
* @throws EofException|ParseException
*/
protected function readLine(): ?string
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ abstract class Parser
*
* Optionally, it's possible to parse the input stream here.
*
* @param mixed $input
* @param int $options any parser options (OPTION constants)
* @param int $options any parser options (OPTION constants)
*/
public function __construct($input = null, int $options = 0)
{
Expand Down
5 changes: 1 addition & 4 deletions lib/Parser/XML.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class XML extends Parser
*
* Optionally, it's possible to parse the input stream here.
*
* @param mixed $input
* @param int $options any parser options (OPTION constants)
* @param int $options any parser options (OPTION constants)
*/
public function __construct($input = null, int $options = 0)
{
Expand Down Expand Up @@ -322,8 +321,6 @@ protected function parseComponent(Component $parentComponent): void
/**
* Create a property.
*
* @param mixed $value
*
* @throws InvalidDataException
*/
protected function createProperty(Component $parentComponent, string $name, array $parameters, string $type, $value): void
Expand Down
7 changes: 1 addition & 6 deletions lib/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ abstract class Property extends Node

/**
* Current value.
*
* @var mixed
*/
protected $value;

Expand All @@ -63,7 +61,7 @@ abstract class Property extends Node
* @param array $parameters List of parameters
* @param string|null $group The vcard property group
*/
public function __construct(Component $root, ?string $name, $value = null, array $parameters = [], ?string $group = null)
public function __construct(Component $root, ?string $name, $value = null, array $parameters = [], string $group = null)
{
$this->name = $name;
$this->group = $group;
Expand Down Expand Up @@ -360,8 +358,6 @@ public function __toString(): string

/**
* Checks if an array element exists.
*
* @param mixed $offset
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset): bool
Expand Down Expand Up @@ -407,7 +403,6 @@ public function offsetGet($offset): ?Node
* Creates a new parameter.
*
* @param string|int $offset
* @param mixed $value
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value): void
Expand Down

0 comments on commit ac56915

Please sign in to comment.