[Pkg-owncloud-commits] [php-sabre-vobject] 90/106: Allow more values to be used with magic setters.
David Prévot
taffit at moszumanska.debian.org
Fri Aug 22 15:11:08 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit cae7fb200c50e449aa1da51d0f8b937c669b9656
Author: Evert Pot <me at evertpot.com>
Date: Tue Aug 12 00:53:41 2014 -0400
Allow more values to be used with magic setters.
---
ChangeLog.md | 2 ++
lib/Component.php | 5 +----
tests/VObject/ComponentTest.php | 12 ------------
3 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index dda1a08..f4edf42 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -4,6 +4,8 @@ ChangeLog
3.3.1 (2014-??-??)
------------------
+* Changed: It's now possible to pass DateTime objects when using the magic
+ setters on properties. (`$event->DTSTART = new DateTime('now')`).
* #111: iTip Broker does not process attendee adding events to EXDATE.
* #112: EventIterator now sets TZID on RECURRENCE-ID.
diff --git a/lib/Component.php b/lib/Component.php
index 0276f10..4ac0314 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -417,7 +417,7 @@ class Component extends Node {
} else {
$this->children[] = $value;
}
- } elseif (is_scalar($value) || is_array($value) || is_null($value)) {
+ } else {
$property = $this->root->create($name,$value);
$property->parent = $this;
if (!is_null($overWrite)) {
@@ -425,10 +425,7 @@ class Component extends Node {
} else {
$this->children[] = $property;
}
- } else {
- throw new \InvalidArgumentException('You must pass a \\Sabre\\VObject\\Component, \\Sabre\\VObject\\Property or scalar type');
}
-
}
/**
diff --git a/tests/VObject/ComponentTest.php b/tests/VObject/ComponentTest.php
index aef2d47..3bbe4d8 100644
--- a/tests/VObject/ComponentTest.php
+++ b/tests/VObject/ComponentTest.php
@@ -290,18 +290,6 @@ class ComponentTest extends \PHPUnit_Framework_TestCase {
}
- /**
- * @expectedException InvalidArgumentException
- */
- function testMagicSetInvalid() {
-
- $comp = new VCalendar(array(), false);
-
- // Note that 'myProp' is ignored here.
- $comp->myProp = new \StdClass();
-
- }
-
function testMagicUnset() {
$comp = new VCalendar(array(), false);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list