FIX: Update swiftmailer librairies

This commit is contained in:
kamel
2021-12-07 17:11:34 +01:00
parent bd52613331
commit 1ca199d796
156 changed files with 2370 additions and 1637 deletions

View File

@@ -25,7 +25,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* @var Swift_StreamFilter[]
*/
private $filters = array();
private $filters = [];
/**
* A buffer for writing.
@@ -37,7 +37,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* @var Swift_InputByteStream[]
*/
private $mirrors = array();
private $mirrors = [];
/**
* Commit the given bytes to the storage medium immediately.
@@ -54,8 +54,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
/**
* Add a StreamFilter to this InputByteStream.
*
* @param Swift_StreamFilter $filter
* @param string $key
* @param string $key
*/
public function addFilter(Swift_StreamFilter $filter, $key)
{
@@ -110,8 +109,6 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
*
* @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -124,14 +121,12 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
*
* @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
foreach ($this->mirrors as $k => $stream) {
if ($is === $stream) {
if ($this->writeBuffer !== '') {
if ('' !== $this->writeBuffer) {
$stream->write($this->writeBuffer);
}
unset($this->mirrors[$k]);
@@ -147,7 +142,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function flushBuffers()
{
if ($this->writeBuffer !== '') {
if ('' !== $this->writeBuffer) {
$this->doWrite($this->writeBuffer);
}
$this->flush();

View File

@@ -20,7 +20,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* @var string[]
*/
private $array = array();
private $array = [];
/**
* The size of the stack.
@@ -41,7 +41,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* @var Swift_InputByteStream[]
*/
private $mirrors = array();
private $mirrors = [];
/**
* Create a new ArrayByteStream.
@@ -52,13 +52,13 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*/
public function __construct($stack = null)
{
if (is_array($stack)) {
if (\is_array($stack)) {
$this->array = $stack;
$this->arraySize = count($stack);
} elseif (is_string($stack)) {
$this->arraySize = \count($stack);
} elseif (\is_string($stack)) {
$this->write($stack);
} else {
$this->array = array();
$this->array = [];
}
}
@@ -102,7 +102,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
foreach ($to_add as $value) {
$this->array[] = $value;
}
$this->arraySize = count($this->array);
$this->arraySize = \count($this->array);
foreach ($this->mirrors as $stream) {
$stream->write($bytes);
@@ -121,8 +121,6 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
*
* @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -135,8 +133,6 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
*
* @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
@@ -172,7 +168,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
public function flushBuffers()
{
$this->offset = 0;
$this->array = array();
$this->array = [];
$this->arraySize = 0;
foreach ($this->mirrors as $stream) {

View File

@@ -81,7 +81,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
// If we read one byte after reaching the end of the file
// feof() will return false and an empty string is returned
if ($bytes === '' && feof($fp)) {
if ((false === $bytes || '' === $bytes) && feof($fp)) {
$this->resetReadHandle();
return false;
@@ -131,7 +131,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
throw new Swift_IoException('Unable to open file for reading ['.$this->path.']');
}
$this->reader = $pointer;
if ($this->offset != 0) {
if (0 != $this->offset) {
$this->getReadStreamSeekableStatus();
$this->seekReadStreamToPosition($this->offset);
}
@@ -145,9 +145,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
{
if (!isset($this->writer)) {
if (!$this->writer = fopen($this->path, $this->mode)) {
throw new Swift_IoException(
'Unable to open file for writing ['.$this->path.']'
);
throw new Swift_IoException('Unable to open file for writing ['.$this->path.']');
}
}
@@ -173,10 +171,10 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
/** Streams in a readOnly stream ensuring copy if needed */
private function seekReadStreamToPosition($offset)
{
if ($this->seekable === null) {
if (null === $this->seekable) {
$this->getReadStreamSeekableStatus();
}
if ($this->seekable === false) {
if (false === $this->seekable) {
$currentPos = ftell($this->reader);
if ($currentPos < $offset) {
$toDiscard = $offset - $currentPos;
@@ -194,7 +192,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
{
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {
/* We have opened a php:// Stream Should work without problem */
} elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
} elseif (\function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
/* We have opened a tmpfile */
} else {
throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');

View File

@@ -17,7 +17,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
{
$filePath = tempnam(sys_get_temp_dir(), 'FileByteStream');
if ($filePath === false) {
if (false === $filePath) {
throw new Swift_IoException('Failed to retrieve temporary file name.');
}
@@ -26,7 +26,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
public function getContent()
{
if (($content = file_get_contents($this->getPath())) === false) {
if (false === ($content = file_get_contents($this->getPath()))) {
throw new Swift_IoException('Failed to get temporary file content.');
}
@@ -39,4 +39,14 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
@unlink($this->getPath());
}
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
}