Skip to content

Commit 6a1a15b

Browse files
kocsismatecmb69
andauthored
Fix constructorsynopsis and destructorsynopsis validation (#84)
Co-authored-by: Christoph M. Becker <[email protected]>
1 parent 298fc93 commit 6a1a15b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/qa/section-order.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ function checkSectionErrors(string $path): array
177177

178178
/* Constructors are special */
179179
if (str_ends_with($path, 'construct.xml')) {
180-
if (!str_contains($content, '<constructorsynopsis>')
181-
&& !str_contains($content, '<constructorsynopsis role="oop">')
180+
if (!str_contains($content, '<constructorsynopsis>') &&
181+
!preg_match('/<constructorsynopsis role="[^"]*">/', $content)
182182
) {
183183
// This generates a lot of errors leave for later
184184
//return ["Constructors should use <constructorsynopsis> instead of <methodsynopsis>"];
@@ -191,7 +191,8 @@ function checkSectionErrors(string $path): array
191191
}
192192
/* Destructors are special */
193193
if (str_ends_with($path, 'destruct.xml')) {
194-
if (!str_contains($content, '<destructorsynopsis>')) {
194+
if (!str_contains($content, '<destructorsynopsis>') &&
195+
!preg_match('/<destructorsynopsis role="[^"]*">/', $content)) {
195196
// Early bail-out
196197
return ["Destructors should use <destructorsynopsis> instead of <methodsynopsis>"];
197198
}

0 commit comments

Comments
 (0)