Skip to content

Commit 1b670de

Browse files
authored
Merge pull request #133 from nesl247/patch-1
feat: add support for psalm 5
2 parents a55e727 + c8e301e commit 1b670de

File tree

5 files changed

+370
-48
lines changed

5 files changed

+370
-48
lines changed

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"require": {
2828
"php": "^7.2 || ^8",
2929
"composer/semver": "^1.4 || ^2.0 || ^3.0",
30-
"vimeo/psalm": "^4.28"
30+
"vimeo/psalm": "^4.28|^5.0"
3131
},
3232
"conflict": {
3333
"doctrine/collections": "<1.8",
@@ -48,7 +48,8 @@
4848
"config": {
4949
"sort-packages": true,
5050
"allow-plugins": {
51-
"dealerdirect/phpcodesniffer-composer-installer": true
51+
"dealerdirect/phpcodesniffer-composer-installer": true,
52+
"composer/package-versions-deprecated": true
5253
}
5354
},
5455
"extra": {

phpcs.xml.dist

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<file>stubs</file>
1313
<file>tests</file>
1414
<exclude-pattern>*/tests/_run/*</exclude-pattern>
15+
<exclude-pattern>*/tests/_support/_generated/*</exclude-pattern>
1516

1617
<!-- Include full Doctrine Coding Standard -->
1718
<rule ref="Doctrine">
@@ -30,6 +31,8 @@
3031
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint" />
3132
<exclude name="SlevomatCodingStandard.Namespaces.UseSpacing.IncorrectLinesCountBetweenDifferentTypeOfUse" />
3233
<exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore" />
34+
<!-- Psalm uses snake case for properties -->
35+
<exclude name="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps" />
3336

3437
<!-- conflicts with other rules -->
3538
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" /> <!-- [> PSR12.Functions.ReturnTypeDeclaration <] -->

src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)
9393
return null;
9494
}
9595

96-
$childNode = $type->getChildNodes();
96+
$childNode = $type->type_params;
9797
if (! isset($childNode[1]) || ! $childNode[1] instanceof Type\Union) {
9898
return null;
9999
}

0 commit comments

Comments
 (0)