Skip to content

Commit 7c6af38

Browse files
author
André L F S Bacci
committed
qaxml.t.php: tests for spurious ws in some tags.
1 parent a2f73fb commit 7c6af38

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

scripts/translation/qaxml.w.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* +----------------------------------------------------------------------+
4+
* | Copyright (c) 1997-2023 The PHP Group |
5+
* +----------------------------------------------------------------------+
6+
* | This source file is subject to version 3.01 of the PHP license, |
7+
* | that is bundled with this package in the file LICENSE, and is |
8+
* | available through the world-wide-web at the following url: |
9+
* | https://www.php.net/license/3_01.txt. |
10+
* | If you did not receive a copy of the PHP license and are unable to |
11+
* | obtain it through the world-wide-web, please send a note to |
12+
* | [email protected], so we can mail you a copy immediately. |
13+
* +----------------------------------------------------------------------+
14+
* | Authors: André L F S Bacci <ae php.net> |
15+
* +----------------------------------------------------------------------+
16+
* | Description: Checks for ws that may cause render trouble. |
17+
* +----------------------------------------------------------------------+
18+
*/
19+
20+
require_once __DIR__ . '/lib/all.php';
21+
22+
$qalist = QaFileInfo::cacheLoad();
23+
$outarg = new OutputIgnoreArgv( $argv );
24+
25+
foreach ( $qalist as $qafile )
26+
{
27+
$source = $qafile->sourceDir . '/' . $qafile->file;
28+
$target = $qafile->targetDir . '/' . $qafile->file;
29+
30+
whitespaceCheckFile( $source );
31+
whitespaceCheckFile( $target );
32+
}
33+
34+
function whitespaceCheckFile( string $filename )
35+
{
36+
if ( file_exists( $filename ) == false )
37+
return;
38+
39+
global $outarg;
40+
$output = new OutputIgnoreBuffer( $outarg , "qaxml.w: {$filename}\n\n" , $filename );
41+
42+
$xml = XmlUtil::loadFile( $filename );
43+
$tags = XmlUtil::listNodeType( $xml , XML_ELEMENT_NODE );
44+
45+
foreach( $tags as $node )
46+
{
47+
switch ( $node->nodeName )
48+
{
49+
case "classname":
50+
case "constant":
51+
case "function":
52+
case "methodname":
53+
case "varname":
54+
$text = $node->nodeValue;
55+
$trim = trim( $text );
56+
if ( $text != $trim )
57+
{
58+
$output->addLine();
59+
$output->add( " {$node->nodeName} {$trim}\n" );
60+
}
61+
break;
62+
}
63+
}
64+
65+
$output->print();
66+
}
67+

0 commit comments

Comments
 (0)