Skip to content

[Validator] Misc tweaks in MacAddress and Charset constraints #19866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions reference/constraints/Charset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Options

An encoding or a set of encodings to check against. If you pass an array of
encodings, the validator will check if the value is encoded in *any* of the
encodings. This option accepts any value that can be passed to
:phpfunction:`mb_detect_encoding`.
encodings. This option accepts any value that can be passed to the
:phpfunction:`mb_detect_encoding` PHP function.

.. include:: /reference/constraints/_groups-option.rst.inc

Expand Down
14 changes: 7 additions & 7 deletions reference/constraints/MacAddress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ Basic Usage
-----------

To use the MacAddress validator, apply it to a property on an object that
will contain a host name.
can contain a MAC address:

.. configuration-block::

.. code-block:: php-attributes

// src/Entity/Author.php
// src/Entity/Device.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Author
class Device
{
#[Assert\MacAddress]
protected string $mac;
Expand All @@ -39,7 +39,7 @@ will contain a host name.
.. code-block:: yaml

# config/validator/validation.yaml
App\Entity\Author:
App\Entity\Device:
properties:
mac:
- MacAddress: ~
Expand All @@ -52,7 +52,7 @@ will contain a host name.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="App\Entity\Author">
<class name="App\Entity\Device">
<property name="max">
<constraint name="MacAddress"/>
</property>
Expand All @@ -61,13 +61,13 @@ will contain a host name.

.. code-block:: php

// src/Entity/Author.php
// src/Entity/Device.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;

class Author
class Device
{
// ...

Expand Down
Loading