Skip to content

Commit

Permalink
Vale
Browse files Browse the repository at this point in the history
  • Loading branch information
escopecz committed Apr 25, 2024
1 parent d43ed26 commit 0f21002
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions docs/plugins/from-4-to-5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ config.php should be way lighter now when all services are gone after autowiring
- 'controller' => 'CronfigBundle:Cronfig:index',
+ 'controller' => 'MauticPlugin\CronfigBundle\Controller\CronfigController::indexAction'
Symfony 5 is way more explicit. We like that. You don't have to guess what the syntax is. It's basically just standard FQCN (Fully Qualified Class Name) with the full method name behind the 2 colons. You don't even need to call the controller method `*Action` anymore. Your choice.
Symfony 5 is way more explicit. That's a good thing even if it's longer! You don't have to guess what the syntax is. It's basically just standard FQCN (Fully Qualified Class Name) with the full method name behind the 2 colons. You don't even need to call the controller method `*Action` anymore. Your choice.

Check failure on line 36 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Exclamation] Don't use exclamation points in text. Raw Output: {"message": "[Google.Exclamation] Don't use exclamation points in text.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 36, "column": 71}}}, "severity": "ERROR"}

4. Rendering views
4. Rendering Views

Check warning on line 38 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Headings] '4. Rendering Views' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] '4. Rendering Views' should use sentence-style capitalization.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 38, "column": 1}}}, "severity": "WARNING"}

Check warning on line 38 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.HeadingPunctuation] Don't put a period at the end of a heading. Raw Output: {"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 38, "column": 1}}}, "severity": "WARNING"}
------------------

As the PHP templating engine was removed from Symfony 5, Mautic had to switch to Twig. And your plugin must follow. Here is a helpful resource on how to migrate the `*.html.php` files to `*.html.twig` files:
As the PHP templating engine was removed from Symfony 5, Mautic had to switch to Twig. And your Plugin must follow. Here is a helpful resource on how to migrate the `*.html.php` files to `*.html.twig` files:

Check failure on line 41 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'PHP' instead of 'php'. Raw Output: {"message": "[Vale.Terms] Use 'PHP' instead of 'php'.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 41, "column": 174}}}, "severity": "ERROR"}

https://github.com/mautic/mautic/blob/5.x/UPGRADE-PHP-TO-TWIG-TEMPLATES.md

Expand All @@ -58,17 +58,17 @@ Running this command is faster than refreshing all the views in the browser. It
5. The Integration Class

Check warning on line 58 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Headings] '5. The Integration Class' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] '5. The Integration Class' should use sentence-style capitalization.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 58, "column": 1}}}, "severity": "WARNING"}

Check warning on line 58 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.HeadingPunctuation] Don't put a period at the end of a heading. Raw Output: {"message": "[Google.HeadingPunctuation] Don't put a period at the end of a heading.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 58, "column": 1}}}, "severity": "WARNING"}
------------------------

If you went ahead and deleted all services from config.php with a smile on your face, you may find yourself in a pickle if you are using Mautic's Integration classes and interfaces. The inner workings of the IntegrationsBundle expects that your integration has a service key in a specific format. This should be improved for Mautic 6, but for now add an alias to services.php:
If you went ahead and deleted all services from ``config.php`` with a smile on your face, you may find yourself in a pickle if you are using Mautic's Integration classes and interfaces. The inner workings of the IntegrationsBundle expects that your integration has a service key in a specific format. This should be improved for Mautic 6, but for now add an alias to ``services.php``:

.. code:: php
$services->alias('mautic.integration.[MY_INTEGRAION]', \MauticPlugin\[MY_INTEGRAION]Bundle\Integration\[MY_INTEGRAION]Integration::class);

Check failure on line 64 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Mautic' instead of 'mautic'. Raw Output: {"message": "[Vale.Terms] Use 'Mautic' instead of 'mautic'.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 64, "column": 22}}}, "severity": "ERROR"}
.. note:: Replace `[MY_INTEGRAION]` with your plugin name.
.. note:: Replace `[MY_INTEGRAION]` with your Plugin name.

6. Compiler passes
6. Compiler Passes

Check warning on line 68 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Google.Headings] '6. Compiler Passes' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] '6. Compiler Passes' should use sentence-style capitalization.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 68, "column": 1}}}, "severity": "WARNING"}
------------------

If you plugin uses a compliler pass, you may have to double-check that it works correctly. In many cases you may have to change the service alias with FQCN like so:
If you Plugin uses a compiler pass, you may have to double-check that it works correctly. In many cases you may have to change the service alias with FQCN like so:

.. code:: diff
Expand All @@ -87,23 +87,23 @@ This one is a quick find and replace:
Notice you can also use FQCN instead of string service keys which is more convenient.

8. Automated refactoring
8. Automated Refactoring
------------------------

Your plugin should be working on Mautic 5 by now. But let's go further as Mautic 5 uses PHP 8+ we can take advantage of the syntax. And Rector upgrade the code for you.
Your Plugin should be working on Mautic 5 by now. Wouldn't it be great to shorten the code a little more? Mautic 5 uses PHP 8.0+ so can take advantage of the syntax. And Rector can upgrade the code for you.

Run ``bin/rector process plugins/MyBundle`` and review the changes.

.. note:: Update MyBundle with your bundle name.

9. Automated code style
9. Automated Code Style
-----------------------

Another great way how to improve your plugin code base quality is to run the CS Fixer: `bin/php-cs-fixer fix plugins/MyBundle`.
Another great way how to improve your Plugin code base quality is to run the CS Fixer: `bin/php-cs-fixer fix plugins/MyBundle`.

Check failure on line 102 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'PHP' instead of 'php'. Raw Output: {"message": "[Vale.Terms] Use 'PHP' instead of 'php'.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 102, "column": 93}}}, "severity": "ERROR"}

Check failure on line 102 in docs/plugins/from-4-to-5.rst

View workflow job for this annotation

GitHub Actions / prose

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'Plugins' instead of 'plugins'. Raw Output: {"message": "[Vale.Terms] Use 'Plugins' instead of 'plugins'.", "location": {"path": "docs/plugins/from-4-to-5.rst", "range": {"start": {"line": 102, "column": 110}}}, "severity": "ERROR"}

.. note:: Update MyBundle with your bundle name.

10. Static analysis
10. Static Analysis
-------------------

PHPSTAN is another amazing tool that detects bugs for you. It's better to run it on the whole codebase including core Mautic so it's aware of all classes.
Expand All @@ -115,4 +115,4 @@ If your plugin has way too many PHPSTAN errors than you can handle right now, co
Conclusion
----------

This list of steps is compiled by Mautic plugin developers for the Mautic plugin developers. If you find that some common problem isn't addressed here, please add it.
This list of steps is compiled by Mautic Plugin developers for the Mautic Plugin developers. If you find that some common problem isn't addressed here, please add it.

0 comments on commit 0f21002

Please sign in to comment.