1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 07:02:07 +01:00

65 Commits

Author SHA1 Message Date
Máté Kocsis
0e43594305 Revert "Add explicit type declarations to class constants (PHP 8.3+) (#215)"
This reverts commit c65199393a.
2026-03-04 08:43:09 +01:00
Louis-Arnaud
c65199393a Add explicit type declarations to class constants (PHP 8.3+) (#215)
### Motivation
- Enhances type safety and static analysis.
- Makes code intent clearer.
- Prepares PhD for PHP 8.4 compatibility and future strictness.

### Scope
- Added types such as `int`, `string`, `bool`, or `array` to class constants.
- Example:
    Before:
        `public const FORMAT_HTML = 1;`
        `public const NAME = 'PhD';`
    After:
        `public const int FORMAT_HTML = 1;`
        `public const string NAME = 'PhD';`

### Impact
-  No runtime behavior change.
-  Fully backward compatible with PHP 8.3+.
- ⚙️ Code clarity and safety improvement only.
- Updated `composer.json` to indicate PHP 8.3 requirement
- Removed 8.1 and 8.2 CI pipelines

### References
- [PHP 8.3: Typed class constants RFC](https://wiki.php.net/rfc/typed_class_constants)
- [PHP manual: Class constants](https://www.php.net/manual/en/language.oop5.constants.php)

---------

Co-authored-by: lacatoire <louis-arnaud.catoire@external.drivalia.com>
2026-02-05 20:45:10 +00:00
Anna Filina
deb7d81c49 Remove references to PDF from docs and code comments 2025-11-04 06:15:12 +00:00
haszi
e89333c222 Change PHPDoc return type of createLink
The various formats return string, null or void so change the PHPDoc return type to reflect this
2025-01-14 12:16:32 +00:00
haszi
9999f02ea7 Fix existing PHPDoc issues 2025-01-14 12:16:32 +00:00
haszi
92dd87abf8 Define undefined properties and variables (#186)
Co-authored-by: haszi <haszika80@gmail.com>
2025-01-05 23:51:29 +00:00
haszi
b80ae36dba Change property names to camel case 2024-12-29 19:58:10 +00:00
haszi
b8e817b6ff Replace method calls with property access 2024-12-29 19:58:10 +00:00
haszi
15284136ff Separate regular PhD output from error handling (#176)
- Move error handling code into a class and remove PhD message output handling from it.
- Introduce a new class to handle PhD message output.
- Make the implicit dependency on the output functionality of classes explicit.
- Update PEAR package.xml.
- Fix tests.
- Use proper variadic parameters
- Use class constants
- Use first-class callable syntax

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-11-10 17:57:05 +00:00
Kamil Tekiela
6de3ff754a Add proper types 2024-10-21 15:19:45 +01:00
Kamil Tekiela
01709360c3 Align parameter names
Update Format.php
2024-10-21 15:19:45 +01:00
Kamil Tekiela
2852b2756c Remove some dead code (#163) 2024-10-20 13:34:46 +02:00
haszi
86c5a1b322 Invoke Config instance methods instead of static methods from Format and its subclasses (#144)
Co-authored-by: haszi <haszika80@gmail.com>
2024-07-26 01:48:51 +01:00
haszi
e948f1040f Add config as a dependency of format (#142)
* Add Config as a dependency to Format and all it subclasses

* Inject Config into every Format subclass at instantiation

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-07-07 15:58:51 +01:00
haszi
f1b97d16d4 Use parent class's IndexRepository in Index (#129)
Co-authored-by: haszi <haszika80@gmail.com>
2024-05-22 16:18:07 +01:00
haszi
fc84db4987 Move all database access to IndexRepository (#126)
Move all database access to IndexRepository.
Use the same database during the entire indexing-rendering process.
Add a simple smoke test for render.php.

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-20 13:19:31 +01:00
Gina Peter Banyard
b535eebcde Revert "Move all database access code to IndexRepository (#120)"
Still breaks the EN build on the doc rendering server

Indexing...
E_WARNING /local/src/phd/render.php:79 Undefined variable $config
PHP Fatal error:  Uncaught Error: Call to a member function render_ids() on null in /local/src/phd/render.php:79
Stack trace:
 0 /local/src/phd/render.php(129): phpdotnet\phd\make_reader()
 1 {main}   thrown in /local/src/phd/render.php on line 79

This reverts commit 71e6292050.
2024-05-14 00:28:54 +01:00
haszi
71e6292050 Move all database access code to IndexRepository (#120)
Use the same IndexRepository instance everywhere

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-13 23:48:20 +01:00
Gina Peter Banyard
f93552ad86 Revert "Use the same indexing database throughout (#118)"
This doesn't seem to create the DB properly and is failing the builds.

This reverts commit ef13e91f06.
2024-04-25 22:38:34 +01:00
haszi
ef13e91f06 Use the same indexing database throughout (#118)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-25 16:31:56 +01:00
haszi
bdbd0e68ad Declare dynamic properties and removenonexistent variable (#93)
Declare all previously dynamic properties as far up the class hierarchy as needed and remove all declarations further down the inheritance tree.
Remove one nonexistent variable.

Co-authored-by: haszi <haszika80@gmail.com>
2024-02-09 21:41:14 +00:00
haszi
e5b8bf35a9 Remove file ending comment blocks (#92)
Co-authored-by: haszi <haszika80@gmail.com>
2024-02-08 12:46:21 +00:00
haszi
10ee0e4bb2 Add table formatting for constant lists (#90)
* Add table formatting for constant lists
* Add description and constants autogen text to .ini files
* Add language specific header to constant list table

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-02-05 15:17:25 +00:00
George Peter Banyard
c91c799cda Check that example index exists
This emits warning when using:
render.php -P PHP -d ../base/.manual.xml -f xhtml -f bigxhtml -f php -f tocfeed --output
2023-10-17 15:06:07 +01:00
Derick Rethans
862833e266 Fixed PHP 8.2 dynamic property generation warning 2023-03-23 15:50:13 +00:00
Peter Cowburn
9544a6b72b make objectstorage::attach() compatible with splobjectstorage::attach()
PhD's ObjectStorage::attach() method does not respect the declared
return type from its parent class (SplObjectStorage): the latter
declares the return type as void.

It is currently mitigated via the #[\ReturnTypeWillChange] attribute.

This commit removes that attribute and instead aligns the return type
declaration (to return void), with associated fixes to not return
anything and not try to use a return value.

Since declaring a void return type is only allowed as of PHP 7.1.0, this
raises the minimum required PHP version for phd to that version. Since
PHP 7.1 is super ancient and even PHP 7.3 will become EOL in a few weeks
(at the time of writing) I'm making the executive decision that
requiring 7.1 is fine. :-)
2021-10-29 23:34:41 +01:00
Peter Cowburn
aba426d48a don't fetch informalexample ids when building example id index (#56)
The incrementing "example-N" numbers which are allocated during indexing
need to tally up when fetched for rendering.
2021-09-30 21:47:49 +01:00
Yoshinari Takaoka
2acb8a4ff4 Fixed E_WARNING "($context) must be passed by reference, value given". (#39) 2021-07-12 15:05:58 +01:00
Peter Kokot
3564283891 Sync final newlines
This patch adds some missing newlines and trims multiple redundant
newlines into a single newline.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-02 06:23:33 +02:00
Thomas Punt
b2a1cc3050 Keep the return value to something count-able
In PHP 7.2, `count` can only be used with arrays and `Countable` objects.
Returning `null` here causes a lot of warnings when building the docs on
PHP 7.2.
2017-08-17 10:59:19 +01:00
Sobak
99c9440e5b Display phrase in currently selected language 2015-03-14 17:07:11 +01:00
Sobak
131517336e Merge branch 'pull-request/13' 2015-03-10 15:46:53 +01:00
Sobak
aecae4e2c3 Eliminate $ comments 2015-03-09 06:20:39 +01:00
Sobak
2776ae8219 Convert language files to INI 2015-03-08 13:35:01 +01:00
Moacir de Oliveira
b0e35d28db InvalidArgumentException is not in our namespace
Signed-off-by: Moacir de Oliveira <moacir@php.net>
2012-08-18 17:31:37 -04:00
Hannes Magnusson
224e6e39a2 Make it possible to configure which versions to print the changelog
entries for.
And support multiple generate-changelog-for-membership values
2012-06-09 18:59:04 +01:00
Hannes Magnusson
a48d644c72 Add support for extension-membership and generate-changelog-for-membership PIs 2012-06-09 17:30:52 +01:00
Hannes Magnusson
53bbfa58e9 Use PHP to sort using natural sorting of version numbers 2012-06-09 13:22:51 +01:00
Hannes Magnusson
37cca1e284 Added support for <?phpdoc generate-changelog-for"<container chunk ids>" ?>
It will autogenerate a table of changelog entries extracted from the
<refsect1 role="changelog"> entries of the containers children.
2012-06-09 13:10:20 +01:00
Alexey Borzov
dce97c2736 * Get rid of redundant align and valign attributes on table-related tags, make non-redundant ones output as inline styles
* Make some of the tests pass (they probably didn't even before my changes)
* Changed <refsection> rendering in Package_PEAR_XHTML, format_refsect() has unfortunate side effects
2012-02-07 06:30:24 +00:00
Alexey Borzov
4ea9ca1350 whitespace 2012-02-06 16:08:52 +00:00
Jakub Vrana
483a10cb46 Avoid undefined property notice 2012-01-06 20:52:36 +00:00
Hannes Magnusson
dfcd27b121 Added generate-index-for=(refentry,function,examples) support for the phpdoc PI handler (Hannes) 2011-08-31 14:46:47 +00:00
Richard Quadling
b48207e017 Whitespace. 2011-06-17 10:49:21 +00:00
Richard Quadling
2fc0910781 Renamed getTree() to getDebugTree() as it is a debugging feature (Thanks Hannes for the suggestion). 2011-06-03 21:47:57 +00:00
Richard Quadling
bd0cc2036a Added Format::getTree() method to allow the current location in the tree to be reportable. 2011-06-03 13:14:47 +00:00
Hannes Magnusson
08b967488d Add --memoryindex (-M) to just store the index in memory
# couple of percentages less :)
2011-04-27 18:33:37 +00:00
Hannes Magnusson
c5675e598e Generate IDs for example, and store their descriptions
# Useful for linking to specific examples via irc/email for example
# And will make it possible to create an example listing like we have always wanted
2010-12-31 09:28:38 +00:00
Hannes Magnusson
246cbf30ce Remove bogus comment, move couple of properties to where the rest of them are declared 2010-01-06 08:25:30 +00:00
Christian Weiske
87140b3520 remove legacy code that is not needed anymore; move Reader storage to ReaderKeeper 2009-10-16 17:43:56 +00:00