Child pages
  • Automatic class name retrieving based on it's filename
Skip to end of metadata
Go to start of metadata

Imported From:

I propose we auto-guess php class name based on filename, where that class is stored.

For example "my_super_helper.php" file will contain "MySuperHelper" class and nothing other.

There are several benefits of this:

  • no need to specify class name in unit config file (only class filename remains)
  • developer will be forced to properly name class file to connect it's class to the system

This large change, since we need to rename most of our classes/files to keep everything workings. That's why I propose this change to be made as part of 5.2.0 release.

Related Tasks

INP-683 - Getting issue details... STATUS


  1. This is interesting idea and I do see noted by you advantages, but that
    means that we'll have different names inside of Unit folders then?

    Now they kind of nice:




  2. We'll make some presumptions, that:

       - "eh" will transform to "EventHandler"
       - "tp" will transform to "TagProcessor"
       - all classes from "core" module, that are not event handler/tag
       processor should have "k" in front of their name

    You have mistyped paths, here is fixed version:


    Added parts are marked with bold.

  3. A lot of work, I think we can go this way.

    How about we list some samples here of the real classes how they are now and
    would look after conversion? Would you please do this?

    Also, what others think about this - Gleb, Sergey, Erik, Nikita - everyone
    please post your opinion here since it will reflect on you guys.



  4. Before:

       - UsersEventHandler, users_event_handler.php
       - UserGroupsEventHandler, user_groups_eh.php
       - kThemesHelper, themes_helper.php
       - CustomFieldsEventHandler, custom_fields_tag_processor.php


       - UserEventHandler, user_eh.php
       - UserGroupEventHandler, user_group_eh.php
       - kThemeHelper, theme_helper.php
       - CustomFieldEventHandler, custom_field_tp.php

  5. Thanks for posting.

    I like new format and idea!


  6. Task:

    INP-683 - Getting issue details... STATUS