From 5f239a063afafb8396bcc2953deb83feae8b0951 Mon Sep 17 00:00:00 2001 From: Damien Debin Date: Fri, 16 Sep 2022 12:42:43 +0200 Subject: [PATCH] Fix PHPStan warnings --- .github/workflows/main.yaml | 16 ++++++++-------- src/AbstractElement.php | 1 - src/Feed.php | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 12c5d09..2d0fe09 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,10 +1,8 @@ name: CI on: - pull_request: null - push: - branches: - - master + - pull_request + - push jobs: tests: @@ -12,7 +10,7 @@ jobs: strategy: matrix: php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] - name: PHP ${{ matrix.php }} tests + name: PHP ${{ matrix.php }} steps: - uses: actions/checkout@v2 # required for "git tag" presence for MonorepoBuilder split and ChangelogLinker git tags resolver; default is 1 @@ -27,6 +25,7 @@ jobs: - run: composer phpunit tests_lowest_dependencies: + name: Lowest dependencies runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -41,6 +40,7 @@ jobs: - run: composer phpunit test_coverage: + name: Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -56,10 +56,9 @@ jobs: composer coverage # codecov.io bash <(curl -s https://codecov.io/bash) - env: - CODECOV_TOKEN: 'de38eee4-bbc9-43bc-811c-c96a7d6ec3b6' php-cs-fixer: + name: PHP CS Fixer runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -73,12 +72,13 @@ jobs: - run: composer php-cs-fixer-dry-run phpstan: + name: PHPStan runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: shivammathur/setup-php@v2 with: - php-version: 7.1 + php-version: 8.1 coverage: none - run: composer install --no-progress - run: composer phpstan \ No newline at end of file diff --git a/src/AbstractElement.php b/src/AbstractElement.php index 91f07e3..b11838c 100644 --- a/src/AbstractElement.php +++ b/src/AbstractElement.php @@ -219,7 +219,6 @@ protected static function addChildWithTypeToElement(SimpleXMLElement $parent, st protected static function addCData(string $cdataText, SimpleXMLElement $element): void { $node = dom_import_simplexml($element); - assert(false !== $node); $no = $node->ownerDocument; assert(null !== $no); $node->appendChild($no->createCDATASection($cdataText)); diff --git a/src/Feed.php b/src/Feed.php index cc17d35..6b24954 100644 --- a/src/Feed.php +++ b/src/Feed.php @@ -39,6 +39,7 @@ class Feed extends AbstractElement /** * @var array[] + * * @phpstan-var array */ protected $customElements = []; @@ -201,7 +202,6 @@ public function getSimpleXML(): SimpleXMLElement public function getDocument(): DOMDocument { $node = dom_import_simplexml($this->getSimpleXML()); - assert(false !== $node); $no = $node->ownerDocument; assert(null !== $no); @@ -209,9 +209,9 @@ public function getDocument(): DOMDocument } /** - * @throws Exception - * * @return false|string + * + * @throws Exception */ public function saveXML() {