From a165030c81c5ed89cc70765fc65992edb565ac79 Mon Sep 17 00:00:00 2001 From: Christopher Szu Date: Thu, 26 May 2022 20:44:23 +0800 Subject: [PATCH] Feat/merge upstream 2022 05 (#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix Bad file descriptor (7.4) (#469) * travis: allow failure for phpstan for now (#470) * travis: add php 7.4snapshot build (#471) * reduce phpstan level back to 0, as level 1 is failing right now (#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 (#477) * Release 4.2.1 (#479) * Release 4.2.1 * Update CHANGELOG.md * Prepare next iteration (#480) * Run phpstan on PHP >= 7.1 (#483) * Add TZ in iTip REPLY messages * Added phpstan for tests folder (#485) * Add PHONE-NUMBER value type (used for TEL in vCard 3.0) (#486) Signed-off-by: Christian Kraus * use latest phpstan 0.12.5 in CI * Add PHPstorm .idea to .gitignore * Fix various typos * Release 4.2.2 (#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 (#495) * Release 4.3.0 (#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 (#534) * Reordering of the attendees should not be a signitifcant change (sabre-io#540) * Reordering of vevent should not be a significant change (#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 Iterator method signatures This avoids warnings under PHP>=8.1 Real return types should be added before PHP 9 Signed-off-by: Côme Chilliet * Avoid passing null as separator for implode Signed-off-by: Côme Chilliet * Prepare release 4.4.1 * Component/select: Before uppercasing $child->group, make sure it isn't null Signed-off-by: Gergely Nagy * fix php 8.1 null string deprecation in built-in functions * drop duplicated workflow config Co-authored-by: Remi Collet Co-authored-by: Markus Staab Co-authored-by: Dominik Co-authored-by: Jeroen van Oort Co-authored-by: Renaud BOYER Co-authored-by: Christian Kraus Co-authored-by: Thomas Müller Co-authored-by: Phil Davis Co-authored-by: Michael Stilkerich Co-authored-by: Stéphane Co-authored-by: Allon Moritz Co-authored-by: Jair Cueva Junior Co-authored-by: Parajuli Kiran Co-authored-by: Cédric Anne Co-authored-by: Holger Floerke Co-authored-by: Andreas Heigl Co-authored-by: Côme Chilliet Co-authored-by: Gergely Nagy Co-authored-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Christopher Szu --- lib/Component.php | 8 ++++---- lib/Parameter.php | 4 ++-- lib/Property.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Component.php b/lib/Component.php index f33b628a..c1a63258 100644 --- a/lib/Component.php +++ b/lib/Component.php @@ -212,14 +212,14 @@ public function getComponents() * string ("HOME.EMAIL"). If you want to search on a specific property that * has not been assigned a group, specify ".EMAIL". * - * @param string $name + * @param string|null $name * * @return array */ public function select($name) { $group = null; - $name = strtoupper($name); + $name = is_null($name) ? '' : strtoupper($name); if (false !== strpos($name, '.')) { list($group, $name) = explode('.', $name, 2); } @@ -238,7 +238,7 @@ public function select($name) return array_filter( $result, function ($child) use ($group) { - return $child instanceof Property && strtoupper($child->group) === $group; + return $child instanceof Property && strtoupper($child->group ?? '') === $group; } ); } @@ -249,7 +249,7 @@ function ($child) use ($group) { $result = []; foreach ($this->children as $childGroup) { foreach ($childGroup as $child) { - if ($child instanceof Property && strtoupper($child->group) === $group) { + if ($child instanceof Property && $child->group && strtoupper($child->group) === $group) { $result[] = $child; } } diff --git a/lib/Parameter.php b/lib/Parameter.php index 7e4d5574..5df6238e 100644 --- a/lib/Parameter.php +++ b/lib/Parameter.php @@ -47,12 +47,12 @@ class Parameter extends Node * * It's recommended to use the create:: factory method instead. * - * @param string $name + * @param string|null $name * @param string $value */ public function __construct(Document $root, $name, $value = null) { - $this->name = strtoupper($name); + $this->name = is_null($name) ? '' : strtoupper($name); $this->root = $root; if (is_null($name)) { $this->noName = true; diff --git a/lib/Property.php b/lib/Property.php index 50cda968..56096daf 100644 --- a/lib/Property.php +++ b/lib/Property.php @@ -30,7 +30,7 @@ abstract class Property extends Node * * This is only used in vcards * - * @var string + * @var string|null */ public $group;