Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/integration/API/CacheableAPIBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CacheableAPIBaseTest extends \Codeception\TestCase\WPTestCase {
*
* @throws ReflectionException
*/
public function test_do_remote_request( bool $is_cacheable, bool $force_refresh = null, bool $cache_exists = null, bool $should_load_from_cache = false ) {
public function test_do_remote_request( bool $is_cacheable, ?bool $force_refresh = null, ?bool $cache_exists = null, bool $should_load_from_cache = false ) {

$request = $this->get_new_request_instance( $is_cacheable );

Expand Down Expand Up @@ -357,7 +357,7 @@ public function provider_get_request_cache_lifetime(): array {
*
* @throws ReflectionException
*/
public function test_get_request_data_for_broadcast( bool $is_cacheable, bool $force_refresh = null, bool $should_cache = null ) {
public function test_get_request_data_for_broadcast( bool $is_cacheable, ?bool $force_refresh = null, ?bool $should_cache = null ) {

$request = $this->get_new_request_instance( $is_cacheable );

Expand Down
2 changes: 1 addition & 1 deletion woocommerce/Helpers/OrderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function get_customer_id( \WC_Order $order ) {
* @param mixed $default Optional. The default value if the property doesn't exist. Default null.
* @return mixed The property value if found, or the default value if not found.
*/
public static function get_property( \WC_Order $order, string $key, $nested_key = null, $default = null ): mixed {
public static function get_property( \WC_Order $order, string $key, $nested_key = null, $default = null ) {
return Dynamic_Props::get( $order, $key, $nested_key, $default );
}

Expand Down
7 changes: 4 additions & 3 deletions woocommerce/payment-gateway/Dynamic_Props.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Dynamic_Props {
* @since x.x.x
* @var \WeakMap<object, \stdClass>|null
*/
private static ?\WeakMap $map = null;
private static ?\WeakMap $map = null; // phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+

/**
* Sets a property on the order object.
Expand All @@ -64,7 +64,7 @@ class Dynamic_Props {
* Dynamic_Props::set($order, 'payment_total', '99.99');
* ```
*/
public static function set( \WC_Order &$order, string $key, mixed $value ): void {
public static function set( \WC_Order &$order, string $key, $value ): void {
if ( self::use_weak_map() ) {
self::init_weak_map();
if ( ! isset( self::$map[ $order ] ) ) {
Expand Down Expand Up @@ -97,7 +97,7 @@ public static function set( \WC_Order &$order, string $key, mixed $value ): void
* $token = Dynamic_Props::get($order, 'payment', 'token', 'DEFAULT_TOKEN');
* ```
*/
public static function get( \WC_Order $order, string $key, $nested_key = null, $default = null ): mixed {
public static function get( \WC_Order $order, string $key, $nested_key = null, $default = null ) {
if ( self::use_weak_map() ) {
self::init_weak_map();
if ( is_null( $nested_key ) ) {
Expand Down Expand Up @@ -184,6 +184,7 @@ private static function use_weak_map(): bool {
*/
private static function init_weak_map(): void {
if ( null === self::$map ) {
// phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+
self::$map = new \WeakMap();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ protected function get_notices_as_user_messages( ?string $type = null ) : array
$message = $notice['notice'] ?? $notice;

// this will handle some log data eventually
$messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message );
$messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 );
}
}

Expand Down
4 changes: 2 additions & 2 deletions woocommerce/payment-gateway/class-sv-wc-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3753,12 +3753,12 @@ public function add_debug_message( $message, ?string $type = 'message' ) : void

if ( 'message' === $type ) {

SV_WC_Helper::wc_add_notice( str_replace( "\n", "<br/>", htmlspecialchars( $message ) ), 'notice' );
SV_WC_Helper::wc_add_notice( str_replace( "\n", "<br/>", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'notice' );

} else {

// defaults to error message
SV_WC_Helper::wc_add_notice( str_replace( "\n", "<br/>", htmlspecialchars( $message ) ), 'error' );
SV_WC_Helper::wc_add_notice( str_replace( "\n", "<br/>", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'error' );
}
}
}
Expand Down
Loading