Skip to content

[Validator] Fix PHPDoc of generate file#1792

Open
lyrixx wants to merge 1 commit intosymfony:1.xfrom
lyrixx:validator
Open

[Validator] Fix PHPDoc of generate file#1792
lyrixx wants to merge 1 commit intosymfony:1.xfrom
lyrixx:validator

Conversation

@lyrixx
Copy link
Copy Markdown
Member

@lyrixx lyrixx commented Apr 3, 2026

/** is replaced by /* by php-cs-fixer (or something else) because
the var is not bellow this line.

So this line become useless.

By moving to a @param we fix this issue.


For reference:

>/tmp symfony new --webapp maker-bundle

 INFO  A new Symfony CLI version is available (5.16.1, currently running
5.8.14).

       If you installed the Symfony CLI via a package manager, updates
are going to be automatic.
       If not, upgrade by downloading the new version at
https://github.com/symfony-cli/symfony-cli/releases
       And replace the current binary (symfony) by the new one.

* Creating a new Symfony project with Composer
  (running /home/gregoire/.local/bin/composer create-project
symfony/skeleton /tmp/maker-bundle  --no-interaction)

* Setting up the project under Git version control
  (running git init /tmp/maker-bundle)

  (running /home/gregoire/.local/bin/composer require webapp
--no-interaction)

 [OK] Your project is now ready in /tmp/maker-bundle

>/tmp cd  maker-bundle
/tmp/maker-bundle
>/tmp/maker-bundle(main) bin/console make:validator Foobar
 created: src/Validator/FoobarValidator.php
 created: src/Validator/Foobar.php

  Success!

 Next: Open your new constraint & validators and add your logic.
 Find the documentation at
http://symfony.com/doc/current/validation/custom_constraint.html

>/tmp/maker-bundle(main %) rg constraint src/Validator/
src/Validator/FoobarValidator.php
5:use Symfony\Component\Validator\Constraint;
6:use Symfony\Component\Validator\ConstraintValidator;
8:final class FoobarValidator extends ConstraintValidator
10:    public function validate(mixed $value, Constraint $constraint):
       void
12:        /* @var Foobar $constraint */
19:        $this->context->buildViolation($constraint->message)

`/**` is replaced by `/*` by php-cs-fixer (or something else) because
the var is not bellow this line.

So this line become useless.

By moving to a `@param` we fix this issue.

---

For reference:

```
>/tmp symfony new --webapp maker-bundle

 INFO  A new Symfony CLI version is available (5.16.1, currently running
5.8.14).

       If you installed the Symfony CLI via a package manager, updates
are going to be automatic.
       If not, upgrade by downloading the new version at
https://github.com/symfony-cli/symfony-cli/releases
       And replace the current binary (symfony) by the new one.

* Creating a new Symfony project with Composer
  (running /home/gregoire/.local/bin/composer create-project
symfony/skeleton /tmp/maker-bundle  --no-interaction)

* Setting up the project under Git version control
  (running git init /tmp/maker-bundle)

  (running /home/gregoire/.local/bin/composer require webapp
--no-interaction)

 [OK] Your project is now ready in /tmp/maker-bundle

>/tmp cd  maker-bundle
/tmp/maker-bundle
>/tmp/maker-bundle(main) bin/console make:validator Foobar
 created: src/Validator/FoobarValidator.php
 created: src/Validator/Foobar.php

  Success!

 Next: Open your new constraint & validators and add your logic.
 Find the documentation at
http://symfony.com/doc/current/validation/custom_constraint.html

>/tmp/maker-bundle(main %) rg constraint src/Validator/
src/Validator/FoobarValidator.php
5:use Symfony\Component\Validator\Constraint;
6:use Symfony\Component\Validator\ConstraintValidator;
8:final class FoobarValidator extends ConstraintValidator
10:    public function validate(mixed $value, Constraint $constraint):
       void
12:        /* @var Foobar $constraint */
19:        $this->context->buildViolation($constraint->message)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants