- 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>
Remove Config from Autoloader by replacing it with a static array and a setter method.
Update render.php and setup.php to pass package directories to Autoloader.
Add test.
Co-authored-by: haszi <haszika80@gmail.com>
* 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>
Remove superfluous database initialization as database is already initialized during the initialization of Indexing.
Co-authored-by: haszi <haszika80@gmail.com>
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>
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.
Add new IndexRepository class to handle all database access.
Inject IndexRepository as a dependency into the constructor of Index and use that instead of directly accessing the database.
Add basic indexing test.
Fix existing test that uses indexing to use IndexRepository.
* Refactor Options Parser and default Options Handler
Refactor default Options Handler to accept dependencies through its constructor.
Refactor default Options Handler to return an array of options instead of directly setting options in Config and declare array return types.
Refactor method in Options Parser to return an array of options and declare its return type as array.
Inject all necessary dependencies in render.php.
Refactor two methods in default Options Handler by using match expressions.
* Minor refactor of files used in tests
Inlcude Config with require_once instead of require in Autloader.
Define __INSTALLDIR__ only if it is not defined yet in render.php.
Include Autoloader and functions.php with require_once instead of require.
Remove unnecessary __PHPDIR__ constant, correct path for __INSTALLDIR__ and use that constant in setup.php.
* Remove var_dump from Options Parser
* Fix inconsistent option flags in default Option Handler
* Add default Options Handler tests
---------
Co-authored-by: haszi <haszika80@gmail.com>
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. :-)
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
- Add the possibility to generate a 'phd.config.php' config file (--saveconfig).
If that file exists in cwd then it will be read and used
(command line arguments will overwrite the config file though)
- Add a new config option, 'package_dirs'. Used to specify the directory locations to use for autoloading