mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Clean up issues list, add documentation to help with named variadic confusion. (#5511)
* Clean up issues list, add documentation to help with named variadic confusion. * Add ComplexFunction and ComplexMethod back to issues list. I removed them because the documentation files don't exist, but they're used and the documentation just needs to be added.
This commit is contained in:
parent
6bd7f5b867
commit
3ce41d71a4
@ -84,6 +84,7 @@
|
||||
- [InvalidTemplateParam](issues/InvalidTemplateParam.md)
|
||||
- [InvalidThrow](issues/InvalidThrow.md)
|
||||
- [InvalidToString](issues/InvalidToString.md)
|
||||
- [InvalidTraversableImplementation](issues/InvalidTraversableImplementation.md)
|
||||
- [InvalidTypeImport](issues/InvalidTypeImport.md)
|
||||
- [LessSpecificImplementedReturnType](issues/LessSpecificImplementedReturnType.md)
|
||||
- [LessSpecificReturnStatement](issues/LessSpecificReturnStatement.md)
|
||||
@ -92,6 +93,7 @@
|
||||
- [MethodSignatureMismatch](issues/MethodSignatureMismatch.md)
|
||||
- [MethodSignatureMustOmitReturnType](issues/MethodSignatureMustOmitReturnType.md)
|
||||
- [MismatchingDocblockParamType](issues/MismatchingDocblockParamType.md)
|
||||
- [MismatchingDocblockPropertyType](issues/MismatchingDocblockPropertyType.md)
|
||||
- [MismatchingDocblockReturnType](issues/MismatchingDocblockReturnType.md)
|
||||
- [MissingClosureParamType](issues/MissingClosureParamType.md)
|
||||
- [MissingClosureReturnType](issues/MissingClosureReturnType.md)
|
||||
@ -126,7 +128,10 @@
|
||||
- [MoreSpecificImplementedParamType](issues/MoreSpecificImplementedParamType.md)
|
||||
- [MoreSpecificReturnType](issues/MoreSpecificReturnType.md)
|
||||
- [MutableDependency](issues/MutableDependency.md)
|
||||
- [NamedArgumentNotAllowed](issues/NamedArgumentNotAllowed.md)
|
||||
- [NoInterfaceProperties](issues/NoInterfaceProperties.md)
|
||||
- [NonInvariantDocblockPropertyType](issues/NonInvariantDocblockPropertyType.md)
|
||||
- [NonInvariantPropertyType](issues/NonInvariantPropertyType.md)
|
||||
- [NonStaticSelfCall](issues/NonStaticSelfCall.md)
|
||||
- [NoValue](issues/NoValue.md)
|
||||
- [NullableReturnStatement](issues/NullableReturnStatement.md)
|
||||
@ -144,6 +149,8 @@
|
||||
- [ParadoxicalCondition](issues/ParadoxicalCondition.md)
|
||||
- [ParamNameMismatch](issues/ParamNameMismatch.md)
|
||||
- [ParentNotFound](issues/ParentNotFound.md)
|
||||
- [ParseError](issues/ParseError.md)
|
||||
- [PluginIssue](issues/PluginIssue.md)
|
||||
- [PossibleRawObjectIteration](issues/PossibleRawObjectIteration.md)
|
||||
- [PossiblyFalseArgument](issues/PossiblyFalseArgument.md)
|
||||
- [PossiblyFalseIterator](issues/PossiblyFalseIterator.md)
|
||||
@ -186,6 +193,8 @@
|
||||
- [PropertyNotSetInConstructor](issues/PropertyNotSetInConstructor.md)
|
||||
- [PropertyTypeCoercion](issues/PropertyTypeCoercion.md)
|
||||
- [RawObjectIteration](issues/RawObjectIteration.md)
|
||||
- [RedundantCast](issues/RedundantCast.md)
|
||||
- [RedundantCastGivenDocblockType](issues/RedundantCastGivenDocblockType.md)
|
||||
- [RedundantCondition](issues/RedundantCondition.md)
|
||||
- [RedundantConditionGivenDocblockType](issues/RedundantConditionGivenDocblockType.md)
|
||||
- [RedundantIdentityWithTrue](issues/RedundantIdentityWithTrue.md)
|
||||
|
@ -13,6 +13,16 @@ $arr = [
|
||||
];
|
||||
```
|
||||
|
||||
This can be caused by variadic arguments if `@no-named-arguments` is not specified:
|
||||
|
||||
```php
|
||||
<?php
|
||||
function foo($bar, ...$baz): array
|
||||
{
|
||||
return [$bar, ...$baz]; // $baz is array<array-key, mixed> since it can have named arguments
|
||||
}
|
||||
```
|
||||
|
||||
## How to fix
|
||||
|
||||
Remove the offending duplicates:
|
||||
|
@ -12,3 +12,14 @@ function foo(array $a) : void {
|
||||
/** @param string[] $a */
|
||||
function takesStringArray(array $a) : void {}
|
||||
```
|
||||
|
||||
This can happen with variadic arguments when `@no-named-arguments` is not specified:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
/** @param list<int> $args */
|
||||
function foo(int ...$args): array {
|
||||
return $args; // $args is array<array-key, int> since it can have named arguments
|
||||
}
|
||||
```
|
||||
|
@ -12,3 +12,14 @@ function foo(array $a) : array {
|
||||
return $a;
|
||||
}
|
||||
```
|
||||
|
||||
This can happen with variadic arguments when `@no-named-arguments` is not specified:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
/** @return list<int> */
|
||||
function foo(int ...$args): array {
|
||||
return $args; // $args is array<array-key, int> since it can have named arguments
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user