Skip to content

Commit fa8a1f9

Browse files
committed
phpstan fixes
1 parent 4191624 commit fa8a1f9

File tree

4 files changed

+15
-92
lines changed

4 files changed

+15
-92
lines changed

components/I18n/I18n.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ public function init() {
133133
*/
134134

135135
// Pod.
136-
add_filter( 'pods_admin_setup_edit_tabs', array( $this, 'translation_tab' ), 99, 2 );
136+
add_filter( 'pods_admin_setup_edit_tabs', array( $this, 'translation_tab' ), 99, 1 );
137137
add_filter( 'pods_admin_setup_edit_options', array( $this, 'translation_options' ), 99, 2 );
138138
// Pod Groups.
139-
add_filter( 'pods_admin_setup_edit_group_tabs', array( $this, 'translation_tab' ), 99, 2 );
139+
add_filter( 'pods_admin_setup_edit_group_tabs', array( $this, 'translation_tab' ), 99, 1 );
140140
add_filter( 'pods_admin_setup_edit_group_options', array( $this, 'translation_options' ), 99, 2 );
141141
// Pod Fields.
142-
add_filter( 'pods_admin_setup_edit_field_tabs', array( $this, 'translation_tab' ), 99, 2 );
142+
add_filter( 'pods_admin_setup_edit_field_tabs', array( $this, 'translation_tab' ), 99, 1 );
143143
add_filter( 'pods_admin_setup_edit_field_options', array( $this, 'translation_options' ), 99, 2 );
144144

145145
/**
@@ -726,20 +726,21 @@ public function admin( $options, $component ) {
726726
);
727727

728728
/**
729-
* Filter the language data
729+
* Filter the language data.
730730
*
731731
* @since 0.1.0
732732
*
733-
* @param array
733+
* @param array $data The language data.
734734
*/
735735
$data = apply_filters( 'pods_component_i18n_admin_data', $data );
736736

737737
/**
738-
* Filter the UI fields
738+
* Filter the UI fields.
739739
*
740740
* @since 0.1.0
741741
*
742-
* @param array
742+
* @param array $fields The UI fields.
743+
* @param array $data The language data.
743744
*/
744745
$ui['fields'] = apply_filters( 'pods_component_i18n_admin_ui_fields', $ui['fields'], $data );
745746

components/Migrate-Packages/Migrate-Packages.php

Lines changed: 5 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -256,22 +256,6 @@ public static function import( $data, $replace = false ) {
256256
}//end foreach
257257
}//end if
258258

259-
if ( isset( $data['helpers'] ) && is_array( $data['helpers'] ) ) {
260-
foreach ( $data['helpers'] as $helper_data ) {
261-
$helper = self::import_pod_helper( $helper_data, $replace );
262-
263-
if ( ! $helper ) {
264-
continue;
265-
}
266-
267-
if ( ! isset( $found['helpers'] ) ) {
268-
$found['helpers'] = array();
269-
}
270-
271-
$found['helpers'][ $helper['name'] ] = $helper['name'];
272-
}//end foreach
273-
}//end if
274-
275259
$found = apply_filters( 'pods_packages_import', $found, $data, $replace );
276260

277261
if ( ! empty( $found ) ) {
@@ -817,8 +801,8 @@ public static function import_pod_page( $data, $replace = false ) {
817801
];
818802

819803
foreach ( $excluded_args as $excluded_arg ) {
820-
if ( isset( $template[ $excluded_arg ] ) ) {
821-
unset( $template[ $excluded_arg ] );
804+
if ( isset( $page[ $excluded_arg ] ) ) {
805+
unset( $page[ $excluded_arg ] );
822806
}
823807
}
824808
} elseif ( ! empty( $page['options'] ) ) {
@@ -841,6 +825,8 @@ public static function import_pod_page( $data, $replace = false ) {
841825
/**
842826
* Handle importing of the pod helper.
843827
*
828+
* @deprecated 3.3.2
829+
*
844830
* @since 2.8.0
845831
*
846832
* @param array $data The import data.
@@ -849,49 +835,7 @@ public static function import_pod_page( $data, $replace = false ) {
849835
* @return array|\Pods\Whatsit|false The imported object or false if failed.
850836
*/
851837
public static function import_pod_helper( $data, $replace = false ) {
852-
if ( isset( $data['id'] ) ) {
853-
unset( $data['id'] );
854-
}
855-
856-
$helper = self::$api->load_helper( [ 'name' => $data['name'] ] );
857-
858-
if ( ! empty( $helper ) ) {
859-
// Delete Helper if it exists
860-
if ( $replace ) {
861-
self::$api->delete_helper( [ 'id' => $helper['id'] ] );
862-
863-
$helper = [];
864-
}
865-
} else {
866-
$helper = [];
867-
}
868-
869-
// Backwards compatibility
870-
if ( isset( $data['phpcode'] ) ) {
871-
$data['code'] = $data['phpcode'];
872-
873-
unset( $data['phpcode'] );
874-
}
875-
876-
if ( isset( $data['type'] ) ) {
877-
if ( 'before' === $data['type'] ) {
878-
$data['type'] = 'pre_save';
879-
} elseif ( 'after' === $data['type'] ) {
880-
$data['type'] = 'post_save';
881-
}
882-
}
883-
884-
$helper = pods_config_merge_data( $helper, $data );
885-
886-
if ( isset( $helper['type'] ) ) {
887-
$helper['helper_type'] = $helper['type'];
888-
889-
unset( $helper['helper_type'] );
890-
}
891-
892-
self::$api->save_helper( $helper );
893-
894-
return $helper;
838+
return false;
895839
}
896840

897841
/**
@@ -1157,28 +1101,6 @@ public static function export( $params ) {
11571101
}
11581102
}
11591103

1160-
if ( ! empty( $helper_ids ) ) {
1161-
$api_params = array();
1162-
1163-
if ( true !== $helper_ids ) {
1164-
$api_params['ids'] = (array) $helper_ids;
1165-
}
1166-
1167-
$export['helpers'] = array_values( self::$api->load_helpers( $api_params ) );
1168-
1169-
foreach ( $export['helpers'] as $k => $helper ) {
1170-
$helper = $helper->get_clean_args();
1171-
1172-
foreach ( $excluded_args as $excluded_arg ) {
1173-
if ( isset( $helper[ $excluded_arg ] ) ) {
1174-
unset( $helper[ $excluded_arg ] );
1175-
}
1176-
}
1177-
1178-
$export['helpers'][ $k ] = $helper;
1179-
}
1180-
}
1181-
11821104
/**
11831105
* Allow filtering the package being exported.
11841106
*

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
- ui/forms
1313
- ui/front
1414
- init.php
15-
- vendor/vendor-prefixed
1615
excludePaths:
16+
- vendor/vendor-prefixed
1717
- src/Pods/Integrations
1818
- tests

src/Pods/REST/V1/Endpoints/Swagger_Documentation.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)