diff --git a/.gitattributes b/.gitattributes
index b157bef..a9c1856 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,7 @@
# Ignore all test and documentation with “export-ignore”.
/.gitattributes export-ignore
/.gitignore export-ignore
-/.php_cs export-ignore
+/.php-cs-fixer.php export-ignore
/.github export-ignore
/README.md export-ignore
/phpunit.xml export-ignore
diff --git a/.gitignore b/.gitignore
index 3bc18f6..3bca77e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
/vendor/
-/.php-cs-fixer.cache
-/.phpunit.result.cache
+/.*.cache
/tests-report-html/
/composer.lock
-/coverage.xml
\ No newline at end of file
+/coverage.xml
diff --git a/composer.json b/composer.json
index d0883fb..fdb36f9 100644
--- a/composer.json
+++ b/composer.json
@@ -26,6 +26,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^1.0",
+ "phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
diff --git a/phpstan.neon b/phpstan.neon
index fe322e2..74fd7ea 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,3 +1,5 @@
includes:
+ - vendor/phpstan/phpstan-phpunit/extension.neon
+ - vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
\ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
index 96ca32c..01dcc3a 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -3,15 +3,15 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
+
+
+ src
+ tests
+
+
tests
-
-
- src
- tests
-
-
\ No newline at end of file
diff --git a/src/Feed.php b/src/Feed.php
index 2d0d31d..cc17d35 100644
--- a/src/Feed.php
+++ b/src/Feed.php
@@ -3,6 +3,7 @@
namespace AtomGenerator;
use DOMDocument;
+use Exception;
use LibXMLError;
use SimpleXMLElement;
use Webmozart\Assert\Assert;
@@ -37,7 +38,7 @@ class Feed extends AbstractElement
protected $generatorUri;
/**
- * @var mixed[][]
+ * @var array[]
* @phpstan-var array
*/
protected $customElements = [];
@@ -169,6 +170,9 @@ public function addChildrenTo(SimpleXMLElement $parent): void
}
}
+ /**
+ * @throws Exception
+ */
public function getSimpleXML(): SimpleXMLElement
{
$attributes = [];
@@ -191,6 +195,9 @@ public function getSimpleXML(): SimpleXMLElement
return $xml;
}
+ /**
+ * @throws Exception
+ */
public function getDocument(): DOMDocument
{
$node = dom_import_simplexml($this->getSimpleXML());
@@ -202,6 +209,8 @@ public function getDocument(): DOMDocument
}
/**
+ * @throws Exception
+ *
* @return false|string
*/
public function saveXML()
diff --git a/tests/FeedTest.php b/tests/FeedTest.php
index 09c4ca8..fc7586a 100644
--- a/tests/FeedTest.php
+++ b/tests/FeedTest.php
@@ -5,6 +5,7 @@
use AtomGenerator\Entry;
use AtomGenerator\Feed;
use DateTime;
+use Exception;
use InvalidArgumentException;
use LibXMLError;
use PHPUnit\Framework\TestCase;
@@ -22,6 +23,9 @@ final class FeedTest extends TestCase
/** @var bool reset file contents */
protected static $reset = false;
+ /**
+ * @throws Exception
+ */
public function testFeedCreation1(): void
{
$feed = new Feed();
@@ -72,6 +76,9 @@ public function testFeedCreation1(): void
self::assertXmlStringEqualsXmlFile(self::TEST_FEED_XML_PATH_1, $xml);
}
+ /**
+ * @throws Exception
+ */
public function testFeedCreation2(): void
{
$feed = new Feed();
@@ -104,6 +111,9 @@ public function testFeedCreation2(): void
self::assertXmlStringEqualsXmlFile(self::TEST_FEED_XML_PATH_2, $xml);
}
+ /**
+ * @throws Exception
+ */
public function testFeedCreation3(): void
{
$feed = new Feed();
@@ -132,6 +142,9 @@ public function testFeedCreation3(): void
self::assertXmlStringEqualsXmlFile(self::TEST_FEED_XML_PATH_3, $xml);
}
+ /**
+ * @throws Exception
+ */
public function testFeedCreation4(): void
{
$sourceFeed = new Feed();
@@ -198,6 +211,8 @@ public function testFeedCreationException3(): void
/**
* @codeCoverageIgnore
+ *
+ * @throws Exception
*/
public function testFeedCreationException4(): void
{