Skip to content

[Validator] Add documentation for the new SemVer constraint #21162

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

Open
wants to merge 4 commits into
base: 7.4
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update reference/constraints/SemVer.rst
  • Loading branch information
OskarStark authored Jun 30, 2025
commit f584de1a812b51a12e0ce0bd1c9327acf83c6918
1 change: 1 addition & 0 deletions reference/constraints/SemVer.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
SemVer
======

Validates that a value is a valid semantic version string according to the

Check failure on line 4 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please remove trailing whitespace
`Semantic Versioning`_ specification. This constraint supports various

Check failure on line 5 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please remove trailing whitespace
version formats including partial versions, pre-release versions, and

Check failure on line 6 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please remove trailing whitespace
build metadata.

.. versionadded:: 7.4

The ``SemVer`` constraint was introduced in Symfony 7.4.

========== ===================================================================
Expand Down Expand Up @@ -51,7 +52,7 @@

<class name="App\Entity\Package">
<property name="version">
<constraint name="SemVer" />

Check failure on line 55 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please remove space before "/>"
</property>
</class>
</constraint-mapping>
Expand All @@ -61,7 +62,7 @@
// src/Entity/Package.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Check failure on line 65 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Missing class] Class, interface or trait with name "Symfony\Component\Validator\Constraints" does not exist
use Symfony\Component\Validator\Mapping\ClassMetadata;

class Package
Expand All @@ -84,7 +85,7 @@

**type**: ``boolean`` **default**: ``false``

When set to ``true``, the version string must start with a "v" prefix

Check failure on line 88 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Lint (DOCtor-RST)

Please remove trailing whitespace
(e.g., "v1.2.3" instead of "1.2.3").

.. configuration-block::
Expand Down Expand Up @@ -133,7 +134,7 @@
// src/Entity/Package.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Check failure on line 137 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Missing class] Class, interface or trait with name "Symfony\Component\Validator\Constraints" does not exist
use Symfony\Component\Validator\Mapping\ClassMetadata;

class Package
Expand Down Expand Up @@ -202,7 +203,7 @@
// src/Entity/Package.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Check failure on line 206 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Missing class] Class, interface or trait with name "Symfony\Component\Validator\Constraints" does not exist
use Symfony\Component\Validator\Mapping\ClassMetadata;

class Package
Expand Down Expand Up @@ -271,7 +272,7 @@
// src/Entity/Package.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Check failure on line 275 in reference/constraints/SemVer.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Missing class] Class, interface or trait with name "Symfony\Component\Validator\Constraints" does not exist
use Symfony\Component\Validator\Mapping\ClassMetadata;

class Package
Expand Down
Loading