View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
15380 | Bug reports | Plugins | public | 2019-10-07 16:07 | 2020-01-17 14:14 |
Reporter | bismark | Assigned To | cdorin | ||
Priority | none | Severity | minor | ||
Status | closed | Resolution | no change required | ||
Summary | 15380: Create class or Interface for PluginEvent with names as constants | ||||
Description | this helps for IDE-Code Completion e.g.
| ||||
Tags | No tags attached. | ||||
Bug heat | 12 | ||||
Complete LimeSurvey version number (& build) | develop | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | 10.1.26-MariaDB | ||||
Server OS (if known) | |||||
Webserver software & version (if known) | |||||
PHP Version | 7.1.8 | ||||
more benefits:
|
|
can an interface include constants? |
|
My opinion :
Sometimes i'm unsure add CONSTANT make more readable code : https://github.com/LimeSurvey/LimeSurvey/blob/6cba3e0c964df2cc8430e103b0fa6baec3e97480/application/helpers/questionHelper.php#L71 Auto documentation with such solution can not include input and output |
|
I agree with Bismark, it would be very useful for future development. use MabeEnum\Enum;
additionally benefits:
Example: Events:: EV_A()->is(Events::EV_B()); //false |
|
@c_schmitz, can you comment on this? For us - and other plugin developers - it would be pretty useful and I am rather sure it will not have any side effects when adding this to the core. |
|
I created an example and uploaded to a fork in GitHub. |
|
as wished I added a smaller commit. |
|
|
|
Did we really need the _ in constant name ? |
|
1) I will do an example if this is what you mean. the question: Yes, we need them. It is defined in PSR-1 section 1. Look at https://www.php-fig.org/psr/psr-1/ |
|
Not with mandatoty underscore (or ?), we are on https://www.php-fig.org/psr/psr-2/ About 2 : i don't know … if i know i don't need to ask … but if you have a Class to manage event : this class must offer same service to plugins. I know it's currently just an Enum and nothing else, but : evolution … |
|
We are on https://www.php-fig.org/psr/psr-1/ as I quotedt. :) "Class constants MUST be declared in all upper case with underscore separators.", the underscores in constants are mandatory. |
|
Const NOUNDERSCORE is valid … underscore is not mandatory … About 2 : then you say plugin can not create event … in think it's a mistake |
|
PSR-2 is regarded as deprecated and replaced with PSR-12. But anyway it's a recommendation. I personally prefery underscore for better reading. I can read EVENT_NAME_IN_CAMEL_CASE better than EVENTNAMEINCAMELCASE. 2) I never mentioned that a plugin can't dispatch an event. Of course it can. The SOLID principle describes how classes should be designed. The S means "Single responsitivity". The class "GlobalEvents" only should provide the constants for events. |
|
About underscore : yes
Yes, i think we need to mind of possible evolution at start of development, even if we don't add it concretely (no code, just some doc on How we can do in future, possible evolution). |
|
Ah ok. :) Events: <code php>class LimeSurveyEvents extends mabe/Enum</code> <code php>class GlobalEvents extens LimeSurveyEvents</code> Event dispatcher allows LimeSurveyEvents Your plugin has an own class SondagesProEvents And now the dispatcher would accept custom events. |
|
Ah ok. :) Events:
Event dispatcher allows LimeSurveyEvents Your plugin has an own class SondagesProEvents
And now the dispatcher would accept custom events. PS: Sorry for the douple post. I'm just learning the system. |
|
@DenisChenu |
|
Didn't really know :) sorry … |
|
OK. :) Let's see if there is any development in this direction. |
|
@dschirge : remind : i am not in LimeSurveyy internal team, then : https://manual.limesurvey.org/How_to_contribute_new_features @cdorin ? @c_schmitz ? @ollehar ? for discussion. |
|
@DenisChenu: Sorry, didn't know. I am still new to LS. |
|
@dschirge: At today's developer meeting it was concluded that the gain of the suggested improvement is minimal so it was decided to close this one for now. |
|
@cdorin, please close this one. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2019-10-07 16:07 | bismark | New Issue | |
2019-10-07 16:58 | bismark | Note Added: 53930 | |
2019-10-08 14:32 | ollehar | Note Added: 53948 | |
2019-10-08 15:28 | DenisChenu | Note Added: 53953 | |
2019-10-09 14:15 | dschirge | Note Added: 53973 | |
2019-10-09 15:03 | Mazi | Note Added: 53974 | |
2019-10-11 22:26 | dschirge | Note Added: 54013 | |
2019-11-12 14:55 | DenisChenu | Issue Monitored: DenisChenu | |
2019-11-12 20:26 | dschirge | Note Added: 54550 | |
2019-11-13 10:25 | DenisChenu | Note View State: 54013: private | |
2019-11-13 10:25 | DenisChenu | Note View State: 54013: public | |
2019-11-13 10:32 | DenisChenu | Note Added: 54551 | |
2019-11-13 10:32 | DenisChenu | Note Edited: 54551 | |
2019-11-13 10:35 | DenisChenu | Note Added: 54552 | |
2019-11-13 10:35 | DenisChenu | Note Edited: 54552 | |
2019-11-13 10:46 | dschirge | Note Added: 54553 | |
2019-11-13 10:50 | DenisChenu | Note Added: 54555 | |
2019-11-13 10:54 | dschirge | Note Added: 54556 | |
2019-11-13 10:57 | DenisChenu | Note Added: 54557 | |
2019-11-13 11:07 | dschirge | Note Added: 54558 | |
2019-11-13 11:15 | DenisChenu | Note Added: 54559 | |
2019-11-13 11:27 | dschirge | Note Added: 54561 | |
2019-11-13 11:32 | dschirge | Note Added: 54562 | |
2019-12-19 05:57 | dschirge | Note Added: 55070 | |
2019-12-19 08:10 | DenisChenu | Note Added: 55071 | |
2019-12-19 12:15 | dschirge | Note Added: 55075 | |
2019-12-19 12:19 | DenisChenu | Note Added: 55076 | |
2019-12-19 12:24 | dschirge | Note Added: 55077 | |
2020-01-14 15:25 | Mazi | Note Added: 55234 | |
2020-01-14 15:25 | Mazi | Note Added: 55235 | |
2020-01-17 14:14 | cdorin | Assigned To | => cdorin |
2020-01-17 14:14 | cdorin | Status | new => closed |
2020-01-17 14:14 | cdorin | Resolution | open => no change required |
2021-08-03 10:27 | guest | Bug heat | 10 => 12 |