Skip to content

Commit

Permalink
minor #20433 [HttpFoundation] Do not use named parameters in example …
Browse files Browse the repository at this point in the history
…(MrYamous)

This PR was squashed before being merged into the 7.2 branch.

Discussion
----------

[HttpFoundation] Do not use named parameters in example

Noticed from [blog article ](https://symfony.com/blog/new-in-symfony-7-2-misc-improvements-part-2#better-ip-address-anonymization)

The example in the blog seems to me to be the right one, parameters aren't actually implemented so using named paramets is not possible yet

Commits
-------

ec2743d [HttpFoundation] Do not use named parameters in example
  • Loading branch information
javiereguiluz committed Dec 5, 2024
2 parents bd7827a + ec2743d commit 8319ddf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,13 @@ of the ``anonymize()`` method to specify the number of bytes that should be
anonymized depending on the IP address format::

$ipv4 = '123.234.235.236';
$anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3);
$anonymousIpv4 = IpUtils::anonymize($ipv4, 3);
// $anonymousIpv4 = '123.0.0.0'

$ipv6 = '2a01:198:603:10:396e:4789:8e99:890f';
$anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10);
// (you must define the second argument (bytes to anonymize in IPv4 addresses)
// even when you are only anonymizing IPv6 addresses)
$anonymousIpv6 = IpUtils::anonymize($ipv6, 3, 10);
// $anonymousIpv6 = '2a01:198:603::'

.. versionadded:: 7.2
Expand Down

0 comments on commit 8319ddf

Please sign in to comment.