diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8d3779b..ae960f7 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -47,9 +47,8 @@ jobs: with: # Should be the higest supported version, so we can use the newest tools php-version: '8.3' - tools: composer, composer-require-checker, composer-unused, phpcs, psalm - # optional performance gain for psalm: opcache - extensions: ctype, dom, filter, opcache, pcre, spl, xml + tools: composer, composer-require-checker, composer-unused, phpcs, phpstan + extensions: ctype, dom, filter, pcre, spl, xml coverage: none - name: Setup problem matchers for PHP @@ -82,26 +81,13 @@ jobs: - name: PHP Code Sniffer run: phpcs - - name: Psalm - run: | - psalm -c psalm.xml \ - --show-info=true \ - --shepherd \ - --php-version=${{ steps.setup-php.outputs.php-version }} - - - name: Psalm (testsuite) + - name: PHPStan run: | - psalm -c psalm-dev.xml \ - --show-info=true \ - --shepherd \ - --php-version=${{ steps.setup-php.outputs.php-version }} + phpstan analyze -c phpstan.neon - - name: Psalter + - name: PHPStan (testsuite) run: | - psalm --alter \ - --issues=UnnecessaryVarAnnotation \ - --dry-run \ - --php-version=${{ steps.setup-php.outputs.php-version }} + phpstan analyze -c phpstan-dev.neon security: name: Security checks diff --git a/phpstan-dev.neon b/phpstan-dev.neon new file mode 100644 index 0000000..57972f5 --- /dev/null +++ b/phpstan-dev.neon @@ -0,0 +1,4 @@ +parameters: + level: 6 + paths: + - tests diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..db37782 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + level: 6 + paths: + - src diff --git a/psalm-dev.xml b/psalm-dev.xml deleted file mode 100644 index 6116331..0000000 --- a/psalm-dev.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index b5c19c0..0000000 --- a/psalm.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/SOAP11/XML/env/Body.php b/src/SOAP11/XML/env/Body.php index f9012c4..efd876f 100644 --- a/src/SOAP11/XML/env/Body.php +++ b/src/SOAP11/XML/env/Body.php @@ -44,7 +44,7 @@ final class Body extends AbstractSoapElement /** * Initialize a soap:Body * - * @param \SimpleSAML\XML\ElementInterface[] $children + * @param list<\SimpleSAML\XML\SerializableElementInterface> $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct(array $children = [], array $namespacedAttributes = []) diff --git a/src/SOAP11/XML/env/Envelope.php b/src/SOAP11/XML/env/Envelope.php index 7c7e279..4adeb26 100644 --- a/src/SOAP11/XML/env/Envelope.php +++ b/src/SOAP11/XML/env/Envelope.php @@ -37,7 +37,7 @@ final class Envelope extends AbstractSoapElement * * @param \SimpleSAML\SOAP11\XML\env\Body $body * @param \SimpleSAML\SOAP11\XML\env\Header|null $header - * @param \SimpleSAML\XML\ElementInterface[] $children + * @param list<\SimpleSAML\XML\SerializableElementInterface> $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( diff --git a/src/SOAP12/XML/env/Body.php b/src/SOAP12/XML/env/Body.php index 2288740..a10128d 100644 --- a/src/SOAP12/XML/env/Body.php +++ b/src/SOAP12/XML/env/Body.php @@ -36,8 +36,8 @@ final class Body extends AbstractSoapElement /** * Initialize a soap:Body * - * @param \SimpleSAML\SOAP12\XML\Fault|null $fault - * @param \SimpleSAML\XML\ElementInterface[] $children + * @param \SimpleSAML\SOAP12\XML\env\Fault|null $fault + * @param list<\SimpleSAML\XML\SerializableElementInterface> $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( diff --git a/src/SOAP12/XML/env/Code.php b/src/SOAP12/XML/env/Code.php index 8f6b7a8..f4c2dd8 100644 --- a/src/SOAP12/XML/env/Code.php +++ b/src/SOAP12/XML/env/Code.php @@ -24,13 +24,14 @@ final class Code extends AbstractSoapElement * Initialize a soap:Code * * @param \SimpleSAML\SOAP12\XML\env\Value $value - * @param \SimpleSAML\SOAP12\XML\env\Code|null $code + * @param \SimpleSAML\SOAP12\XML\env\Subcode|null $subcode */ public function __construct( protected Value $value, protected ?Subcode $subcode = null ) { @list($prefix, $localName) = preg_split('/:/', $value->getContent(), 2); + /** @var string|null $localName */ if ($localName === null) { // We don't have a prefixed value here $localName = $prefix; diff --git a/src/SOAP12/XML/env/NotUnderstood.php b/src/SOAP12/XML/env/NotUnderstood.php index f6cf300..714d35b 100644 --- a/src/SOAP12/XML/env/NotUnderstood.php +++ b/src/SOAP12/XML/env/NotUnderstood.php @@ -66,6 +66,7 @@ private static function parseQName(string $qName): array Assert::validQName($qName); @list($prefix, $localName) = preg_split('/:/', $qName, 2); + /** @var string|null $localName */ if ($localName === null) { $prefix = null; $localName = $qName; @@ -115,9 +116,8 @@ public function toXML(DOMElement $parent = null): DOMElement list($prefix, $localName) = self::parseQName($this->getQName()); $namespaceUri = $this->getContentNamespaceUri(); - /** @psalm-suppress RedundantConditionGivenDocblockType */ if ($namespaceUri !== null && $prefix !== null) { - /** @psalm-suppress TypeDoesNotContainNull */ + /** @phpstan-ignore-next-line */ if ($e->lookupNamespaceUri($prefix) === null && $e->lookupPrefix($namespaceUri) === null) { // The namespace is not yet available in the document - insert it $e->setAttribute('xmlns:' . $prefix, $namespaceUri); diff --git a/src/SOAP12/XML/env/Subcode.php b/src/SOAP12/XML/env/Subcode.php index bf5e50c..3aecf7a 100644 --- a/src/SOAP12/XML/env/Subcode.php +++ b/src/SOAP12/XML/env/Subcode.php @@ -21,7 +21,7 @@ final class Subcode extends AbstractSoapElement * Initialize a soap:Subcode * * @param \SimpleSAML\SOAP12\XML\env\Value $value - * @param \SimpleSAML\SOAP12\XML\env\Code|null $code + * @param \SimpleSAML\SOAP12\XML\env\Subcode|null $subcode */ public function __construct( protected Value $value,