graphqlite-laravel icon indicating copy to clipboard operation
graphqlite-laravel copied to clipboard

The 'Validate' attribute works with a string passed

Open Alejinho opened this issue 1 year ago • 0 comments

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';
  }
}

Alejinho avatar Dec 21 '23 21:12 Alejinho