|
1 | 1 | <?php |
2 | 2 |
|
3 | | -function simple_example() { |
| 3 | +function simple_example() |
| 4 | +{ |
4 | 5 | $password = user_password(); |
5 | 6 | $other_password = user_password(8); |
6 | 7 | $password_length = 12; |
7 | 8 | $last_password = user_password($password_length); |
8 | 9 | } |
| 10 | + |
9 | 11 | ?> |
10 | 12 | ----- |
11 | 13 | <?php |
12 | 14 |
|
13 | | -function simple_example() { |
14 | | - $password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', function () { |
15 | | - return user_password(); |
16 | | - }, function () { |
17 | | - return \Drupal::service('password_generator')->generate(); |
18 | | - }); |
19 | | - $other_password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', function () { |
20 | | - return user_password(8); |
21 | | - }, function () { |
22 | | - return \Drupal::service('password_generator')->generate(8); |
23 | | - }); |
| 15 | +function simple_example() |
| 16 | +{ |
| 17 | + $password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', fn() => user_password(), fn() => \Drupal::service('password_generator')->generate()); |
| 18 | + $other_password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', fn() => user_password(8), fn() => \Drupal::service('password_generator')->generate(8)); |
24 | 19 | $password_length = 12; |
25 | | - $last_password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', function () use ($password_length) { |
26 | | - return user_password($password_length); |
27 | | - }, function () use ($password_length) { |
28 | | - return \Drupal::service('password_generator')->generate($password_length); |
29 | | - }); |
| 20 | + $last_password = \Drupal\Component\Utility\DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '9.1.0', fn() => user_password($password_length), fn() => \Drupal::service('password_generator')->generate($password_length)); |
30 | 21 | } |
| 22 | + |
31 | 23 | ?> |
0 commit comments