- Issue created by @Shanu Chouhan
- Issue was unassigned.
- Status changed to Needs review
over 2 years ago 10:37am 13 May 2023 - Status changed to Needs work
over 2 years ago 8:33am 14 May 2023 - š®š¹Italy apaderno Brescia, š®š¹
+/** + * {@inheritdoc} + */ class DecoupledOneTimeLoginMailer implements DecoupledOneTimeLoginMailerInterface {{@inheritdoc}is not used in the documentation comment for classes.+ /** + * The config factory used by the config entity query. + * + * @var \Drupal\Core\Config\ConfigFactoryInterface + */ protected ConfigFactoryInterface $configFactory;The config factory. is sufficient.
+ /** + * Constructs a EntityActionBase object. + * + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager + * The entity type manager. + * @param \Drupal\Core\Mail\MailManagerInterface $mail_manager + * The mail manager. + * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory + * The config factory. + */ + + /** + * Constructs a Plugin object. + */ public function __construct(EntityTypeManagerInterface $entity_type_manager, MailManagerInterface $mail_manager, ConfigFactoryInterface $config_factory) { $this->entityTypeManager = $entity_type_manager; $this->mailManager = $mail_manager; $this->configFactory = $config_factory; }There are two documentation comments for the same method, but neither of them are correct.
The description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.
The documentation comment for a method must also describe the parameters.+/** + * Provides an interface Decoupled One Time Login Mail. + */ interface DecoupledOneTimeLoginMailerInterface {It is not necessary to say that an interface provides an interface.
The description must say that the interface does.+ /** + * Constructs a cron object. + * + * @param \Drupal\Component\Datetime\TimeInterface $time + * The time service. + */ + + /** + * Constructs a Plugin object. + */ public function __construct(TimeInterface $time) { $this->time = $time; }Given than the class is
DecoupledOneTimeLoginTokens, how can the constructor construct a cron object?
Still, there are two documentation comments for the same method.+ /** + * Gets a one time login URL. + * + * @see user_pass_reset_url() + */ public function oneTimeLogin(UserInterface $account): string {Parameters and return value must be described.
+/** + * {@inheritdoc} + */ interface DecoupledOneTimeLoginTokensInterface {{@inheritdoc}is not used in the documentation comment for an interface./** + * Build email addresses. * * @EmailBuilder(The description must be less generic.
- Assigned to arpitk
- Issue was unassigned.
- Status changed to Needs review
over 2 years ago 10:25am 15 May 2023 - Status changed to Needs work
over 2 years ago 10:46am 15 May 2023 - š®š¹Italy apaderno Brescia, š®š¹
+/** + * @file + * Contains decoupled_one_time_login.module. + */ +The usual module description is Hook implementations for the [module name] module. where [module name] is replaced by the module name as shown in the .info.yml file.
+/** + * @file + * Hooks related to the Token system. + */Token must be spelled in lowercase characters, since it is not referring to a class.
+ /** + * The config factory used by the config entity query. + *It is sufficient to say The config factory.
+ /** + * Constructs a new DecoupledOneTimeLoginMailer object. + *The description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.+/** + * Provides Interface for Decoupled One Time Login Mail. + */ interface DecoupledOneTimeLoginMailerInterface {The description for an interface must not start with Provides Interface, Provides an interface, or similar phrases.
+ /** + * {@inheritdoc} + */ + public function sendMail(string $op = 'password_reset', AccountInterface $account = NULL, string $langcode = NULL);Since interfaces just define their own methods,
{@inheritdoc}is never used for interface methods.+ * @see user_pass_reset_url() + * + * @return string + * A string with one time login url.The line containing
@seemust be the last line in a documentation comment.
The return value description must describe what the return value is, not its type./** + * Defines the Email Builder plug-in for decoupled_one_time_login module.There is no need to say which module implements a class, nor even by giving the module machine name.
Email and Builder must be spelled with lowercase characters.
The description must say what the class does. - š®š¹Italy apaderno Brescia, š®š¹
+/** + * @file + * Hook implementations for the Decoupled on time login module. + */The module name reported in its .info.yml file is Decoupled one time login.
+/** + * Provides Interface for Decoupled One Time Login Mail. + */Similarly to what done for the other description, this description should be changed too.
+ /** + * Constructs a DecoupledOneTimeLoginTokens object. + * + * @param \Drupal\Component\Datetime\TimeInterface $timeThe description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.+ * @return string + * Returns one time login url.Return value descriptions must not start with Returns nor Return.
url is misspelled because it is an acronym and it must be written with uppercase letters.+/** + * Provides an interface defining oneTimeLogin tokens. + */The correct description is probably Provides an interface to handle one-time login tokens.
/** + * Defines the Email Builder plug-in for decoupled_one_time_login module. *There is no need to say which module implements that plugin. Instead, the description should say what that plugin does.
- Status changed to Needs review
over 2 years ago 12:36pm 18 May 2023 - Status changed to Needs work
over 1 year ago 12:14pm 7 June 2024 Hi @sakthi_dev,
Applied your patch successfully, however, it still threw an error. Please see below:
Giuseppe87-3359929 git:(main) curl https://www.drupal.org/files/issues/2023-05-18/phpcs-3360159-9.patch | patch -p1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 6572 100 6572 0 0 19711 0 --:--:-- --:--:-- --:--:-- 20159 patching file decoupled_one_time_login.module patching file decoupled_one_time_login.tokens.inc patching file src/DecoupledOneTimeLoginMailer.php patching file src/DecoupledOneTimeLoginMailerInterface.php patching file src/DecoupledOneTimeLoginTokens.php patching file src/DecoupledOneTimeLoginTokensInterface.php patching file src/Plugin/EmailBuilder/PasswordResetBuilder.php ā Giuseppe87-3359929 git:(main) ā Giuseppe87-3359929 git:(main) ā cd .. ā contrib git:(main) ā phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig Giuseppe87-3359929 FILE: ...es/contrib/Giuseppe87-3359929/src/DecoupledOneTimeLoginMailerInterface.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 12 | ERROR | [x] Missing function doc comment -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...web/modules/contrib/Giuseppe87-3359929/src/DecoupledOneTimeLoginMailer.php -------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE -------------------------------------------------------------------------------- 37 | WARNING | Line exceeds 80 characters; contains 90 characters -------------------------------------------------------------------------------- FILE: ...web/modules/contrib/Giuseppe87-3359929/src/DecoupledOneTimeLoginTokens.php -------------------------------------------------------------------------------- FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES -------------------------------------------------------------------------------- 21 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters 41 | ERROR | [x] Additional blank lines found at end of doc comment -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- Time: 169ms; Memory: 10MBKindly check.
Thanks,
Jake