Skip to content

Commit

Permalink
Fix PHPStan warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Sep 16, 2022
1 parent f4d78b4 commit 8a7137b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: CI

on:
pull_request: null
push:
branches:
- master
- pull_request
- push

jobs:
tests:
runs-on: ubuntu-latest
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
Expand All @@ -27,6 +25,7 @@ jobs:
- run: composer phpunit

tests_lowest_dependencies:
name: Lowest dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -41,6 +40,7 @@ jobs:
- run: composer phpunit

test_coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -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
Expand All @@ -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
1 change: 0 additions & 1 deletion src/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions src/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Feed extends AbstractElement

/**
* @var array[]
*
* @phpstan-var array<array{ns: string, uri: string, name: string, value: string, attributes: string[]}>
*/
protected $customElements = [];
Expand Down Expand Up @@ -201,17 +202,16 @@ public function getSimpleXML(): SimpleXMLElement
public function getDocument(): DOMDocument
{
$node = dom_import_simplexml($this->getSimpleXML());
assert(false !== $node);
$no = $node->ownerDocument;
assert(null !== $no);

return $no;
}

/**
* @throws Exception
*
* @return false|string
*
* @throws Exception
*/
public function saveXML()
{
Expand Down

0 comments on commit 8a7137b

Please sign in to comment.