Skip to content
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

The 'Validate' attribute works with a string passed #48

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Alejinho
Copy link

@Alejinho Alejinho commented Dec 21, 2023

Fix the Validate Attribute. Currently the 'rule' argument passed to the Validate constructor is normalized but if the variable type is string, then it's not handled properly. Now the Validate attribute works properly if it's initialized with something like this:

<?php

class Foo {
  public function bar(
    #[Validate('some-rule')]
    string $name
  ): string {
    return 'ok';
  }
}

Fix the 'Validate' Attribute. Currently the 'rule' property passed to
the Validate constructor was normalized but wrong value was checked.
Now the Validate attribute should works properly if it's initialized
with something like this:

```php
<?php

class Foo {
  public function bar(
    #[Validate('some-rule')]
    string $name
  ): string {
    return 'ok';
  }
}
```
@Alejinho Alejinho closed this Dec 22, 2023
@Alejinho Alejinho reopened this Dec 22, 2023
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.

1 participant