0

Take this random class

https://github.com/magento/magento2/blob/2.3/app/code/Magento/Checkout/Helper/Cart.php

Got a mixture of code comments for class, variables, constants, methods etc all nice and tidy. I'm finding it really time consuming to comment my code to this standard. This is something that the official coding standards picks up on. I guess I could not bother but does make life easier when returning to 'old' code.

https://github.com/magento/magento-coding-standard

I'm using VScode. Is there a plugin or something out there than can generate some of this for me? Happy to even look at other editors.

0

PHPstrorm does indeed automatically generate doc comments if you type /** and press [enter] above any class, method of variable.

https://www.jetbrains.com/phpstorm/

https://github.com/magento/magento2-phpstorm-plugin

This is a plugin for Magento 2 development in the PhpStorm IDE. It is available via the JetBrains Plugin Repository

Installation

  • Go to Settings / Preferences in the PhpStorm IDE
  • Navigate to "Plugins"
  • Click the "Browse repositories..." button and search for "Magento PhpStorm"
  • Install the plugin and restart PhpStorm
  • Go to Settings / Preferences / Languages & Frameworks / PHP / Magento in the PhpStorm IDE
  • Check "Enable" and "OK" button.

Gives you some added benefits over standard IDE functionality

  • Configuration smart completion and references for XML/JavaScript files
  • "Navigate to configuration" reference in scope of class/interface
  • "Go to plugin" reference in scope of class/interface and method
  • "Navigate to Web API configuration" reference in scope of class/interface and method

Update

Phpstorm functionality

https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-urn.html

Although can also be generated using above plugin

Can be helpful for debugging XML errors that are thrown in developer mode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.