Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It is common practice to use exclamation marks to indicate special conditions on parameters.
This should be permitted without giving the error:
Parameter comment must end with a full stop.
Simple case:
/**
* Supplies a basic menu item product.
*
* @param string $title
* Required !
* @param string $path
* Required !
*
* @return \Drupal\ooe\Menu\IMenuItem
* A new menu item.
*/
public function newMenuItem($title, $path);
More complex case:
/**
* Add a validation handler to a form.
*
* @param array $form
* A Drupal form array.
* @param string $validatorMethodName
* The name of a _static_ validator method (only) with signature
* ($form, &$form_state); DO NOT include the class name !
*/
protected function addValidateHandler(array &$form, $validatorMethodName) {
Comments
Comment #1
webel CreditAttribution: webel commentedAnother example of using '!' exclamation mark as caution in a parameter comment:
Comment #3
klausiCommitted a fix to allow "!" and "?", thanks for reporting!
Comment #4
webel CreditAttribution: webel commented@klausi Confirmed with latest 8.x-2.x-dev, works, thanks this is a very useful improvement.