francodacosta / sublime-php-getters-setters

generare getters and setters for php classes
Other
73 stars 32 forks source link

NameError: Custom Temaplate Breaks Plug-In #73

Open mariop08 opened 5 years ago

mariop08 commented 5 years ago

I tried registering a custom template with no comments and taking away some of the blank space. It seems to load it fine but breaks when it cannot find the template name.

class shinyTemplate(object): name = "shiny" style = 'camelCase' # can also be snakeCase getter = """ public function get%(normalizedName)s(){ return $this->%(name)s; } """

setter = """
public function set%(normalizedName)s(%(typeHint)s $%(name)s){ $this->%(name)s = $%(name)s; }
"""

Per another noted issue { "registerTemplates": ["shinyTemplate"], "template": "shiny" }

Output: [PHP Getters and Setters] Registered template : 'PSR2' [PHP Getters and Setters] Registered template : 'camelCase' [PHP Getters and Setters] Registered template : 'camelCaseFluent' [PHP Getters and Setters] Registered template : 'snakeCase' [PHP Getters and Setters] Registered template : 'snakeCaseFluent' [PHP Getters and Setters] ignored type hinting var types ['mixed', 'int', 'integer', 'double', 'float', 'number', 'string', 'boolean', 'bool', 'numeric', 'unknown'] [PHP Getters and Setters] template is 'shiny' [PHP Getters and Setters] register extra user templates ['shinyTemplate'] [PHP Getters and Setters] ignoring visibility to getters and setters [PHP Getters and Setters] setterBeforeGetter is False Traceback (most recent call last): File "/opt/sublime_text/sublime_plugin.py", line 298, in on_api_ready plc() File "/home/mario/.config/sublime-text-3/Installed Packages/PHP Getters and Setters.sublime-package/php-getter-setter.py", line 667, in plugin_loaded TemplateManager.register(eval(template+'()')) File "", line 1, in NameError: name 'shinyTemplate' is not defined