Skip to content

Commit 1535492

Browse files
Update rule metadata (#1535)
Co-authored-by: Nils Werner <[email protected]>
1 parent 223d706 commit 1535492

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S1172.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,31 @@ <h3>Exceptions</h3>
1111
function doSomething($a, $b) { // no issue reported on $b
1212
compute($a);
1313
}
14+
}
15+
</pre>
16+
<p>Additionally, methods with specific Magento plugin signatures are ignored because Magento requires these parameters:</p>
17+
<ul>
18+
<li> Methods starting with <code>before</code> and having at least 3 parameters </li>
19+
<li> Methods starting with <code>around</code> and having at least 4 parameters </li>
20+
<li> Methods starting with <code>after</code> and having at least 2 parameters </li>
21+
</ul>
22+
<pre>
23+
class ExamplePlugin {
24+
25+
public function beforeAction($subject, $arg1, $arg2) {
26+
// no issue on unused parameters, required by Magento plugin signature
27+
return;
28+
}
29+
30+
public function aroundAction($subject, callable $proceed, $arg1, $arg2) {
31+
// no issue on unused parameters, required by Magento plugin signature
32+
return;
33+
}
1434

35+
public function afterAction($subject, $result) {
36+
// no issue on unused parameters, required by Magento plugin signature
37+
return;
38+
}
1539
}
1640
</pre>
1741
<h2>How to fix it</h2>

php-checks/src/main/resources/org/sonar/l10n/php/rules/php/S1192.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ <h3>Exceptions</h3>
66
<ul>
77
<li> strings with less than 5 characters </li>
88
<li> strings with only letters, numbers, underscores, hyphens and periods </li>
9+
<li> Laravel validation strings (e.g., <code>"required"</code>, <code>"max:100"</code>, <code>"email:rfc"</code>) </li>
10+
<li> Drupal form keys (e.g., <code>"#type"</code>, <code>"#title"</code>) </li>
911
</ul>
1012
<h2>How to fix it</h2>
1113
<p>Use constants to replace the duplicated string literals. Constants can be referenced from many places, but only need to be updated in a single

sonarpedia.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"languages": [
44
"PHP"
55
],
6-
"latest-update": "2025-10-14T11:24:50.059480881Z",
6+
"latest-update": "2025-10-24T11:56:49.402952492Z",
77
"options": {
88
"no-language-in-filenames": true,
99
"preserve-filenames": true

0 commit comments

Comments
 (0)