diff --git a/.travis.yml b/.travis.yml index b84ae6feb..2619562ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,39 +1,39 @@ language: php sudo: required php: -- 5.5 -- 5.6 -- 7.0 -- 7.1 -- 7.2 -- 7.3 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - 7.3 env: global: - - RUN_PHPSTAN="FALSE" + - RUN_PHPSTAN="FALSE" matrix: include: - - name: 'PHPStan' - php: 7.2 - env: RUN_PHPSTAN="TRUE" + - name: 'PHPStan' + php: 7.2 + env: RUN_PHPSTAN="TRUE" fast_finish: true allow_failures: - - php: 5.5 + - php: 5.5 install: -- if [ $RUN_PHPSTAN == "TRUE" ]; then wget https://github.com/phpstan/phpstan/releases/download/0.10.3/phpstan.phar; fi + - if [ $RUN_PHPSTAN == "TRUE" ]; then wget https://github.com/phpstan/phpstan/releases/download/0.10.3/phpstan.phar; fi before_script: -- composer install + - composer install script: -- if [ $RUN_PHPSTAN == "FALSE" ]; then ./bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml; fi -- if [ $RUN_PHPSTAN == "TRUE" ]; then php phpstan.phar analyse -c phpstan.neon lib; fi + - if [ $RUN_PHPSTAN == "FALSE" ]; then ./bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml; fi + - if [ $RUN_PHPSTAN == "TRUE" ]; then php phpstan.phar analyse -c phpstan.neon lib; fi after_success: -- bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) cache: directories: - - $HOME/.composer/cache + - $HOME/.composer/cache diff --git a/lib/Document.php b/lib/Document.php index 2fb0451ae..0cb2e0978 100644 --- a/lib/Document.php +++ b/lib/Document.php @@ -95,13 +95,16 @@ abstract class Document extends Component public function __construct() { $args = func_get_args(); + $name = static::$defaultName; if (0 === count($args) || is_array($args[0])) { - array_unshift($args, $this, static::$defaultName); - call_user_func_array(['parent', '__construct'], $args); + $children = isset($args[0]) ? $args[0] : []; + $defaults = isset($args[1]) ? $args[1] : true; } else { - array_unshift($args, $this); - call_user_func_array(['parent', '__construct'], $args); + $name = $args[0]; + $children = isset($args[1]) ? $args[1] : []; + $defaults = isset($args[2]) ? $args[2] : true; } + parent::__construct($this, $name, $children, $defaults); } /** diff --git a/lib/Parser/Json.php b/lib/Parser/Json.php index 2062f8614..3fd307e97 100644 --- a/lib/Parser/Json.php +++ b/lib/Parser/Json.php @@ -4,6 +4,7 @@ use Sabre\VObject\Component\VCalendar; use Sabre\VObject\Component\VCard; +use Sabre\VObject\Document; use Sabre\VObject\EofException; use Sabre\VObject\ParseException; @@ -43,7 +44,7 @@ class Json extends Parser * @param resource|string|array|null $input * @param int $options * - * @return Sabre\VObject\Document + * @return \Sabre\VObject\Document */ public function parse($input = null, $options = 0) { diff --git a/lib/Parser/MimeDir.php b/lib/Parser/MimeDir.php index 50c5e55b8..d98225b59 100644 --- a/lib/Parser/MimeDir.php +++ b/lib/Parser/MimeDir.php @@ -7,6 +7,7 @@ use Sabre\VObject\Component\VCard; use Sabre\VObject\Document; use Sabre\VObject\EofException; +use Sabre\VObject\Node; use Sabre\VObject\ParseException; /** @@ -72,7 +73,7 @@ class MimeDir extends Parser * @param string|resource|null $input * @param int $options * - * @return Sabre\VObject\Document + * @return \Sabre\VObject\Document */ public function parse($input = null, $options = 0) { diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php index 0a6c7b637..90f262d9e 100644 --- a/lib/Parser/XML.php +++ b/lib/Parser/XML.php @@ -40,7 +40,7 @@ class XML extends Parser /** * Document, root component. * - * @var Sabre\VObject\Document + * @var \Sabre\VObject\Document */ protected $root; @@ -69,7 +69,7 @@ public function __construct($input = null, $options = 0) * * @throws \Exception * - * @return Sabre\VObject\Document + * @return \Sabre\VObject\Document */ public function parse($input = null, $options = 0) { diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php index 5db941c1e..7eb3e0bb7 100644 --- a/lib/Property/ICalendar/DateTime.php +++ b/lib/Property/ICalendar/DateTime.php @@ -131,7 +131,7 @@ public function isFloating() * * @param DateTimeZone $timeZone * - * @return DateTimeImmutable + * @return \DateTimeImmutable */ public function getDateTime(DateTimeZone $timeZone = null) { @@ -152,7 +152,7 @@ public function getDateTime(DateTimeZone $timeZone = null) * * @param DateTimeZone $timeZone * - * @return DateTimeImmutable[] + * @return \DateTimeImmutable[] * @return \DateTime[] */ public function getDateTimes(DateTimeZone $timeZone = null) diff --git a/lib/Splitter/ICalendar.php b/lib/Splitter/ICalendar.php index 0b2f8c180..79f7207fd 100644 --- a/lib/Splitter/ICalendar.php +++ b/lib/Splitter/ICalendar.php @@ -83,7 +83,7 @@ public function __construct($input, $options = 0) * * When the end is reached, null will be returned. * - * @return Sabre\VObject\Component|null + * @return \Sabre\VObject\Component|null */ public function getNext() { diff --git a/lib/Splitter/SplitterInterface.php b/lib/Splitter/SplitterInterface.php index f15c5e461..a2c43d662 100644 --- a/lib/Splitter/SplitterInterface.php +++ b/lib/Splitter/SplitterInterface.php @@ -32,7 +32,7 @@ public function __construct($input); * * When the end is reached, null will be returned. * - * @return Sabre\VObject\Component|null + * @return \Sabre\VObject\Component|null */ public function getNext(); } diff --git a/lib/Splitter/VCard.php b/lib/Splitter/VCard.php index 953be6be2..02509c6c3 100644 --- a/lib/Splitter/VCard.php +++ b/lib/Splitter/VCard.php @@ -55,7 +55,7 @@ public function __construct($input, $options = 0) * * When the end is reached, null will be returned. * - * @return Sabre\VObject\Component|null + * @return \Sabre\VObject\Component|null */ public function getNext() { diff --git a/lib/TimeZoneUtil.php b/lib/TimeZoneUtil.php index 9d2d34670..5b1a775c2 100644 --- a/lib/TimeZoneUtil.php +++ b/lib/TimeZoneUtil.php @@ -120,7 +120,7 @@ class TimeZoneUtil * @param string $tzid * @param Sabre\VObject\Component $vcalendar * - * @return DateTimeZone + * @return \DateTimeZone */ public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false) { diff --git a/lib/Writer.php b/lib/Writer.php index b589b4cc4..c70a6ae4d 100644 --- a/lib/Writer.php +++ b/lib/Writer.php @@ -58,10 +58,10 @@ public static function writeXml(Component $component) if ($component instanceof Component\VCalendar) { $writer->startElement('icalendar'); - $writer->writeAttribute('xmlns', Parser\Xml::XCAL_NAMESPACE); + $writer->writeAttribute('xmlns', Parser\XML::XCAL_NAMESPACE); } else { $writer->startElement('vcards'); - $writer->writeAttribute('xmlns', Parser\Xml::XCARD_NAMESPACE); + $writer->writeAttribute('xmlns', Parser\XML::XCARD_NAMESPACE); } $component->xmlSerialize($writer);