Skip to content

Commit a7049bb

Browse files
author
James Calcaben
committed
Fix typos and make minor structural changes
1 parent 832e42b commit a7049bb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

guides/v2.0/extension-dev-guide/plugins.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ class ProductPlugin
134134
?>
135135
{% endhighlight %}
136136

137-
When you wrap a method which accepts arguments, your plugin must also accept those arguments and you must forward them on when you invoke the <code>proceed</code> callable. You must be careful to match the original signature of the method with regards to default parameters and type hints. For example, the following code defines a parameter of type <code>SomeType>/code> which is nullable:
137+
When you wrap a method which accepts arguments, your plugin must also accept those arguments and you must forward them when you invoke the <code>proceed</code> callable. You must be careful to match the original signature of the method with regards to default parameters and type hints.
138+
139+
For example, the following code defines a parameter of type <code>SomeType</code> which is nullable:
138140

139141
{% highlight PHP %}
140142
<?php
@@ -168,7 +170,7 @@ class MyUtilityPlugin
168170
169171
Note the missing <code>= null</code>. Now, if the original method was called with <code>null</code> PHP would throw a fatal error as your plugin does not accept <code>null</code>.
170172

171-
It is also worth noting that you are responsible for forwarding the arguments from the plugin to the <code>proceed</code> callable. If you are not using/modifying the agurments, you could use variadics and argument unpacking to achieve this simply:
173+
It is also worth noting that you are responsible for forwarding the arguments from the plugin to the <code>proceed</code> callable. If you are not using/modifying the arguments, you could use variadics and argument unpacking to achieve this simply:
172174

173175
{% highlight PHP %}
174176
<?php

0 commit comments

Comments
 (0)