Skip to content

Commit

Permalink
Issue 71 - fix deprecation warnings (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinn-it-ilm authored Nov 22, 2024
1 parent fdb9621 commit babf232
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
if: matrix.coverage == true

- name: Upload code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: coverage/php/coverage.xml
if: matrix.coverage == true
4 changes: 2 additions & 2 deletions includes/AppliedFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function create( Filter $filter, $values, $search_terms = null, $l
* @phan-return array{year:int,month:int,day:int}|null
*/
protected function parseUpperOrLowerDate( $raw_date, $is_upper ) {
$parts = array_filter( array_map( 'intval', explode( '-', $raw_date ) ) );
$parts = array_filter( array_map( 'intval', explode( '-', $raw_date ?? '' ) ) );
if ( !$parts ) {
return null;
}
Expand Down Expand Up @@ -309,7 +309,7 @@ public function getAllOrValues( $category ): PossibleFilterValues {
$possible_values[] = new PossibleFilterValue(
$value_string,
null,
htmlspecialchars_decode( $row['displayTitle'] )
htmlspecialchars_decode( $row['displayTitle'] ?? '' )
);
}
return new PossibleFilterValues( $possible_values );
Expand Down
2 changes: 1 addition & 1 deletion includes/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function getAllValues(): PossibleFilterValues {
if ( $value_string === '' ) {
continue;
}
$possible_values[] = new PossibleFilterValue( $value_string, $row['count'], htmlspecialchars_decode( $row['displayTitle'] ) );
$possible_values[] = new PossibleFilterValue( $value_string, $row['count'], htmlspecialchars_decode( $row['displayTitle'] ?? '' ) );
}

return new PossibleFilterValues( $possible_values );
Expand Down
4 changes: 2 additions & 2 deletions includes/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ private function getPageProps(): PageProps {
private function getGetPageFromTitleText(): Closure {
return static function ( string $text ) {
$title = Title::newFromText( $text );
// use appropriate WikiPage function, factory() is deprecated and not exists in MW 1.42
if ( version_compare( MW_VERSION, '1.42', '<' ) ) {
// use appropriate WikiPage function, factory() is deprecated and not exists from MW 1.36
if ( version_compare( MW_VERSION, '1.36', '<' ) ) {
return WikiPage::factory( $title );
}
if ( method_exists( WikiPageFactory::class, 'newFromTitle' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/Specials/BrowseData/GetAppliedFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function getNiceAppliedFilterValue( string $propertyType, string $value
if ( $propertyType === 'page' ) {
$title = Title::newFromText( $value );
$displayTitle = $this->pageProps->getProperties( $title, 'displaytitle' );
$value = $displayTitle === [] ? $value : htmlspecialchars_decode( array_values( $displayTitle )[0] );
$value = $displayTitle === [] ? $value : htmlspecialchars_decode( array_values( $displayTitle )[0] ?? '' );
}

return Utils::getNiceFilterValue( $propertyType, $value );
Expand Down
2 changes: 1 addition & 1 deletion includes/Specials/BrowseData/SpecialBrowseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function execute( $query ): void {

// get information on current category, subcategory and filters
// that have already been applied from the query string
$category = str_replace( '_', ' ', $request->getVal( '_cat' ) );
$category = str_replace( '_', ' ', $request->getVal( '_cat' ) ?? '' );
// if query string did not contain this variables, try the URL
if ( !$category ) {
$queryparts = explode( '/', $query, 1 );
Expand Down
2 changes: 1 addition & 1 deletion includes/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public static function onUnitTestsList( &$paths ) {
* @return string
*/
public static function escapeString( $val ) {
return htmlspecialchars( $val, ENT_QUOTES, 'UTF-8' );
return htmlspecialchars( $val ?? '', ENT_QUOTES, 'UTF-8' );
}

/**
Expand Down

0 comments on commit babf232

Please sign in to comment.