Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require autoloader #495

Merged
merged 3 commits into from
Sep 15, 2023
Merged

require autoloader #495

merged 3 commits into from
Sep 15, 2023

Conversation

Klap-in
Copy link
Collaborator

@Klap-in Klap-in commented Sep 15, 2023

recent cleanup #494 removed all the requires.
As long DokuWiki does not autoload vendor, a plugin has to do it.

@splitbrain or do I overlook something?

@splitbrain
Copy link
Owner

Hmm, I had moved the require to the constructor...

@Klap-in
Copy link
Collaborator Author

Klap-in commented Sep 15, 2023

to solve this, I suppose?

FILE: ...2pdf/dokuwiki-plugin-dw2pdf/lib/plugins/dw2pdf/DokuPDF.class.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | WARNING | A file should declare new symbols (classes, functions,
   |         | constants, etc.) and cause no other side effects, or
   |         | it should execute logic with side effects, but should
   |         | not do both. The first symbol is defined on line 19
   |         | and the first side effect is on line 9.
   |         | (PSR1.Files.SideEffects.FoundWithSymbols)
----------------------------------------------------------------------

@Klap-in
Copy link
Collaborator Author

Klap-in commented Sep 15, 2023

There was a fix somewhere in the tests for the autoload

@Klap-in
Copy link
Collaborator Author

Klap-in commented Sep 15, 2023

public function __construct($pagesize = 'A4', $orientation = 'portrait', $fontsize = 11, $docLang = 'en')
{
global $conf;
global $lang;
require_once __DIR__ . '/vendor/autoload.php';
if (!defined('_MPDF_TEMP_PATH')) {

Is this not too late, because this class inherits also from the mPdf class?

@splitbrain
Copy link
Owner

Yeah, it was to fix the PSR side effects rule... but you're right, it's probably too late there. Might work moving the require to the action.php's constructor

@Klap-in
Copy link
Collaborator Author

Klap-in commented Sep 15, 2023

Updated, fixes #496

@Klap-in Klap-in linked an issue Sep 15, 2023 that may be closed by this pull request
@Klap-in Klap-in merged commit 2b01138 into master Sep 15, 2023
18 checks passed
@Klap-in Klap-in deleted the autoload branch September 15, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Class "Mpdf\Mpdf" not found
2 participants