aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Mailer.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-11-24 14:50:03 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-24 14:50:03 +0100
commit76cbfadcdfdcbf675b83f6162a229938aca3bbe1 (patch)
tree01aa96c6774dcf2a692fd3062ae1ffccb0a8bfa0 /lib/Minz/Mailer.php
parentbc9ef0d188fa43d4a4d06835f74e2d94799b65c6 (diff)
Fix types for extensions (#5901)
* Fix types for extensions To accompany https://github.com/FreshRSS/Extensions/pull/185 * Avoid bug redeclared function
Diffstat (limited to 'lib/Minz/Mailer.php')
-rw-r--r--lib/Minz/Mailer.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Minz/Mailer.php b/lib/Minz/Mailer.php
index bd5e97ceb..86c5c33da 100644
--- a/lib/Minz/Mailer.php
+++ b/lib/Minz/Mailer.php
@@ -39,10 +39,18 @@ class Minz_Mailer {
private int $debug_level;
/**
- * Constructor.
+ * @phpstan-param class-string|'' $viewType
+ * @param string $viewType Name of the class (inheriting from Minz_View) to use for the view model
*/
- public function __construct () {
- $this->view = new Minz_View();
+ public function __construct(string $viewType = '') {
+ $view = null;
+ if ($viewType !== '' && class_exists($viewType)) {
+ $view = new $viewType();
+ if (!($view instanceof Minz_View)) {
+ $view = null;
+ }
+ }
+ $this->view = $view ?? new Minz_View();
$this->view->_layout(null);
$this->view->attributeParams();