Skip to content

Commit

Permalink
Quality of Life (#108)
Browse files Browse the repository at this point in the history
* adjusted code for Psalm ^5.4
* allowed Composer plugins for infection/extension-installer
* moved PHP 8.2 to regular CI workflow, allowed failures on PHP 8.3 nightly
  • Loading branch information
thunderer committed Jan 14, 2023
1 parent 3072ceb commit 65d8b29
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
php: ['7.4', '8.0', '8.1']
php: ['7.4', '8.0', '8.1', '8.2']
os: ['ubuntu-latest']
failure: [false]
include:
- { php: '8.2', os: 'ubuntu-latest', failure: true } # '8.2' means 'nightly'
- { php: '8.3', os: 'ubuntu-latest', failure: true } # '8.3' means 'nightly'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v2'
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Expand Up @@ -30,5 +30,10 @@
"symfony/yaml": "if you want to use YAML serializer",
"ext-dom": "if you want to use XML serializer",
"ext-json": "if you want to use JSON serializer"
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
}
}
}
1 change: 0 additions & 1 deletion src/Parser/RegularParser.php
Expand Up @@ -142,7 +142,6 @@ private function shortcode(array &$names)
}

$this->beginBacktrack();
/** @psalm-suppress MixedArgumentTypeCoercion */
$contentMatchedShortcodes = $this->shortcode($names);
if(\is_string($contentMatchedShortcodes)) {
$closingName = $contentMatchedShortcodes;
Expand Down
4 changes: 3 additions & 1 deletion src/Serializer/XmlSerializer.php
Expand Up @@ -88,6 +88,7 @@ public function unserialize($text)
if($shortcode->length !== 1) {
throw new \InvalidArgumentException('Invalid shortcode XML!');
}
/** @psalm-suppress PossiblyNullArgument */
$name = $this->getAttribute($shortcode->item(0), 'name');

$bbCode = $this->getValue($xpath->query('/shortcode/bbCode'));
Expand All @@ -98,6 +99,7 @@ public function unserialize($text)
for($i = 0; $i < $elements->length; $i++) {
$node = $elements->item($i);

/** @psalm-suppress PossiblyNullReference */
$parameters[$this->getAttribute($node, 'name')] = $node->hasChildNodes() ? $node->nodeValue : null;
}

Expand All @@ -111,6 +113,7 @@ public function unserialize($text)
*/
private function getValue(\DOMNodeList $node)
{
/** @psalm-suppress PossiblyNullReference,PossiblyNullPropertyFetch */
return $node->length === 1 && $node->item(0)->hasChildNodes()
? $node->item(0)->nodeValue
: null;
Expand All @@ -119,7 +122,6 @@ private function getValue(\DOMNodeList $node)
/**
* @param \DOMNode $node
* @param string $name
* @psalm-suppress UnusedParam
*
* @return string
*/
Expand Down

0 comments on commit 65d8b29

Please sign in to comment.