File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Url implements TrustedCallbackInterface {
1313 }
1414
1515 /**
16- * @return ($return_as_object ? \Drupal\Core\Access\AccessResultInterface : bool)
16+ * @return ($return_as_object is true ? \Drupal\Core\Access\AccessResultInterface : bool)
1717 */
1818 public function access(?\Drupal\Core\Session\AccountInterface $account = NULL, bool $return_as_object = FALSE): \Drupal\Core\Access\AccessResultInterface|bool {
1919 }
Original file line number Diff line number Diff line change 22
33namespace DrupalUrl ;
44
5+ use Drupal \Core \Access \AccessResultInterface ;
56use Drupal \Core \Url ;
67use Symfony \Component \HttpFoundation \Request ;
78use function PHPStan \Testing \assertType ;
2425assertType ('Drupal\Core\GeneratedUrl ' , Url::fromUri ('the_uri ' )->toString (TRUE ));
2526assertType ('Drupal\Core\GeneratedUrl ' , Url::fromUserInput ('user_input ' )->toString (TRUE ));
2627assertType ('Drupal\Core\GeneratedUrl ' , Url::createFromRequest (new Request ())->toString (TRUE ));
28+ assertType ('bool ' , (new Url ('route_name ' ))->access ());
29+ assertType (AccessResultInterface::class, (new Url ())->access (return_as_object: TRUE ));
30+ assertType ('bool ' , (new Url ())->access (return_as_object: FALSE ));
You can’t perform that action at this time.
0 commit comments