Skip to content

Commit

Permalink
Merge upstream commits (#34)
Browse files Browse the repository at this point in the history
* fix  Bad file descriptor (7.4) (sabre-io#469)

* travis: allow failure for phpstan for now (sabre-io#470)

* travis: add php 7.4snapshot build (sabre-io#471)

* reduce phpstan level back to 0, as level 1 is failing right now (sabre-io#472)

* reduce phpstan level back to 0, as level 1 is failing right now

* travis: no longer allow failures for phpstan

* Fixed typo in vobject CLI help (sabre-io#477)

* Release 4.2.1 (sabre-io#479)

* Release 4.2.1

* Update CHANGELOG.md

* Prepare next iteration (sabre-io#480)

* Run phpstan on PHP >= 7.1 (sabre-io#483)

* Add TZ in iTip REPLY messages

* Added phpstan for tests folder (sabre-io#485)

* Add PHONE-NUMBER value type (used for TEL in vCard 3.0) (sabre-io#486)

Signed-off-by: Christian Kraus <hanzi@hanzi.cc>

* use latest phpstan 0.12.5 in CI

* Add PHPstorm .idea to .gitignore

* Fix various typos

* Release 4.2.2 (sabre-io#490)

* Release 4.2.2

* Update CHANGELOG.md

* Prepare next iteration

* Update dependencies and code style tools

* Remove unneeded 'bootstrap' line from phpstan.neon

* Apply php-cs-fixer code style changes

* run php-cs-fixer in CI

* php-cs-fixer must be at least 2.16.1 for PHP 7.4

* Use phpunit8 where possible

* Fixed phpstan level 1 errors

* Make sure there is no logic change

* Prevent setting foreach key beforehand

* Refactored fqcn strings to ::class to allow checking with phpstan (sabre-io#495)

* Release 4.3.0 (sabre-io#497)

* Update CHANGELOG.md

* Update Version.php

* Added phpstan to dev dependencies

* Reset bin-dir config

* Added convenient development commands

* Cleaned up .gitignore
These entries should be in the developer's global .gitignore

* cs-fixer: don't check only the lib folder

* Decoupled cs-fixer command from chosen tool

* Standardize CI

* Use phpunit 9 where possible

* Only upload coverage when it has been collected

* Replace assertRegExp with assertMatchesRegularExpression in unit test

* fix an incomplete phpdoc type annotation

* Release 4.3.1

* Adjust boolean vars in .travis.yml to prepare for PHP8.0

* Run unit tests on PHP8

* Fixup calendar parameter to Broker parseEvent

* Release 4.3.2

* Remove Pacific-New obsolete timezone

* Do composer remove --no-update in Travis

* Use min php-cs-fixer 2.16.7

* Release 4.3.3

* Add .gitattributes

* Explicitly select PHP 8.0 in CI

* Use latest php-cs-fixer 2.17.1

* Update windowszones timezone data to 2020-12-13

* Fix typos

* Reassign modified date in yearly rrule

* Add test

* Code style

* Add test for calendar expand

* adjust unit test settings for time limits

Some tests were testing a bug that caused an infinite loop.

Annotate those tests with large, small annotations.

Turn on enforceTimeLimit, failOnWarning and failOnRisky so that the
annotations are enforced when unit tests are run.

Add phpunit/php-invoker to the composer require-dev becaause this is
required to make the enforceTimeLimit setting effective.

* Release 4.3.4

* Make use of until parameter in nextMonthly function

* CS FIX

* CS FIX

* Fix breaking tests

* create testMonthlyByDayUntil

* create testMonthlyByDayUntilWithImpossibleNextOccurrence

* Fix setting properties with group assignment

* Unit test for adding properties with group for a VCard

* Adapt style

* Release 4.3.5

* tests: migrate from Travis to gh-actions

* Removed travis config

* Minor edit to README

* Run phpunit with coverage in CI

* Fix deprecated usages and return types on PHP 8.1

* sync ci.yml to match other repos

* Changes that should have happened for 4.3.6

* changelog and VERSION bump for 4.3.7

* EventIterator returns wrong endTime (sabre-io#534)

* Reordering of the attendees should not be a signitifcant change (sabre-io#540)

* Reordering of vevent should not be a significant change (sabre-io#542)

* Prepare release 4.3.8

* Allow easier extension of the timezone guessing

This will ease customization of timezone-guessing as it is now gets easier
to extend that process with own implementations (as long as they
implement the appropriate interface)

This is espechially necessary when wanting to actually guess a timezone
via the rules defined in the VTIMEZONE-entry (which is currently not
done)

* testEmptyTimeZone

* Changelog for 4.4.0

* Fix Changelog

* Merge github actions

Co-authored-by: Remi Collet <remi@remirepo.net>
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
Co-authored-by: Dominik <dominik@tobschall.de>
Co-authored-by: Jeroen van Oort <jvanoort@simplexis.nl>
Co-authored-by: Renaud BOYER <rboyer@linagora.com>
Co-authored-by: Christian Kraus <github@hanzi.cc>
Co-authored-by: Thomas Müller <thomas.mueller@tmit.eu>
Co-authored-by: Phil Davis <phil@jankaritech.com>
Co-authored-by: Michael Stilkerich <ms@mike2k.de>
Co-authored-by: Stéphane <demonchaux.stephane@gmail.com>
Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
Co-authored-by: Jair Cueva Junior <junior@dinhost.com.br>
Co-authored-by: Parajuli Kiran <kiranparajuli589@gmail.com>
Co-authored-by: Cédric Anne <cedric.anne@gmail.com>
Co-authored-by: Holger Floerke <floerke@doctronic.de>
Co-authored-by: Andreas Heigl <andreas@heigl.org>
  • Loading branch information
17 people committed Dec 15, 2021
1 parent c26e2d4 commit 1424b38
Show file tree
Hide file tree
Showing 55 changed files with 979 additions and 176 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
@@ -0,0 +1,7 @@
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.travis.yml export-ignore
/CHANGELOG.md export-ignore
/phpstan.neon export-ignore
12 changes: 10 additions & 2 deletions .github/workflows/actions.yml
Expand Up @@ -35,9 +35,17 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Code Analysis (PHP CS-Fixer)
if: matrix.code-analysis == 'yes'
run: php vendor/bin/php-cs-fixer fix --dry-run --diff

- name: Code Analysis (PHPStan)
if: matrix.code-analysis == 'yes'
run: composer phpstan

- name: Test with phpunit
run: vendor/bin/phpunit --configuration ./tests/phpunit.xml --coverage-text --coverage-clover=coverage.xml

Expand All @@ -49,4 +57,4 @@ jobs:
flags: tests
name: codecov-umbrella
yml: ./codecov.yml
fail_ci_if_error: true
fail_ci_if_error: true
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -21,3 +21,7 @@ bin/hoa

# OS X
.DS_Store
=======

# Development stuff
.php_cs.cache
12 changes: 8 additions & 4 deletions CHANGELOG.md
@@ -1,6 +1,10 @@
ChangeLog
=========

4.7.0 (2021-12-15)
------------------
* #34 Merge upstream changes from sabre-io/vobject:4.4.0 into protonlabs/vobject

4.6.1 (2021-11-04)
------------------
* #29 Fix timezone name prefixed with /
Expand Down Expand Up @@ -138,7 +142,7 @@ ChangeLog
* #306: iTip REPLYs to the first instance of a recurring event was not handled
correctly.
* Slightly better error message during validation of `N` and `ADR` properties.
* #312: Correctly extracing timezone in the iTip broker, even when we don't
* #312: Correctly extracting timezone in the iTip broker, even when we don't
have a master event. (@vkomrakov-sugar).
* When validating a component's property that must appear once and which could
automatically be repaired, make sure we report the change as 'repaired'.
Expand Down Expand Up @@ -460,7 +464,7 @@ ChangeLog
* #114: VTIMEZONE is retained when generating new REQUEST objects.
* #114: Support for 'MAILTO:' style email addresses (in uppercase) in the iTip
broker. This improves evolution support.
* #115: Using REQUEST-STATUS from REPLY messages and now propegating that into
* #115: Using REQUEST-STATUS from REPLY messages and now propagating that into
SCHEDULE-STATUS.


Expand Down Expand Up @@ -697,7 +701,7 @@ ChangeLog
3.0.0-alpha2 (2013-05-22)
-------------------------

* Fixed: vCard URL properties were referencing a non-existant class.
* Fixed: vCard URL properties were referencing a non-existent class.


3.0.0-alpha1 (2013-05-21)
Expand Down Expand Up @@ -855,7 +859,7 @@ ChangeLog
properties such as N, ADR, ORG and CATEGORIES.
* Added: Splitter classes, that can split up large objects (such as exports)
into individual objects (thanks @DominikTo and @armin-hackmann).
* Added: VFREEBUSY component, which allows easily checking wether timeslots are
* Added: VFREEBUSY component, which allows easily checking whether timeslots are
available.
* Added: The Reader class now has a 'FORGIVING' option, which allows it to parse
properties with incorrect characters in the name (at this time, it just allows
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -7,7 +7,7 @@ sabre/vobject
The VObject library allows you to easily parse and manipulate [iCalendar](https://tools.ietf.org/html/rfc5545)
and [vCard](https://tools.ietf.org/html/rfc6350) objects using PHP.

The goal of the VObject library is to create a very complete library, with an easy to use API.
The goal of the VObject library is to create a very complete library, with an easy-to-use API.


Installation
Expand Down
2 changes: 1 addition & 1 deletion bin/bench_freebusygenerator.php
Expand Up @@ -11,7 +11,7 @@
echo "The process will be repeated 100 times to get accurate stats\n";
echo "\n";
echo 'Usage: '.$argv[0]." inputfile.ics\n";
die();
exit();
}

list(, $inputFile) = $argv;
Expand Down
2 changes: 1 addition & 1 deletion bin/bench_manipulatevcard.php
Expand Up @@ -10,7 +10,7 @@
echo 'system.';
echo "\n";
echo 'Usage: '.$argv[0]." inputfile.vcf\n";
die();
exit();
}

list(, $inputFile) = $argv;
Expand Down
5 changes: 2 additions & 3 deletions bin/fetch_windows_zones.php
@@ -1,13 +1,12 @@
#!/usr/bin/env php
<?php

$windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml';
$windowsZonesUrl = 'https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml';
$outputFile = __DIR__.'/../lib/timezonedata/windowszones.php';

echo 'Fetching timezone map from: '.$windowsZonesUrl, "\n";

$data = file_get_contents($windowsZonesUrl);

$xml = simplexml_load_string($data);

$map = [];
Expand Down Expand Up @@ -44,6 +43,6 @@

echo "Formatting\n";

exec(__DIR__.'/sabre-cs-fixer fix '.escapeshellarg($outputFile));
exec(__DIR__.'/../vendor/bin/php-cs-fixer fix '.escapeshellarg($outputFile));

echo "Done\n";
4 changes: 2 additions & 2 deletions bin/generateicalendardata.php
Expand Up @@ -18,7 +18,7 @@
HI
);
die();
exit();
}

$events = 100;
Expand Down Expand Up @@ -77,7 +77,7 @@
if ($result) {
fwrite(STDERR, "Errors!\n");
fwrite(STDERR, print_r($result, true));
die(-1);
exit(-1);
}

fwrite(STDERR, "Serializing this beast\n");
Expand Down
4 changes: 2 additions & 2 deletions bin/mergeduplicates.php
Expand Up @@ -19,15 +19,15 @@

if (!class_exists('Sabre\\VObject\\Version')) {
fwrite(STDERR, "Composer autoloader could not be loaded.\n");
die(1);
exit(1);
}

echo 'sabre/vobject ', Version::VERSION, " duplicate contact merge tool\n";

if ($argc < 3) {
echo "\n";
echo 'Usage: ', $argv[0], " input.vcf output.vcf [debug.log]\n";
die(1);
exit(1);
}

$input = fopen($argv[1], 'r');
Expand Down
2 changes: 1 addition & 1 deletion bin/rrulebench.php
Expand Up @@ -9,7 +9,7 @@
echo 'system.';
echo "\n";
echo 'Usage: '.$argv[0]." inputfile.ics startdate enddate\n";
die();
exit();
}

list(, $inputFile, $startDate, $endDate) = $argv;
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -37,8 +37,9 @@
"sabre/xml" : "^2.1"
},
"require-dev" : {
"friendsofphp/php-cs-fixer": "~2.16.7",
"friendsofphp/php-cs-fixer": "~2.17.1",
"phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0",
"phpunit/php-invoker" : "^2.0 || ^3.1",
"phpstan/phpstan": "^0.12"
},
"suggest" : {
Expand Down
11 changes: 2 additions & 9 deletions lib/Cli.php
Expand Up @@ -2,8 +2,7 @@

namespace Sabre\VObject;

use
InvalidArgumentException;
use InvalidArgumentException;

/**
* This is the CLI interface for sabre-vobject.
Expand Down Expand Up @@ -137,17 +136,14 @@ public function main(array $argv)
// jcard/jcal documents
case 'jcard':
case 'jcal':

// specific document versions
case 'vcard21':
case 'vcard30':
case 'vcard40':
case 'icalendar20':

// specific formats
case 'json':
case 'mimedir':

// icalendar/vcad
case 'icalendar':
case 'vcard':
Expand Down Expand Up @@ -183,7 +179,6 @@ public function main(array $argv)
case 'vcard30':
case 'vcard40':
case 'icalendar20':

$this->inputFormat = 'mimedir';
break;

Expand Down Expand Up @@ -211,7 +206,7 @@ public function main(array $argv)
}

if (!in_array($positional[0], ['validate', 'repair', 'convert', 'color'])) {
throw new InvalidArgumentException('Uknown command: '.$positional[0]);
throw new InvalidArgumentException('Unknown command: '.$positional[0]);
}
} catch (InvalidArgumentException $e) {
$this->showHelp();
Expand Down Expand Up @@ -458,8 +453,6 @@ protected function convert($vObj)
* Colorizes a file.
*
* @param Component $vObj
*
* @return int
*/
protected function color($vObj)
{
Expand Down
5 changes: 3 additions & 2 deletions lib/Component.php
Expand Up @@ -160,9 +160,9 @@ public function remove($item)
return;
}
}
}

throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component');
throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component');
}
}

/**
Expand Down Expand Up @@ -339,6 +339,7 @@ function ($a, $b) use ($sortScore, $tmp) {
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$components = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/Component/VCalendar.php
Expand Up @@ -309,7 +309,7 @@ public function expand(DateTimeInterface $start, DateTimeInterface $end, DateTim

foreach ($this->children() as $child) {
if ($child instanceof Property && 'PRODID' !== $child->name) {
// We explictly want to ignore PRODID, because we want to
// We explicitly want to ignore PRODID, because we want to
// overwrite it with our own.
$newChildren[] = clone $child;
} elseif ($child instanceof Component && 'VTIMEZONE' !== $child->name) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Component/VCard.php
Expand Up @@ -373,7 +373,7 @@ public function getValidationRules()
/**
* Returns a preferred field.
*
* VCards can indicate wether a field such as ADR, TEL or EMAIL is
* VCards can indicate whether a field such as ADR, TEL or EMAIL is
* preferred by specifying TYPE=PREF (vcard 2.1, 3) or PREF=x (vcard 4, x
* being a number between 1 and 100).
*
Expand Down Expand Up @@ -445,6 +445,7 @@ protected function getDefaults()
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
// A vcard does not have sub-components, so we're overriding this
Expand Down
2 changes: 2 additions & 0 deletions lib/ElementList.php
Expand Up @@ -25,6 +25,7 @@ class ElementList extends ArrayIterator
* @param int $offset
* @param mixed $value
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new LogicException('You can not add new objects to an ElementList');
Expand All @@ -37,6 +38,7 @@ public function offsetSet($offset, $value)
*
* @param int $offset
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new LogicException('You can not remove objects from an ElementList');
Expand Down
8 changes: 4 additions & 4 deletions lib/FreeBusyData.php
Expand Up @@ -84,7 +84,7 @@ public function add($start, $end, $type)
'type' => $type,
];

$preceedingItem = $this->data[$insertStartIndex - 1];
$precedingItem = $this->data[$insertStartIndex - 1];
if ($this->data[$insertStartIndex - 1]['start'] === $start) {
// The old item starts at the exact same point as the new item.
--$insertStartIndex;
Expand Down Expand Up @@ -122,11 +122,11 @@ public function add($start, $end, $type)
// between.
if (-1 === $itemsToDelete) {
$itemsToDelete = 0;
if ($newItem['end'] < $preceedingItem['end']) {
if ($newItem['end'] < $precedingItem['end']) {
$newItems[] = [
'start' => $newItem['end'] + 1,
'end' => $preceedingItem['end'],
'type' => $preceedingItem['type'],
'end' => $precedingItem['end'],
'type' => $precedingItem['type'],
];
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/FreeBusyGenerator.php
Expand Up @@ -126,7 +126,7 @@ public function setVAvailability(Document $vcalendar)
/**
* Sets the input objects.
*
* You must either specify a valendar object as a string, or as the parse
* 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.
*
Expand Down Expand Up @@ -362,7 +362,6 @@ protected function calculateBusy(FreeBusyData $fbData, array $objects)
foreach ($object->getBaseComponents() as $component) {
switch ($component->name) {
case 'VEVENT':

$FBTYPE = 'BUSY';
if (isset($component->TRANSP) && ('TRANSPARENT' === strtoupper($component->TRANSP))) {
break;
Expand Down

0 comments on commit 1424b38

Please sign in to comment.