- Issue created by @Rajan Kumar
- Status changed to Needs review
over 1 year ago 7:11am 8 May 2023 - @rajan-kumar opened merge request.
- Status changed to RTBC
over 1 year ago 7:52am 8 May 2023 - Status changed to Fixed
over 1 year ago 7:54am 8 May 2023
FILE: /var/www/html/my-drupal10-site/web/modules/contrib/twilio/twilio.module
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------
17 | WARNING | [ ] Global constants should not be used, move it to a class or interface
18 | WARNING | [ ] Global constants should not be used, move it to a class or interface
40 | WARNING | [x] There must be no blank line following an inline comment
40 | WARNING | [ ] There must be no blank line following an inline comment
107 | WARNING | [x] There must be no blank line following an inline comment
107 | WARNING | [ ] There must be no blank line following an inline comment
You can use phpcs to see this warnings
1. Create in the folder of your module the 'src' folder.
2. Create the 'MymoduleInterface.php' file and put it into the 'src' folter.
/mymodule/src/MymoduleInterface.php
3. Insert into the 'MymoduleInterface.php' the code like this:
<?php
namespace Drupal\mymodule;
/**
* Provides an interface for mymodule constants.
*/
interface MymoduleInterface {
/**
* The description of the constant.
*/
const MYMODULE_CONST = 42;
}
4. Add this interface into the 'use' section of the 'mymodule.module' file:
use Drupal\mymodule\MymoduleInterface;
That's all, now you can use the constant in your module like this:
MymoduleInterface::MYMODULE_CONST;
Fixed
Code