Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for psalm 5 #133

Merged
merged 9 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require": {
"php": "^7.2 || ^8",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"vimeo/psalm": "^4.28"
"vimeo/psalm": "^4.28|^5.0"
},
"conflict": {
"doctrine/collections": "<1.8",
Expand All @@ -48,7 +48,8 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
}
},
"extra": {
Expand Down
3 changes: 3 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<file>stubs</file>
<file>tests</file>
<exclude-pattern>*/tests/_run/*</exclude-pattern>
<exclude-pattern>*/tests/_support/_generated/*</exclude-pattern>

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

<!-- conflicts with other rules -->
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" /> <!-- [> PSR12.Functions.ReturnTypeDeclaration <] -->
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/ReturnTypeProvider/CollectionFirstAndLast.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)
return null;
}

$childNode = $type->getChildNodes();
$childNode = $type->type_params;
if (! isset($childNode[1]) || ! $childNode[1] instanceof Type\Union) {
return null;
}
Expand Down
Loading