Skip to content

Commit

Permalink
Update method and dependency management
Browse files Browse the repository at this point in the history
Refactor `generateParameterCode` to handle attributes irrespective of PHP version. Update composer dependencies to the latest versions for improved compatibility and security.
  • Loading branch information
koriym committed Nov 15, 2024
1 parent 7f1328f commit 56177ec
Show file tree
Hide file tree
Showing 3 changed files with 406 additions and 245 deletions.
6 changes: 1 addition & 5 deletions src/MethodSignatureString.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ private function formatArg($name, $value): string
private function generateParameterCode(ReflectionParameter $param): string
{
// Support attributes
$attributesStr = '';
if (PHP_MAJOR_VERSION >= 8) {
$attributesStr = $this->getAttributeStr($param);
}

$attributesStr = $this->getAttributeStr($param);
$typeStr = ($this->typeString)($param->getType());
$typeStrWithSpace = $typeStr ? $typeStr . ' ' : $typeStr;
$variadicStr = $param->isVariadic() ? '...' : '';
Expand Down
2 changes: 1 addition & 1 deletion tests/Fake/FakePhp8Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function method24() {}
public function method25(
#[FakeAttr1]
$a,
#[FakeAttri1, FakeAttr2]
#[FakeAttr1, FakeAttr2]
$b
): void {}
}
Loading

0 comments on commit 56177ec

Please sign in to comment.