Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  Add missing dots at the end of exception messages
  • Loading branch information
fabpot committed Mar 15, 2020
2 parents 7e41b4f + 1791cbf commit 85f59e7
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions File/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function move($directory, $name = null)
$renamed = rename($this->getPathname(), $target);
restore_error_handler();
if (!$renamed) {
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
}

@chmod($target, 0666 & ~umask());
Expand All @@ -106,10 +106,10 @@ protected function getTargetFile($directory, $name = null)
{
if (!is_dir($directory)) {
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
throw new FileException(sprintf('Unable to create the "%s" directory', $directory));
throw new FileException(sprintf('Unable to create the "%s" directory.', $directory));
}
} elseif (!is_writable($directory)) {
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
throw new FileException(sprintf('Unable to write in the "%s" directory.', $directory));
}

$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
Expand Down
2 changes: 1 addition & 1 deletion File/MimeType/MimeTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function guess($path)
}

if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?).');
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion File/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function move($directory, $name = null)
$moved = move_uploaded_file($this->getPathname(), $target);
restore_error_handler();
if (!$moved) {
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
}

@chmod($target, 0666 & ~umask());
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/Handler/MemcachedSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(\Memcached $memcached, array $options = [])
$this->memcached = $memcached;

if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff)));
}

$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/Handler/MongoDbSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler
public function __construct(\MongoDB\Client $mongo, array $options)
{
if (!isset($options['database']) || !isset($options['collection'])) {
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler');
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler.');
}

$this->mongo = $mongo;
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/Handler/NativeFileSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function __construct(string $savePath = null)

if ($count = substr_count($savePath, ';')) {
if ($count > 2) {
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath));
throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'.', $savePath));
}

// characters after last ';' are the path
$baseDir = ltrim(strrchr($savePath, ';'), ';');
}

if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $baseDir));
}

ini_set('session.save_path', $savePath);
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/Handler/PdoSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function __construct($pdoOrDsn = null, array $options = [])
{
if ($pdoOrDsn instanceof \PDO) {
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__));
throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__));
}

$this->pdo = $pdoOrDsn;
Expand Down Expand Up @@ -468,7 +468,7 @@ private function buildDsnFromUrl(string $dsnOrUrl): string
}

if (!isset($params['scheme'])) {
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler.');
}

$driverAliasMap = [
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/MockArraySessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function setName($name)
public function save()
{
if (!$this->started || $this->closed) {
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.');
}
// nothing to do since we don't persist the session data
$this->closed = false;
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/MockFileSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(string $savePath = null, string $name = 'MOCKSESSID'
}

if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) {
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $savePath));
throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s".', $savePath));
}

$this->savePath = $savePath;
Expand Down Expand Up @@ -87,7 +87,7 @@ public function regenerate($destroy = false, $lifetime = null)
public function save()
{
if (!$this->started) {
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed.');
}

$data = $this->data;
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/NativeSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function start()

// ok to try and start the session
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
throw new \RuntimeException('Failed to start the session.');
}

if (null !== $this->emulateSameSite) {
Expand Down
4 changes: 2 additions & 2 deletions Session/Storage/Proxy/AbstractProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getId()
public function setId($id)
{
if ($this->isActive()) {
throw new \LogicException('Cannot change the ID of an active session');
throw new \LogicException('Cannot change the ID of an active session.');
}

session_id($id);
Expand All @@ -114,7 +114,7 @@ public function getName()
public function setName($name)
{
if ($this->isActive()) {
throw new \LogicException('Cannot change the name of an active session');
throw new \LogicException('Cannot change the name of an active session.');
}

session_name($name);
Expand Down

0 comments on commit 85f59e7

Please sign in to comment.