mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Merge "Replace BadMethodCallException with LogicException"
This commit is contained in:
commit
22435fe600
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\EditBox;
|
||||
|
||||
use BadMethodCallException;
|
||||
use LogicException;
|
||||
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
||||
use MediaWiki\Extension\AbuseFilter\KeywordsManager;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
|
@ -89,7 +89,7 @@ class EditBoxBuilderFactory {
|
|||
OutputPage $output
|
||||
): AceEditBoxBuilder {
|
||||
if ( !$this->isCodeEditorLoaded ) {
|
||||
throw new BadMethodCallException( 'Cannot create Ace box without CodeEditor' );
|
||||
throw new LogicException( 'Cannot create Ace box without CodeEditor' );
|
||||
}
|
||||
return new AceEditBoxBuilder(
|
||||
$this->afPermManager,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\Filter;
|
||||
|
||||
use BadMethodCallException;
|
||||
use LogicException;
|
||||
|
||||
/**
|
||||
* Value object representing a filter that can be mutated (i.e. provides setters); this representation can
|
||||
|
@ -78,12 +78,12 @@ class MutableFilter extends Filter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws BadMethodCallException if $actions are already set; use $this->setActions to update names
|
||||
* @throws LogicException if $actions are already set; use $this->setActions to update names
|
||||
* @param string[] $actionsNames
|
||||
*/
|
||||
public function setActionsNames( array $actionsNames ): void {
|
||||
if ( $this->actions !== null ) {
|
||||
throw new BadMethodCallException( 'Cannot set actions names with actions already set' );
|
||||
throw new LogicException( 'Cannot set actions names with actions already set' );
|
||||
}
|
||||
$this->specs->setActionsNames( $actionsNames );
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\View;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Html;
|
||||
use HtmlArmor;
|
||||
use IContextSource;
|
||||
use Linker;
|
||||
use LogicException;
|
||||
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
||||
use MediaWiki\Extension\AbuseFilter\Consequences\ConsequencesRegistry;
|
||||
use MediaWiki\Extension\AbuseFilter\EditBox\EditBoxBuilderFactory;
|
||||
|
@ -1200,7 +1200,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$request = $this->getRequest();
|
||||
if ( !$request->wasPosted() ) {
|
||||
// Sanity
|
||||
throw new BadMethodCallException( __METHOD__ . ' called without the request being POSTed.' );
|
||||
throw new LogicException( __METHOD__ . ' called without the request being POSTed.' );
|
||||
}
|
||||
|
||||
$origFilter = $this->loadFilterData( $filter );
|
||||
|
@ -1249,7 +1249,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$request = $this->getRequest();
|
||||
if ( !$request->wasPosted() ) {
|
||||
// Sanity
|
||||
throw new BadMethodCallException( __METHOD__ . ' called without the request being POSTed.' );
|
||||
throw new LogicException( __METHOD__ . ' called without the request being POSTed.' );
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\Tests\Unit;
|
||||
|
||||
use BadMethodCallException;
|
||||
use LogicException;
|
||||
use MediaWiki\Extension\AbuseFilter\AbuseFilterPermissionManager;
|
||||
use MediaWiki\Extension\AbuseFilter\EditBox\AceEditBoxBuilder;
|
||||
use MediaWiki\Extension\AbuseFilter\EditBox\EditBoxBuilderFactory;
|
||||
|
@ -87,7 +87,7 @@ class EditBoxBuilderFactoryTest extends MediaWikiUnitTestCase {
|
|||
* @covers ::newAceBoxBuilder
|
||||
*/
|
||||
public function testNewAceBoxBuilder__invalid() {
|
||||
$this->expectException( BadMethodCallException::class );
|
||||
$this->expectException( LogicException::class );
|
||||
$this->getFactory( false )->newAceBoxBuilder(
|
||||
$this->createMock( MessageLocalizer::class ),
|
||||
$this->createMock( Authority::class ),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Extension\AbuseFilter\Tests\Unit\Filter;
|
||||
|
||||
use BadMethodCallException;
|
||||
use LogicException;
|
||||
use MediaWiki\Extension\AbuseFilter\Filter\Filter;
|
||||
use MediaWiki\Extension\AbuseFilter\Filter\Flags;
|
||||
use MediaWiki\Extension\AbuseFilter\Filter\LastEditInfo;
|
||||
|
@ -86,7 +86,7 @@ class MutableFilterTest extends MediaWikiUnitTestCase {
|
|||
[ 'foo' => [] ],
|
||||
new LastEditInfo( 42, 'User', '12345' )
|
||||
);
|
||||
$this->expectException( BadMethodCallException::class );
|
||||
$this->expectException( LogicException::class );
|
||||
$filter->setActionsNames( [ 'x' ] );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue