Skip to content

Commit 0989117

Browse files
committed
Merge branch 'master' into refactor/add-typed-class-constants
2 parents 09ff7e4 + 3572bd3 commit 0989117

32 files changed

+277
-140
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ jobs:
44
ubuntu:
55
strategy:
66
matrix:
7-
version: ['8.1', '8.2', '8.3']
7+
version: ['8.1', '8.2', '8.3', '8.4', '8.5']
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout PhD
11-
uses: actions/checkout@v5
11+
uses: actions/checkout@v6
1212

1313
- name: Setup PHP
1414
uses: shivammathur/setup-php@v2

.github/workflows/full_render_doc-en_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout PhD
9-
uses: actions/checkout@v5
9+
uses: actions/checkout@v6
1010
with:
1111
path: "phd"
1212

1313
- name: "Checkout php/doc-en"
14-
uses: "actions/checkout@v5"
14+
uses: "actions/checkout@v6"
1515
with:
1616
path: "en"
1717
repository: "php/doc-en"
1818

1919
- name: "Checkout php/doc-base"
20-
uses: "actions/checkout@v5"
20+
uses: "actions/checkout@v6"
2121
with:
2222
path: "doc-base"
2323
repository: "php/doc-base"

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ jobs:
55
name: test
66
strategy:
77
matrix:
8-
version: ['8.1', '8.2', '8.3']
8+
version: ['8.1', '8.2', '8.3', '8.4', '8.5']
9+
continue-on-error: ${{ matrix.version == '8.5' }}
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Checkout PhD
12-
uses: actions/checkout@v5
13+
uses: actions/checkout@v6
1314

1415
- name: Setup PHP
1516
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
"easybook/geshi": "For using GeSHi as code highlighter"
2828
},
2929
"autoload": {
30-
"psr-0": {
31-
"phpdotnet\\": "."
30+
"psr-4": {
31+
"phpdotnet\\phd\\": "src/"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"phpdotnet\\phd\\Tests\\": "tests/"
3237
}
3338
}
3439
}

docs/phd-guide/phd-guide.xml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ install ok: channel://doc.php.net/PhD-1.0.1
9797
install ok: channel://doc.php.net/PhD_Generic-1.0.1
9898
install ok: channel://doc.php.net/PhD_PHP-1.0.1
9999
install ok: channel://doc.php.net/PhD_PEAR-1.0.1
100-
bjori@jessica:/usr/src/php/svn/phd/trunk$
101100
101+
$ cd phd
102102
$ phd --version
103-
PhD Version: phd-from-svn
103+
PhD Version: phd-from-git
104104
PHP Version: 5.3.3-dev
105105
Copyright(c) 2007-2010 The PHP Documentation Group
106106
]]>
@@ -113,20 +113,22 @@ Copyright(c) 2007-2010 The PHP Documentation Group
113113

114114
<chapter xml:id="using-phd">
115115
<title>Using PhD to render documentation</title>
116-
116+
<note>
117+
<para>
118+
Earlier versions of the PHP documentation infrastructure used Subversion (SVN).
119+
All PHP documentation repositories are now maintained using Git.
120+
</para>
121+
</note>
117122
<section xml:id="render-phpdoc">
118123
<title>Rendering the PHP Documentation Sources</title>
119124

120125
<sidebar>
121126
<title>Getting the PHP Documentation Sources</title>
122-
123-
<para>To get the PHP documentation sources, simply <link
124-
xlink:href="http://wiki.php.net/doc/scratchpad/howto/checkout">check them out from SVN</link>
125-
with the following command.</para>
126-
127+
<para>To get the PHP documentation sources, simply clone them from the
128+
official Git repository with the following command.</para>
127129
<screen>
128130
<![CDATA[
129-
$ svn co http://svn.php.net/repository/phpdoc/modules/doc-en phpdoc
131+
$ git clone https://github.com/php/doc-en.git phpdoc
130132
... output
131133
]]>
132134
</screen>
@@ -142,7 +144,7 @@ $ svn co http://svn.php.net/repository/phpdoc/modules/doc-en phpdoc
142144
</sidebar>
143145

144146
<para>To quickly become familiar with using PhD, you can download the
145-
PHP documentation sources and render those.Running PhD to render the
147+
PHP documentation sources and render those. Running PhD to render the
146148
docs is surprisingly simple, so we'll start with that.</para>
147149

148150
<screen>
@@ -300,8 +302,8 @@ Supported packages:
300302

301303
<screen>
302304
<![CDATA[
303-
$ svn checkout http://svn.php.net:/repository/phd/trunk/docs/phd-guide
304-
U phd/docs/phd-guide/phd-guide.xml
305+
$ git clone https://github.com/php/phd.git
306+
$ cd phd/docs/phd-guide
305307
]]>
306308
</screen>
307309

@@ -677,12 +679,6 @@ $ pear install mediawiki/geshi]]></screen>
677679
<para>Some other articles for further reading. Latest are on top.</para>
678680

679681
<itemizedlist>
680-
<listitem>
681-
<para><link
682-
xlink:href="http://elizabethmariesmith.com/2009/02/setting-up-phd-on-windows/">Setting
683-
up PhD on Windows</link> by Elizabeth Marie Smith (PhD 0.4.5)</para>
684-
</listitem>
685-
686682
<listitem>
687683
<para><link
688684
xlink:href="http://bjori.blogspot.com/2007/10/phd-php-based-docbook-renderer-rc1.html">PhD

phpdotnet/phd/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function autoload(string $name): void
2626

2727
return;
2828
}
29-
trigger_error(vsprintf('Cannot find file for %s: %s', [$name, $file ?? $filename]), E_USER_ERROR);
29+
throw new \Error(vsprintf('Cannot find file for %s: %s', [$name, $file ?? $filename]));
3030
}
3131
}
3232

phpdotnet/phd/Format/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public final function createFormat($format, ...$formatParams) {
4949
}
5050
return $obj;
5151
}
52-
trigger_error("This format is not supported by this package", E_USER_ERROR);
52+
throw new \Error('This format is not supported by this package');
5353
}
5454

5555
public static final function createFactory($package) {

phpdotnet/phd/ObjectStorage.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33

44
class ObjectStorage extends \SplObjectStorage
55
{
6-
public function attach(object $object, mixed $info = array()): void {
6+
public function attach(object $object, mixed $info = []): void {
77
if (!($object instanceof Format)) {
88
throw new \InvalidArgumentException(
99
'Only classess inheriting ' . __NAMESPACE__ . '\\Format supported'
1010
);
1111
}
1212
if (empty($info)) {
13-
$info = array(
13+
$info = [
1414
\XMLReader::ELEMENT => $object->getElementMap(),
1515
\XMLReader::TEXT => $object->getTextMap(),
16-
);
16+
];
1717
}
18-
parent::attach($object, $info);
18+
19+
$this->offsetSet($object, $info);
1920
}
2021
}
2122

phpdotnet/phd/Options/Handler.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ public function option_d(string $k, mixed $v): array
184184
public function option_docbook(string $k, mixed $v): array
185185
{
186186
if (is_array($v)) {
187-
trigger_error("Can only parse one file at a time", E_USER_ERROR);
187+
throw new \Error('Can only parse one file at a time');
188188
}
189189
if (!file_exists($v) || is_dir($v) || !is_readable($v)) {
190-
trigger_error(sprintf("'%s' is not a readable docbook file", $v), E_USER_ERROR);
190+
throw new \Error(sprintf("'%s' is not a readable docbook file", $v));
191191
}
192192
return [
193193
'xmlRoot' => dirname($v),
@@ -209,19 +209,19 @@ public function option_o(string $k, mixed $v): array
209209
public function option_output(string $k, mixed $v): array
210210
{
211211
if (is_array($v)) {
212-
trigger_error("Only a single output location can be supplied", E_USER_ERROR);
212+
throw new \Error('Only a single output location can be supplied');
213213
}
214214
if (!file_exists($v)) {
215215
$this->outputHandler->v("Creating output directory..", VERBOSE_MESSAGES);
216216
if (!mkdir($v, 0777, true)) {
217-
trigger_error(vsprintf("Can't create output directory : %s", [$v]), E_USER_ERROR);
217+
throw new \Error(vsprintf("Can't create output directory : %s", [$v]));
218218
}
219219
$this->outputHandler->v("Output directory created", VERBOSE_MESSAGES);
220220
} elseif (!is_dir($v)) {
221-
trigger_error("Output directory is a file?", E_USER_ERROR);
221+
throw new \Error('Output directory is a file?');
222222
}
223223
if (!is_dir($v) || !is_readable($v)) {
224-
trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR);
224+
throw new \Error(sprintf("'%s' is not a valid directory", $v));
225225
}
226226
$v = (substr($v, strlen($v) - strlen(DIRECTORY_SEPARATOR)) === DIRECTORY_SEPARATOR) ? $v : ($v . DIRECTORY_SEPARATOR);
227227

@@ -234,7 +234,7 @@ public function option_output(string $k, mixed $v): array
234234
public function option_outputfilename(string $k, mixed $v): array
235235
{
236236
if (is_array($v)) {
237-
trigger_error("Only a single output location can be supplied", E_USER_ERROR);
237+
throw new \Error('Only a single output location can be supplied');
238238
}
239239
$file = basename($v);
240240

@@ -281,7 +281,7 @@ public function option_package(string $k, mixed $v): array
281281
foreach((array)$v as $package) {
282282
if (!in_array($package, $this->config->getSupportedPackages())) {
283283
$supported = implode(', ', $this->config->getSupportedPackages());
284-
trigger_error("Invalid Package (Tried: '$package' Supported: '$supported')", E_USER_ERROR);
284+
throw new \Error("Invalid Package (Tried: '$package' Supported: '$supported')");
285285
}
286286
}
287287
return ['package' => (array) $v];
@@ -341,13 +341,13 @@ public function option_skip(string $k, mixed $v): array
341341
public function option_saveconfig(string $k, mixed $v): array
342342
{
343343
if (is_array($v)) {
344-
trigger_error(sprintf("You cannot pass %s more than once", $k), E_USER_ERROR);
344+
throw new \Error(sprintf('You cannot pass %s more than once', $k));
345345
}
346346

347347
$val = is_bool($v) ? true : self::boolval($v);
348348

349349
if (!is_bool($val)) {
350-
trigger_error("yes/no || on/off || true/false || 1/0 expected", E_USER_ERROR);
350+
throw new \Error('yes/no || on/off || true/false || 1/0 expected');
351351
}
352352

353353
return ['saveConfig' => $val];
@@ -381,7 +381,7 @@ public function option_verbose(string $k, mixed $v): array
381381
$verbose = max($verbose, 1);
382382
$verbose <<= 1;
383383
} else {
384-
trigger_error("Unknown option passed to --$k, '$const'", E_USER_ERROR);
384+
throw new \Error("Unknown option passed to --$k, '$const'");
385385
}
386386
}
387387
}
@@ -438,11 +438,11 @@ public function option_c(string $k, mixed $v): array
438438
public function option_color(string $k, mixed $v): array
439439
{
440440
if (is_array($v)) {
441-
trigger_error(sprintf("You cannot pass %s more than once", $k), E_USER_ERROR);
441+
throw new \Error(sprintf('You cannot pass %s more than once', $k));
442442
}
443443
$val = self::boolval($v);
444444
if (!is_bool($val)) {
445-
trigger_error("yes/no || on/off || true/false || 1/0 expected", E_USER_ERROR);
445+
throw new \Error('yes/no || on/off || true/false || 1/0 expected');
446446
}
447447
return ['colorOutput' => $val];
448448
}

phpdotnet/phd/Options/Parser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ private function validateOptions(): void {
8080
$checkArgv = explode('=', $argv[$i]);
8181
if (substr($checkArgv[0], 0, 2) === '--') {
8282
if (!in_array(substr($checkArgv[0], 2), $long)) {
83-
trigger_error('Invalid long option ' . $argv[$i], E_USER_ERROR);
83+
throw new \Error('Invalid long option ' . $argv[$i]);
8484
}
8585
} elseif (substr($checkArgv[0], 0, 1) === '-') {
8686
if (!in_array(substr($checkArgv[0], 1), $short)) {
87-
trigger_error('Invalid short option ' . $argv[$i], E_USER_ERROR);
87+
throw new \Error('Invalid short option ' . $argv[$i]);
8888
}
8989
}
9090
}
@@ -98,15 +98,15 @@ public function getopt(): array {
9898

9999
$args = getopt($this->getShortOptions(), $this->getLongOptions());
100100
if ($args === false) {
101-
trigger_error("Something happend with getopt(), please report a bug", E_USER_ERROR);
101+
throw new \Error('Something happend with getopt(), please report a bug');
102102
}
103103

104104
$parsedOptions = [];
105105
foreach ($args as $k => $v) {
106106
$handler = $this->handlerForOption($k);
107107

108108
if (!is_callable($handler)) {
109-
trigger_error("Hmh, something weird has happend, I don't know this option", E_USER_ERROR);
109+
throw new \Error("Hmh, something weird has happend, I don't know this option");
110110
}
111111

112112
$retVal = call_user_func($handler, $k, $v);

0 commit comments

Comments
 (0)