Skip to content

Conversation

@fadrian06
Copy link

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

There was a dead code in Auth::register and Auth::createUserFor because $credentials is not defined, using $userData allows to execute possible callables passed as id.

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Related Issue

Before

$auth = new Leaf\Auth;

$auth->register([
  'id' => static fn(): string => uniqid(),
]); // Object of class Closure could not be converted to string

After

$auth = new Leaf\Auth;

$auth->register([
  'id' => static fn(): string => 'abc',
]);

echo $auth->id(); // 'abc';

@fadrian06 fadrian06 changed the title $credentials is not defined in Auth::register and Auth::createUserFor feat: allow callable for ids on register Nov 5, 2025
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