Skip to content

Commit c26d0a3

Browse files
Merge branch 'sabre-io:master' into fix/handle-utc-offset-timezones
2 parents 1205cf3 + 01d1edc commit c26d0a3

92 files changed

Lines changed: 1828 additions & 1295 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,28 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php-versions: ['8.0', '8.1', '8.2', '8.3']
15+
php-versions: ['8.3', '8.4']
1616
coverage: ['pcov']
17-
code-style: ['yes']
17+
code-style: ['no']
1818
code-analysis: ['no']
19+
rector-check: ['no']
1920
include:
20-
- php-versions: '7.4'
21+
- php-versions: '8.2'
2122
coverage: 'pcov'
2223
code-style: 'yes'
2324
code-analysis: 'yes'
24-
- php-versions: '8.4'
25+
rector-check: 'no'
26+
- php-versions: '8.5'
2527
coverage: 'pcov'
26-
code-style: 'yes'
28+
code-style: 'no'
2729
code-analysis: 'yes'
30+
rector-check: 'yes'
2831
steps:
2932
- name: Checkout
30-
uses: actions/checkout@v5
33+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3134

3235
- name: Setup PHP, with composer and extensions
33-
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
36+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
3437
with:
3538
php-version: ${{ matrix.php-versions }}
3639
extensions: mbstring, dom, fileinfo, mysql, redis, opcache
@@ -42,7 +45,7 @@ jobs:
4245
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4346

4447
- name: Cache composer dependencies
45-
uses: actions/cache@v4
48+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
4649
with:
4750
path: ${{ steps.composer-cache.outputs.dir }}
4851
# Use composer.json for key, if composer.lock is not committed.
@@ -61,9 +64,13 @@ jobs:
6164
if: matrix.code-analysis == 'yes'
6265
run: composer phpstan
6366

67+
- name: Code Refactoring (rector)
68+
if: matrix.rector-check == 'yes'
69+
run: composer rector-check
70+
6471
- name: Test with phpunit
6572
run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
6673

6774
- name: Code Coverage
68-
uses: codecov/codecov-action@v5
75+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
6976
if: matrix.coverage != 'none'

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ vendor/
33
composer.lock
44
tests/cov/
55
tests/temp
6+
tests/.phpunit.cache
67
tests/.phpunit.result.cache
78

89
# Development stuff

‎CHANGELOG.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
ChangeLog
22
=========
3+
4+
5.0.0 (2026-07-07)
5+
------------------
6+
* #767 Drop PHP 7.4 8.0 8.1 and support PHP 8.2 and up (@phil-davis)
7+
* #769 fix: minor code fixes (@phil-davis)
8+
* #586 PHP types (@tcitworld @phil-davis)
9+
10+
This major release v5 declares function parameter and return types across the
11+
codebase. Users will need to be careful to call functions/methods with the
12+
correct types.
13+
14+
Support for PHP below 8.2 has been dropped.
15+
This release supports PHP 8.2 and up.
16+
17+
4.6.1 (2026-07-07)
18+
------------------
19+
* #776 fix: preserve UTC 'Z' indicator in Period JSON serialization (@bastien-roucaries @guimard @phil-davis)
20+
21+
4.6.0 (2026-05-31)
22+
------------------
23+
* #718 feat(VCard): add getByTypes method (@JimKnoxx)
24+
* #756 fix: Update deprecated timezone names (@ralflang)
25+
26+
4.5.9 (2026-05-31)
27+
------------------
28+
* #759 fix(itip): handle null old calendar/event (@ChristophWurst)
29+
30+
4.5.8 (2026-01-12)
31+
------------------
32+
33+
* #721: Fix variable scope (@KristofferFM)
34+
* #723: Broker shouldn't add EXDATE property with floating timezone (@KristofferFM)
35+
* #726: Improved check on property name (@KristofferFM)
36+
* #727: Improve error checks in Mimedir parser (@KristofferFM)
37+
* #728: Removing attendee from scheduled recurring event should generate an EXDATE property (@KristofferFM)
38+
* #735: use RDATE in time range check and use all instances (@SebastianKrupinski)
39+
* #743: send participation reply on fresh event (@SebastianKrupinski)
40+
41+
4.5.7 (2025-04-17)
42+
------------------
43+
44+
* #618: Add new exchangetimezone 'Amsterdam, Berlin, Bern, Rom, Stockholm, Wien' (@chr-is)
45+
* #674: Allow unknown value data types for VALUE (@heiglandreas)
46+
* #707: add phpdoc return types for arrayaccess methods (@smhg)
47+
348
4.5.6 (2024-10-14)
449
------------------
550

‎bin/mergeduplicates.php‎

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -96,53 +96,52 @@ function write($vcard)
9696
$collectedNames[$fn] = $vcard;
9797
++$stats['Unique cards'];
9898
continue;
99-
} else {
100-
// Starting comparison for all properties. We only check if properties
101-
// in the current vcard exactly appear in the earlier vcard as well.
102-
foreach ($vcard->children() as $newProp) {
103-
if (in_array($newProp->name, $ignoredProperties)) {
104-
// We don't care about properties such as UID and REV.
105-
continue;
106-
}
107-
$ok = false;
108-
foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
109-
if ($compareProp->serialize() === $newProp->serialize()) {
110-
$ok = true;
111-
break;
112-
}
99+
}
100+
// Starting comparison for all properties. We only check if properties
101+
// in the current vcard exactly appear in the earlier vcard as well.
102+
foreach ($vcard->children() as $newProp) {
103+
if (in_array($newProp->name, $ignoredProperties)) {
104+
// We don't care about properties such as UID and REV.
105+
continue;
106+
}
107+
$ok = false;
108+
foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
109+
if ($compareProp->serialize() === $newProp->serialize()) {
110+
$ok = true;
111+
break;
113112
}
113+
}
114114

115-
if (!$ok) {
116-
if ('EMAIL' === $newProp->name || 'TEL' === $newProp->name) {
117-
// We're going to make another attempt to find this
118-
// property, this time just by value. If we find it, we
119-
// consider it a success.
120-
foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
121-
if ($compareProp->getValue() === $newProp->getValue()) {
122-
$ok = true;
123-
break;
124-
}
125-
}
126-
127-
if (!$ok) {
128-
// Merging the new value in the old vcard.
129-
$collectedNames[$fn]->add(clone $newProp);
115+
if (!$ok) {
116+
if ('EMAIL' === $newProp->name || 'TEL' === $newProp->name) {
117+
// We're going to make another attempt to find this
118+
// property, this time just by value. If we find it, we
119+
// consider it a success.
120+
foreach ($collectedNames[$fn]->select($newProp->name) as $compareProp) {
121+
if ($compareProp->getValue() === $newProp->getValue()) {
130122
$ok = true;
131-
++$stats['Merged values'];
123+
break;
132124
}
133125
}
134-
}
135126

136-
if (!$ok) {
137-
// echo $newProp->serialize() . " does not appear in earlier vcard!\n";
138-
++$stats['Error'];
139-
if ($debug) {
140-
fwrite($debug, "Missing '".$newProp->name."' property in duplicate. Earlier vcard:\n".$collectedNames[$fn]->serialize()."\n\nLater:\n".$vcard->serialize()."\n\n");
127+
if (!$ok) {
128+
// Merging the new value in the old vcard.
129+
$collectedNames[$fn]->add(clone $newProp);
130+
$ok = true;
131+
++$stats['Merged values'];
141132
}
133+
}
134+
}
142135

143-
$vcard->destroy();
144-
continue 2;
136+
if (!$ok) {
137+
// echo $newProp->serialize() . " does not appear in earlier vcard!\n";
138+
++$stats['Error'];
139+
if ($debug) {
140+
fwrite($debug, "Missing '".$newProp->name."' property in duplicate. Earlier vcard:\n".$collectedNames[$fn]->serialize()."\n\nLater:\n".$vcard->serialize()."\n\n");
145141
}
142+
143+
$vcard->destroy();
144+
continue 2;
146145
}
147146
}
148147

‎composer.json‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@
3232
"homepage" : "http://sabre.io/vobject/",
3333
"license" : "BSD-3-Clause",
3434
"require" : {
35-
"php" : "^7.4 || ^8.0",
35+
"php" : "^8.2",
3636
"ext-mbstring" : "*",
3737
"ext-json" : "*",
3838
"sabre/xml" : "^3.0 || ^4.0"
3939
},
4040
"require-dev" : {
41-
"friendsofphp/php-cs-fixer": "^3.87",
42-
"phpunit/phpunit" : "^9.6",
43-
"phpunit/php-invoker" : "^2.0 || ^3.1",
44-
"phpstan/phpstan": "^2.1"
41+
"friendsofphp/php-cs-fixer": "^3.95",
42+
"phpstan/phpstan": "^2.2",
43+
"phpstan/phpstan-phpunit": "^2.0",
44+
"phpstan/phpstan-strict-rules": "^2.0",
45+
"phpstan/extension-installer": "^1.4",
46+
"phpunit/phpunit": "^11.5",
47+
"phpunit/php-invoker" : "^5.0",
48+
"rector/rector": "^2.6"
4549
},
4650
"suggest" : {
4751
"hoa/bench" : "If you would like to run the benchmark scripts"
@@ -96,6 +100,12 @@
96100
"cs-fixer": [
97101
"PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix"
98102
],
103+
"rector-check": [
104+
"rector process --dry-run"
105+
],
106+
"rector-fix": [
107+
"rector process"
108+
],
99109
"phpunit": [
100110
"phpunit --configuration tests/phpunit.xml"
101111
],
@@ -104,5 +114,13 @@
104114
"composer cs-fixer",
105115
"composer phpunit"
106116
]
117+
},
118+
"config": {
119+
"allow-plugins": {
120+
"phpstan/extension-installer": true
121+
},
122+
"platform": {
123+
"php": "8.2"
124+
}
107125
}
108126
}

‎lib/BirthdayCalendarGenerator.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getResult(): VCalendar
9595
// We've seen clients (ez-vcard) putting "BDAY:" properties
9696
// without a value into vCards. If we come across those, we'll
9797
// skip them.
98-
if (empty($object->BDAY->getValue())) {
98+
if ('' === $object->BDAY->getValue()) {
9999
continue;
100100
}
101101

@@ -116,7 +116,7 @@ public function getResult(): VCalendar
116116
// Skip if we can't parse the BDAY value.
117117
try {
118118
$dateParts = DateTimeParser::parseVCardDateTime($object->BDAY->getValue());
119-
} catch (InvalidDataException $e) {
119+
} catch (InvalidDataException) {
120120
continue;
121121
}
122122

0 commit comments

Comments
 (0)