Skip to content

Commit

Permalink
Allow applying the Param attribute at parameter level
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-granados committed Feb 12, 2024
1 parent a1e3eb9 commit 0f915c5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.0",
"php-static-analysis/attributes": "^0.1 || dev-main",
"php-static-analysis/node-visitor": "^0.1 || dev-main",
"php-static-analysis/attributes": "^0.1.1 || dev-main",
"php-static-analysis/node-visitor": "^0.1.1 || dev-main",
"phpstan/phpstan": "^1.8"
},
"require-dev": {
Expand Down
23 changes: 23 additions & 0 deletions tests/data/MethodParamAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,27 @@ public function countNamesAndNames(array $names): int
{
return count($names);
}

public function countNamesInParam(
#[Param('string[]')]
array $names
): int {
return count($names);
}

public function countNamesInParamWithName(
#[Param(names: 'string[]')]
array $names
): int {
return count($names);
}

public function countNamesInTwoParams(
#[Param('string[]')]
array $names1,
#[Param('string[]')]
array $names2
): int {
return count($names1) + count($names2);
}
}

0 comments on commit 0f915c5

Please sign in to comment.