Skip to content

Commit

Permalink
minor #54644 [Serializer] add method parameters in final class (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 7.1 branch.

Discussion
----------

[Serializer] add method parameters in final class

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

56ce439 add method parameters in final class
  • Loading branch information
nicolas-grekas committed Apr 18, 2024
2 parents df033a0 + 56ce439 commit 1e2c337
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function __construct(
) {
}

/**
* @param class-string|null $class
* @param string|null $format
* @param array<string, mixed> $context
*/
public function normalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string
{
if (null === $this->attributes || \in_array($propertyName, $this->attributes, true)) {
Expand All @@ -45,6 +50,11 @@ public function normalize(string $propertyName/* , ?string $class = null, ?strin
return $propertyName;
}

/**
* @param class-string|null $class
* @param string|null $format
* @param array<string, mixed> $context
*/
public function denormalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string
{
$class = 1 < \func_num_args() ? func_get_arg(1) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
) {
}

public function normalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string
public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string
{
$class = 1 < \func_num_args() ? func_get_arg(1) : null;
$format = 2 < \func_num_args() ? func_get_arg(2) : null;
Expand All @@ -58,7 +58,7 @@ public function normalize(string $propertyName/* , ?string $class = null, ?strin
return self::$normalizeCache[$class][$propertyName] ?? $this->normalizeFallback($propertyName, $class, $format, $context);
}

public function denormalize(string $propertyName/* , ?string $class = null, ?string $format = null, array $context = [] */): string
public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string
{
$class = 1 < \func_num_args() ? func_get_arg(1) : null;
$format = 2 < \func_num_args() ? func_get_arg(2) : null;
Expand Down

0 comments on commit 1e2c337

Please sign in to comment.