Add null check for str_starts_with

Only needed for phan, under php8.1 this internal
function is deprecated about null.
The property $subscriptionName is not null when $subscriptionTitle is
not null and current code is safe, but phan cannot see the dependency
between both properties

Change-Id: I9e67309ec25a70c5de91d7f3e8f18447f205a4e4
This commit is contained in:
Umherirrender 2023-10-06 16:54:15 +02:00
parent 893846be65
commit 3aadcace2b

View file

@ -33,7 +33,9 @@ class SubscribeAction extends FormAction {
* @inheritDoc
*/
protected function getPageTitle() {
if ( $this->subscriptionTitle && !str_starts_with( $this->subscriptionName, 'p-topics-' ) ) {
if ( $this->subscriptionTitle &&
$this->subscriptionName !== null && !str_starts_with( $this->subscriptionName, 'p-topics-' )
) {
$title = $this->subscriptionTitle;
return $this->msg( 'discussiontools-topicsubscription-action-title' )
->plaintextParams( $title->getPrefixedText(), $title->getFragment() );