wiki.techinc.nl/includes/session/SessionOverflowException.php
Ebrahim Byagowi b5727d94b5 Import InvalidArgumentException at top of the source
It was asked in a patch review to apply fully import
InvalidArgumentException where possible. I was guessing some
of my other already merged patches have but turned out such
thing exists other places style so for the sake of consistency
I've turned rest of inline import of the specific exception at
top of the file.

There are instances of source files that aren't in any namespace but
have fully qualified import which this patch doesn't touch.

Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
2024-05-19 23:57:44 +03:30

36 lines
900 B
PHP

<?php
namespace MediaWiki\Session;
use InvalidArgumentException;
/**
* OverflowException specific to the SessionManager, used when the request had multiple possible
* sessions tied for top priority.
*
* @since 1.34
*/
class SessionOverflowException extends \OverflowException {
/** @var SessionInfo[] */
private $sessionInfos;
/**
* @param SessionInfo[] $sessionInfos Must have at least two elements
* @param string $msg
* @throws \InvalidArgumentException If $sessionInfos has less than 2 elements
*/
public function __construct( array $sessionInfos, $msg ) {
if ( count( $sessionInfos ) < 2 ) {
throw new InvalidArgumentException( 'Expected at least two SessionInfo objects.' );
}
parent::__construct( $msg );
$this->sessionInfos = $sessionInfos;
}
/**
* @return SessionInfo[]
*/
public function getSessionInfos(): array {
return $this->sessionInfos;
}
}