Skip to content

Commit

Permalink
Revert a few PHP types in core and admin (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
herrvigg committed Apr 15, 2023
1 parent 9f81d5b commit 07c9214
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* @see qtranxf_collect_translations
*/
function qtranxf_collect_translations_deep( $qfields, string $sep ) {
function qtranxf_collect_translations_deep( $qfields, $sep ) {
$content = reset( $qfields );
if ( is_string( $content ) ) {
return qtranxf_join_texts( $qfields, $sep );
Expand All @@ -40,7 +40,7 @@ function qtranxf_collect_translations_deep( $qfields, string $sep ) {
* @param array|string $request an ML field of $_REQUEST.
* @param string $edit_lang language of the active LSB at the time of sending the request.
*/
function qtranxf_collect_translations( array &$qfields, &$request, string $edit_lang ): void {
function qtranxf_collect_translations( &$qfields, &$request, $edit_lang ): void {
if ( isset( $qfields['qtranslate-separator'] ) ) {
$sep = $qfields['qtranslate-separator'];
unset( $qfields['qtranslate-separator'] );
Expand Down
2 changes: 1 addition & 1 deletion src/admin/admin_utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function qtranxf_admin_the_title( string $title ): string {

if ( ! function_exists( 'qtranxf_trim_words' ) ) {
// TODO clarify duplicate function name, defined in frontend!
function qtranxf_trim_words( string $text, int $num_words, string $more, string $original_text ): string {
function qtranxf_trim_words( $text, int $num_words, $more, $original_text ): string {
$blocks = qtranxf_get_language_blocks( $original_text );
if ( count( $blocks ) <= 1 ) {
return $text;
Expand Down
4 changes: 2 additions & 2 deletions src/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ function qtranxf_esc_html( $text ) {

if ( ! function_exists( 'qtranxf_trim_words' ) ) {
// filter added in qtranslate_hooks.php
function qtranxf_trim_words( string $text, int $num_words, string $more, string $original_text ): string {
function qtranxf_trim_words( $text, int $num_words, $more, $original_text ): string {
global $q_config;
$blocks = qtranxf_get_language_blocks( $original_text );
if ( count( $blocks ) <= 1 ) {
Expand Down Expand Up @@ -833,7 +833,7 @@ function qtranxf_checkCanonical( $redirect_url, $requested_url ): string {
/**
* @since 3.2.8 moved here from _hooks.php
*/
function qtranxf_convertBlogInfoURL( string $url, string $what ): string {
function qtranxf_convertBlogInfoURL( $url, string $what ): string {
switch ( $what ) {
case 'stylesheet_url':
case 'template_url':
Expand Down
4 changes: 2 additions & 2 deletions src/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function qtranxf_add_query_arg( ?string &$query, string $key_value ): void {
* Simplified version of WP's remove_query_arg
* @since 3.2.8
*/
function qtranxf_del_query_arg( string &$query, string $key ): void {
function qtranxf_del_query_arg( ?string &$query, string $key ): void {
while ( preg_match( '/(&|&amp;|&#038;|^)(' . $key . '=[^&]+)(&|&amp;|&#038;|$)/i', $query, $matches ) ) {
$pos = strpos( $query, $matches[2] );
$count = strlen( $matches[2] );
Expand Down Expand Up @@ -247,7 +247,7 @@ function qtranxf_post_type() {
* Test $cfg['pages'] against $url_path and $url_query ($_SERVER['QUERY_STRING'])
* @since 3.4
*/
function qtranxf_match_page( array $cfg, string $url_path, string $url_query, string $d ): bool {
function qtranxf_match_page( ?array $cfg, string $url_path, string $url_query, string $d ): bool {
if ( ! isset( $cfg['pages'] ) ) {
return true;
}
Expand Down

0 comments on commit 07c9214

Please sign in to comment.