Skip to content

Commit 09b2df5

Browse files
committed
Updates to prevent deepsource noise and fix a psalm error
1 parent 378134e commit 09b2df5

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

classes/helpers/FrmAppHelper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,14 @@ public static function icon_by_class( $class, $atts = array() ) {
13781378
$icon_classes = array();
13791379
$is_font_icon = true;
13801380

1381-
foreach ( preg_split( '/\s+/', $class, -1, PREG_SPLIT_NO_EMPTY ) as $single_class ) {
1381+
$single_classes = preg_split( '/\s+/', $class, -1, PREG_SPLIT_NO_EMPTY );
1382+
1383+
if ( ! $single_classes ) {
1384+
// preg_split returns false if $class is not a string.
1385+
$single_classes = array();
1386+
}
1387+
1388+
foreach ( $single_classes as $single_class ) {
13821389
if ( 'frmfont' === $single_class || 'frm_icon_font' === $single_class ) {
13831390
$is_font_icon = false;
13841391
continue;

tests/phpunit/base/FrmAjaxUnitTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ class FrmAjaxUnitTest extends WP_Ajax_UnitTestCase {
1010
protected $is_pro_active = false;
1111
protected $contact_form_key = 'contact-with-email';
1212

13+
/**
14+
* Narrows the inherited property to the Formidable factory so static analysis
15+
* can resolve $this->factory->form, ->field and ->entry.
16+
*
17+
* @var FrmUnitTestFactory
18+
*/
19+
protected $factory;
20+
1321
public static function wpSetUpBeforeClass( $factory ) {
1422
$_POST = array();
1523
FrmHooksController::trigger_load_hook( 'load_ajax_hooks' );

tests/phpunit/base/FrmUnitTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class FrmUnitTest extends WP_UnitTestCase {
2222

2323
protected $is_pro_active = false;
2424

25+
/**
26+
* Narrows the inherited property to the Formidable factory so static analysis
27+
* can resolve $this->factory->form, ->field and ->entry.
28+
*
29+
* @var FrmUnitTestFactory
30+
*/
31+
protected $factory;
32+
2533
/**
2634
* @var FrmUnitTest
2735
*/

0 commit comments

Comments
 (0)