Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call WebRequest::getLimitOffset in 1.35 #4575

Merged
merged 8 commits into from Feb 21, 2020
Merged

Don't call WebRequest::getLimitOffset in 1.35 #4575

merged 8 commits into from Feb 21, 2020

Conversation

DannyS712
Copy link
Contributor

return $request->getLimitOffsetForUser( $this->getUser() );
} else {
return $request->getLimitOffset();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write this without the else part:

		if ( method_exists( $request, 'getLimitOffsetForUser' ) ) {
			// MW 1.35+
			return $request->getLimitOffsetForUser( $this->getUser() );
		}

		return $request->getLimitOffset();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I was using the same code block that I was using elsewhere where it wasn't returning, but rather setting a variable, so I kept the else block

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is part of the reason why using a guard clause (the form in my variation) is nice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeroenDeDauw JeroenDeDauw merged commit 1d5bae7 into SemanticMediaWiki:master Feb 21, 2020
@DannyS712 DannyS712 deleted the patch-1 branch February 21, 2020 23:17
@kghbln
Copy link
Member

kghbln commented Feb 22, 2020

@DannyS712 Thanks a lot for the pull!

@kghbln kghbln added this to the SMW 3.2.0 milestone Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants