Skip to content

Commit 823c027

Browse files
committed
Fix headings
1 parent 00e5f9a commit 823c027

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/plugins/from-4-to-5.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
Update Plugins for Mautic 5
2-
=======================================
2+
###########################
33

44
Here is a list of steps that most of the Plugins may need to take to upgrade from Mautic 4 to Mautic 5. You should be able to get through each step, make a commit, move to the next one and once you are at finished you have upgraded your Plugin.
55

66
Continuous Integration
7-
-------------------------
7+
**********************
88

99
If you don't have CI configured, this is the time to do it. This is an optional step but it makes sense to do it at the beginning rather than later. Here's how to get it done: :doc:`/plugins/continuous-integration`.
1010

1111
In your PR add also support for PHP 8.1 and 8.2, and upgrade the Mautic version from 4.4 to 5.1. One more thing is that Mautic 5 have ``local.php`` in ``config/local.php`` instead of ``app/config/local.php`` so update that as well.
1212

1313
Autowiring
14-
-------------
14+
**********
1515

1616
Mautic 5 comes with autowiring of PHP services which means the developer experience is much improved, and the code size is reduced.
1717

@@ -24,7 +24,7 @@ To quickly verify that the wiring of services is complete and configured correct
2424
.. note:: Ideally, you should be able to delete the whole ``services`` section from your ``config.php`` file, but do that as a cherry on top once you are sure everything is working as the later steps in this process may yet cause you difficulties.
2525

2626
``config.php`` - controllers
27-
---------------------------
27+
****************************
2828

2929
``config.php`` should be much lighter now when all services are gone after autowiring is configured. There is one more thing to verify. The controllers are now defined with a different syntax. Here is an example:
3030

@@ -36,7 +36,7 @@ To quickly verify that the wiring of services is complete and configured correct
3636
Symfony 5 is much 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` any more.
3737

3838
Rendering views
39-
------------------
39+
***************
4040

4141
As Symfony 5 removed the PHP templating engine, Mautic had to switch to Twig. Your Plugin must also update the any views from PHP to Twig. Here is a helpful resource on how to migrate the ``*.html.php`` files to ``*.html.twig`` files:
4242

@@ -58,7 +58,7 @@ Running this command is faster than refreshing all the views in the browser. It
5858
.. vale off
5959
6060
The Integration class
61-
------------------------
61+
*********************
6262

6363
.. vale on
6464
@@ -72,7 +72,7 @@ If you went ahead and deleted all services from ``config.php``, you may experien
7272
.. note:: Replace `[MY_INTEGRATION]` with your Plugin name.
7373

7474
Compiler passes
75-
------------------
75+
***************
7676

7777
If your Plugin uses a compiler pass, you may have to verify that it works correctly. In many cases you may have to change the service alias with FQCN like so:
7878

@@ -82,7 +82,7 @@ If your Plugin uses a compiler pass, you may have to verify that it works correc
8282
+ ->setDecoratedService(EmailType::class, 'mautic.form.type.email.inner')
8383
8484
Getting container in tests
85-
-----------------------------
85+
**************************
8686

8787
This one is a quick find and replace:
8888

@@ -94,7 +94,7 @@ This one is a quick find and replace:
9494
Notice you can also use FQCN instead of string service keys which is more convenient.
9595

9696
Automated refactoring
97-
------------------------
97+
**********************
9898

9999
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. Rector can upgrade the code for you.
100100

@@ -103,14 +103,14 @@ Run ``bin/rector process plugins/MyBundle`` and review the changes.
103103
.. note:: Update MyBundle with your bundle name.
104104

105105
Automated code style
106-
-----------------------
106+
********************
107107

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

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

112112
Static analysis
113-
-------------------
113+
***************
114114

115115
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.
116116

@@ -119,6 +119,6 @@ Run ``composer phpstan``
119119
If your Plugin has more PHPSTAN errors than you can handle right now, consider using :xref:`PHPSTAN baseline`. It allows you to store your tech debt to a single file and it forces you to write better code from now on. And you can reduce the baseline by small chunks every month to get to 0.
120120

121121
Conclusion
122-
----------
122+
**********
123123

124124
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 commit comments

Comments
 (0)