Skip to content

Commit f7a6d25

Browse files
committed
add docbook-cs, squash for testing
1 parent 7c966c9 commit f7a6d25

8 files changed

Lines changed: 157 additions & 45 deletions

File tree

.github/workflows/check-whitespace.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/docbook-cs.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# https://docs.github.com/en/actions
2+
3+
name: "DocBook Lint"
4+
5+
on:
6+
push:
7+
pull_request:
8+
branches:
9+
- "master"
10+
11+
permissions:
12+
contents: "read"
13+
14+
concurrency:
15+
group: "${{ github.workflow }}-${{ github.ref }}"
16+
cancel-in-progress: true
17+
18+
jobs:
19+
docbook-cs:
20+
name: "DocBook Style Check"
21+
runs-on: "ubuntu-latest"
22+
23+
env:
24+
# Base commit to diff against: PR base on pull_request, pre-push tip on push.
25+
BASE_SHA: |-
26+
${{
27+
case(
28+
github.event_name == 'pull_request', github.event.pull_request.base.sha,
29+
github.event_name == 'push', github.event.before,
30+
'INVALID'
31+
)
32+
}}
33+
34+
strategy:
35+
matrix:
36+
language:
37+
- "en"
38+
39+
steps:
40+
- name: "Checkout php/doc-${{ matrix.language }}"
41+
uses: "actions/checkout@v6"
42+
with:
43+
ref: "${{ github.event.pull_request.head.sha }}"
44+
path: "${{ matrix.language }}"
45+
fetch-depth: 50
46+
47+
- name: "Checkout php/doc-base"
48+
uses: "actions/checkout@v6"
49+
with:
50+
path: "doc-base"
51+
repository: "php/doc-base"
52+
53+
- name: "Checkout php/docbook-cs"
54+
uses: "actions/checkout@v6"
55+
with:
56+
path: "docbook-cs"
57+
repository: "php/docbook-cs"
58+
59+
- name: "Fetch diff base"
60+
working-directory: "${{ matrix.language }}"
61+
run: |
62+
git fetch origin "$BASE_SHA" --depth=50
63+
# Deepen until the merge-base is reachable (long-lived branches)
64+
for i in 1 2 3 4 5; do
65+
git merge-base "$BASE_SHA" HEAD >/dev/null 2>&1 && break
66+
git fetch --deepen=100 origin "$BASE_SHA"
67+
done
68+
69+
- name: "Setup PHP"
70+
uses: "shivammathur/setup-php@v2"
71+
with:
72+
php-version: "8.5"
73+
extensions: "dom, libxml, simplexml"
74+
tools: composer, cs2pr
75+
76+
- name: "Build documentation"
77+
run: |
78+
php doc-base/configure.php \
79+
--disable-libxml-check \
80+
--enable-xml-details \
81+
--redirect-stderr-to-stdout \
82+
--with-lang=${{ matrix.language }}
83+
84+
- name: "Install docbook-cs"
85+
working-directory: "docbook-cs"
86+
run: composer install --no-interaction --no-progress
87+
88+
- name: "Run docbook-cs with diff"
89+
working-directory: "${{ matrix.language }}"
90+
run: |
91+
set -o pipefail
92+
git diff "$BASE_SHA"...HEAD | php ../docbook-cs/bin/docbook-cs \
93+
--report=checkstyle \
94+
--diff \
95+
--no-colors > docbook-report.xml
96+
97+
- name: "Upload report"
98+
if: ${{ ! cancelled() }}
99+
uses: "actions/upload-artifact@v7"
100+
with:
101+
name: "docbook-report"
102+
path: "${{ matrix.language }}/docbook-report.xml"
103+
104+
- name: "Annotate PR with violations"
105+
if: ${{ ! cancelled() }}
106+
working-directory: "${{ matrix.language }}"
107+
run: cs2pr docbook-report.xml --colorize --prepend-filename

docbookcs.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<docbookcs xmlns="https://php.github.io/docbook-cs/config"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://php.github.io/docbook-cs/config
5+
https://php.github.io/docbook-cs/config.xsd">
6+
7+
<project>
8+
<directory alias="doc-en">en</directory>
9+
<directory>doc-base</directory>
10+
</project>
11+
12+
<sniffs>
13+
<sniff class="DocbookCS\Sniff\SimparaSniff" />
14+
<sniff class="DocbookCS\Sniff\ExceptionNameSniff" />
15+
<sniff class="DocbookCS\Sniff\AttributeOrderSniff" />
16+
<sniff class="DocbookCS\Sniff\WhitespaceSniff" />
17+
</sniffs>
18+
19+
<paths>
20+
<path>.</path>
21+
</paths>
22+
23+
<entities>
24+
<file>contributors.ent</file>
25+
<file>extensions.ent</file>
26+
<file>language-defs.ent</file>
27+
<file>language-snippets.ent</file>
28+
<directory>../doc-base/entities/</directory>
29+
<file>../doc-base/temp/file-entities.ent</file>
30+
<directory>../doc-base/temp/file-entities</directory>
31+
</entities>
32+
33+
<exclude>
34+
<pattern>output/*</pattern>
35+
</exclude>
36+
37+
</docbookcs>

faq/com.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<chapter xml:id="faq.com" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<chapter xmlns="http://docbook.org/ns/docbook" xml:id="faq.com" xmlns:xlink="http://www.w3.org/1999/xlink">
44
<title>PHP and COM</title>
55
<titleabbrev>PHP and COM</titleabbrev>
66

77
<para>
8-
PHP can be used to access COM and DCOM objects on Win32 platforms.
8+
This should be simpara
99
</para>
1010

1111
<qandaset>
1212
<qandaentry xml:id="faq.com.q1">
1313
<question>
1414
<para>
15-
I have built a DLL to calculate something. Is there any way to run this DLL under PHP?
15+
This also should be simpara
1616
</para>
1717
</question>
1818
<answer>
1919
<para>
20-
If this is a simple DLL there is no way yet to run it from PHP. If the DLL contains a COM
21-
server you may be able to access it if it implements the IDispatch interface.
20+
Also this should not be a <classname>ValueError</classname>.
2221
</para>
2322
</answer>
2423
</qandaentry>

faq/databases.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
<titleabbrev>Database issues</titleabbrev>
66

77
<para>
8-
This section holds common questions about relation between
9-
PHP and databases. Yes, PHP can access virtually any
10-
database available today.
8+
This file has been changed.
119
</para>
1210

1311
<qandaset>
1412
<qandaentry xml:id="faq.databases.mssql">
1513
<question>
16-
<para>
17-
I heard it's possible to access Microsoft SQL Server from PHP. How?
18-
</para>
14+
<simpara>
15+
This also, but it's correct
16+
</simpara>
1917
</question>
2018
<answer>
2119
<para>

faq/installation.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<chapter xml:id="faq.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<chapter xmlns="http://docbook.org/ns/docbook" xml:id="faq.installation" xmlns:xlink="http://www.w3.org/1999/xlink">
44
<title>Installation</title>
55
<titleabbrev>Installation</titleabbrev>
66

install/pecl.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<chapter xml:id="install.pecl" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<title>Installation of PECL extensions</title>
6-
6+
77
<sect1 xml:id="install.pecl.intro">
88
<title>Introduction to PECL Installations</title>
99
&pecl.moving.to.pie;
@@ -12,7 +12,7 @@
1212
<link xlink:href="&url.php.pear;">PEAR</link>
1313
packaging system.
1414
This section of the manual is intended to demonstrate how to obtain and
15-
install PECL extensions.
15+
install PECL extensions.
1616
</simpara>
1717
<simpara>
1818
These instructions assume <literal>/path/to/php/src/dir/</literal> is the

reference/array/functions/array-walk.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
1414
<methodparam choice="opt"><type>mixed</type><parameter>arg</parameter><initializer>&null;</initializer></methodparam>
1515
</methodsynopsis>
16-
<simpara>
16+
<para>
1717
Applies the user-defined <parameter>callback</parameter> function to each
1818
element of the <parameter>array</parameter> array.
19-
</simpara>
19+
</para>
2020
<para>
2121
<function>array_walk</function> is not affected by the internal array
2222
pointer of <parameter>array</parameter>. <function>array_walk</function>

0 commit comments

Comments
 (0)