Fix PHPStan errors for Email editor PHP package src folder
MAILPOET-6318
This commit is contained in:
committed by
Jan Lysý
parent
40aac9e65c
commit
bb71448c53
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the MailPoet plugin.
|
||||
* This file is part of the MailPoet Email Editor package.
|
||||
*
|
||||
* @package MailPoet\EmailEditor
|
||||
*/
|
||||
@@ -70,6 +70,8 @@ class Renderer {
|
||||
|
||||
/**
|
||||
* During rendering, this stores the theme data for the template being rendered.
|
||||
*
|
||||
* @return ?\WP_Theme_JSON
|
||||
*/
|
||||
public static function get_theme() {
|
||||
return self::$theme;
|
||||
@@ -87,8 +89,9 @@ class Renderer {
|
||||
*/
|
||||
public function render( \WP_Post $post, string $subject, string $pre_header, string $language, $meta_robots = '' ): array { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
||||
$template_id = 'mailpoet/mailpoet//' . ( get_page_template_slug( $post ) ? get_page_template_slug( $post ) : 'email-general' );
|
||||
$template = $this->templates->get_block_template( $template_id );
|
||||
$theme = $this->templates->get_block_template_theme( $template_id, $template->wp_id );
|
||||
/** @var \WP_Block_Template $template */ // phpcs:ignore
|
||||
$template = $this->templates->get_block_template( $template_id );
|
||||
$theme = $this->templates->get_block_template_theme( $template_id, $template->wp_id );
|
||||
|
||||
// Set the theme for the template. This is merged with base theme.json and core json before rendering.
|
||||
self::$theme = new WP_Theme_JSON( $theme, 'default' );
|
||||
@@ -140,7 +143,7 @@ class Renderer {
|
||||
* @return string
|
||||
*/
|
||||
private function inline_css_styles( $template ) {
|
||||
return CssInliner::fromHtml( $template )->inlineCss()->render();
|
||||
return CssInliner::fromHtml( $template )->inlineCss()->render(); // @phpstan-ignore-line TODO: Install CssInliner
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +154,7 @@ class Renderer {
|
||||
*/
|
||||
private function render_text_version( $template ) {
|
||||
$template = ( mb_detect_encoding( $template, 'UTF-8', true ) ) ? $template : mb_convert_encoding( $template, 'UTF-8', mb_list_encodings() );
|
||||
$result = Html2Text::convert( $template );
|
||||
$result = Html2Text::convert( $template ); // @phpstan-ignore-line TODO: Install Html2Text
|
||||
if ( false === $result ) {
|
||||
return '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user