Skip to content

Commit 02705e5

Browse files
authored
Update and apply php-cs-fixer (#4)
1 parent 7be2ad5 commit 02705e5

File tree

194 files changed

+1291
-1394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+1291
-1394
lines changed

.php-cs-fixer.dist.php

-5
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66
return (new PhpCsFixer\Config())
77
->setRules([
88
'@Symfony' => true,
9-
'@Symfony:risky' => true,
10-
'@PHPUnit75Migration:risky' => true,
11-
'php_unit_dedicate_assert' => ['target' => '5.6'],
129
'array_syntax' => ['syntax' => 'short'],
1310
'php_unit_fqcn_annotation' => true,
1411
'no_unreachable_default_argument_value' => false,
1512
'braces' => ['allow_single_line_closure' => true],
1613
'heredoc_to_nowdoc' => false,
1714
'ordered_imports' => true,
1815
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
19-
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'],
2016
'fopen_flags' => false,
2117
])
22-
->setRiskyAllowed(true)
2318
->setFinder($finder)
2419
;

lib/classes/Swift.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
abstract class Swift
1717
{
18-
const VERSION = '6.3.0';
18+
public const VERSION = '6.3.0';
1919

2020
public static $initialized = false;
2121
public static $inits = [];

lib/classes/Swift/Attachment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($data = null, $filename = null, $contentType = null)
3030
'Swift_Mime_Attachment::__construct',
3131
Swift_DependencyContainer::getInstance()
3232
->createDependenciesFor('mime.attachment')
33-
);
33+
);
3434

3535
$this->setBody($data, $contentType);
3636
$this->setFilename($filename);

lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public function removeFilter($key)
7676
*
7777
* @param string $bytes
7878
*
79-
* @throws Swift_IoException
80-
*
8179
* @return int
80+
*
81+
* @throws Swift_IoException
8282
*/
8383
public function write($bytes)
8484
{

lib/classes/Swift/ByteStream/FileByteStream.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
3131
private $writer;
3232

3333
/** If stream is seekable true/false, or null if not known */
34-
private $seekable = null;
34+
private $seekable;
3535

3636
/**
3737
* Create a new FileByteStream for $path.

lib/classes/Swift/ByteStream/TemporaryFileByteStream.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public function __destruct()
4242

4343
public function __sleep()
4444
{
45-
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
45+
throw new BadMethodCallException('Cannot serialize '.__CLASS__);
4646
}
4747

4848
public function __wakeup()
4949
{
50-
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
50+
throw new BadMethodCallException('Cannot unserialize '.__CLASS__);
5151
}
5252
}

lib/classes/Swift/CharacterReader.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616
*/
1717
interface Swift_CharacterReader
1818
{
19-
const MAP_TYPE_INVALID = 0x01;
20-
const MAP_TYPE_FIXED_LEN = 0x02;
21-
const MAP_TYPE_POSITIONS = 0x03;
19+
public const MAP_TYPE_INVALID = 0x01;
20+
public const MAP_TYPE_FIXED_LEN = 0x02;
21+
public const MAP_TYPE_POSITIONS = 0x03;
2222

2323
/**
2424
* Returns the complete character map.
2525
*
2626
* @param string $string
2727
* @param int $startOffset
2828
* @param array $currentMap
29-
* @param mixed $ignoredChars
3029
*
3130
* @return int
3231
*/

lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function __construct($width)
3939
* @param string $string
4040
* @param int $startOffset
4141
* @param array $currentMap
42-
* @param mixed $ignoredChars
4342
*
4443
* @return int
4544
*/

lib/classes/Swift/CharacterReader/Utf8Reader.php

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
7878
* @param string $string
7979
* @param int $startOffset
8080
* @param array $currentMap
81-
* @param mixed $ignoredChars
8281
*
8382
* @return int
8483
*/

lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function init()
7171
'constructor' => [],
7272
];
7373

74-
//7-8 bit charsets
74+
// 7-8 bit charsets
7575
self::$map['(us-)?ascii'] = $singleByte;
7676
self::$map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
7777
self::$map['windows-?125[0-9]'] = $singleByte;
@@ -84,10 +84,10 @@ public function init()
8484
self::$map['(cork|t1)'] = $singleByte;
8585
self::$map['v?iscii'] = $singleByte;
8686

87-
//16 bits
87+
// 16 bits
8888
self::$map['(ucs-?2|utf-?16)'] = $doubleByte;
8989

90-
//32 bits
90+
// 32 bits
9191
self::$map['(ucs-?4|utf-?32)'] = $fourBytes;
9292

9393
// Fallback

lib/classes/Swift/CharacterStream/ArrayCharacterStream.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public function importByteStream(Swift_OutputByteStream $os)
9292
$size = \count($c);
9393
$need = $this->charReader
9494
->validateByteSequence($c, $size);
95-
if ($need > 0 &&
96-
false !== $bytes = $os->read($need)) {
95+
if ($need > 0
96+
&& false !== $bytes = $os->read($need)) {
9797
for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
9898
$c[] = self::$byteMap[$bytes[$i]];
9999
}

lib/classes/Swift/CharacterStream/NgCharacterStream.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
5252

5353
/**
5454
* Map.
55-
*
56-
* @var mixed
5755
*/
5856
private $map;
5957

@@ -165,8 +163,8 @@ public function read($length)
165163
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
166164
$len = $length * $this->map;
167165
$ret = substr($this->datas,
168-
$this->currentPos * $this->map,
169-
$len);
166+
$this->currentPos * $this->map,
167+
$len);
170168
$this->currentPos += $length;
171169
break;
172170

lib/classes/Swift/DependencyContainer.php

+7-13
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
class Swift_DependencyContainer
1717
{
1818
/** Constant for literal value types */
19-
const TYPE_VALUE = 0x00001;
19+
public const TYPE_VALUE = 0x00001;
2020

2121
/** Constant for new instance types */
22-
const TYPE_INSTANCE = 0x00010;
22+
public const TYPE_INSTANCE = 0x00010;
2323

2424
/** Constant for shared instance types */
25-
const TYPE_SHARED = 0x00100;
25+
public const TYPE_SHARED = 0x00100;
2626

2727
/** Constant for aliases */
28-
const TYPE_ALIAS = 0x01000;
28+
public const TYPE_ALIAS = 0x01000;
2929

3030
/** Constant for arrays */
31-
const TYPE_ARRAY = 0x10000;
31+
public const TYPE_ARRAY = 0x10000;
3232

3333
/** Singleton instance */
34-
private static $instance = null;
34+
private static $instance;
3535

3636
/** The data container */
3737
private $store = [];
@@ -94,8 +94,6 @@ public function has($itemName)
9494
*
9595
* @param string $itemName
9696
*
97-
* @return mixed
98-
*
9997
* @throws Swift_DependencyException If the dependency is not found
10098
*/
10199
public function lookup($itemName)
@@ -161,8 +159,6 @@ public function register($itemName)
161159
*
162160
* {@link register()} must be called before this will work.
163161
*
164-
* @param mixed $value
165-
*
166162
* @return $this
167163
*/
168164
public function asValue($value)
@@ -271,8 +267,6 @@ public function withDependencies(array $lookups)
271267
*
272268
* @see withDependencies(), addConstructorLookup()
273269
*
274-
* @param mixed $value
275-
*
276270
* @return $this
277271
*/
278272
public function addConstructorValue($value)
@@ -326,7 +320,7 @@ private function createNewInstance($itemName)
326320
if ($reflector->getConstructor()) {
327321
return $reflector->newInstanceArgs(
328322
$this->createDependenciesFor($itemName)
329-
);
323+
);
330324
}
331325

332326
return $reflector->newInstance();

lib/classes/Swift/EmbeddedFile.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($data = null, $filename = null, $contentType = null)
3030
'Swift_Mime_EmbeddedFile::__construct',
3131
Swift_DependencyContainer::getInstance()
3232
->createDependenciesFor('mime.embeddedfile')
33-
);
33+
);
3434

3535
$this->setBody($data);
3636
$this->setFilename($filename);

lib/classes/Swift/Encoder/Base64Encoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
4040
if (0 != $firstLineOffset) {
4141
$firstLine = substr(
4242
$encodedString, 0, $maxLineLength - $firstLineOffset
43-
)."\r\n";
43+
)."\r\n";
4444
$encodedString = substr(
4545
$encodedString, $maxLineLength - $firstLineOffset
46-
);
46+
);
4747
}
4848

4949
return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n"));

lib/classes/Swift/Encoder/QpEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
106106
* @param Swift_CharacterStream $charStream to use for reading characters
107107
* @param Swift_StreamFilter $filter if input should be canonicalized
108108
*/
109-
public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null)
109+
public function __construct(Swift_CharacterStream $charStream, ?Swift_StreamFilter $filter = null)
110110
{
111111
$this->charStream = $charStream;
112112
if (!isset(self::$safeMapShare[$this->getSafeMapShareId()])) {
@@ -280,7 +280,7 @@ protected function standardize($string)
280280
{
281281
$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'],
282282
["=09\r\n", "=20\r\n", "\r\n"], $string
283-
);
283+
);
284284
switch ($end = \ord(substr($string, -1))) {
285285
case 0x09:
286286
case 0x20:

lib/classes/Swift/Events/Event.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function getSource();
2525
/**
2626
* Prevent this Event from bubbling any further up the stack.
2727
*
28-
* @param bool $cancel, optional
28+
* @param bool $cancel optional
2929
*/
3030
public function cancelBubble($cancel = true);
3131

lib/classes/Swift/Events/SendEvent.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
class Swift_Events_SendEvent extends Swift_Events_EventObject
1717
{
1818
/** Sending has yet to occur */
19-
const RESULT_PENDING = 0x0001;
19+
public const RESULT_PENDING = 0x0001;
2020

2121
/** Email is spooled, ready to be sent */
22-
const RESULT_SPOOLED = 0x0011;
22+
public const RESULT_SPOOLED = 0x0011;
2323

2424
/** Sending was successful */
25-
const RESULT_SUCCESS = 0x0010;
25+
public const RESULT_SUCCESS = 0x0010;
2626

2727
/** Sending worked, but there were some failures */
28-
const RESULT_TENTATIVE = 0x0100;
28+
public const RESULT_TENTATIVE = 0x0100;
2929

3030
/** Sending failed */
31-
const RESULT_FAILED = 0x1000;
31+
public const RESULT_FAILED = 0x1000;
3232

3333
/**
3434
* The Message being sent.

lib/classes/Swift/FailoverTransport.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct($transports = [])
2626
'Swift_Transport_FailoverTransport::__construct',
2727
Swift_DependencyContainer::getInstance()
2828
->createDependenciesFor('transport.failover')
29-
);
29+
);
3030

3131
$this->setTransports($transports);
3232
}

lib/classes/Swift/FileSpool.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public function setRetryLimit($limit)
8585
*
8686
* @param Swift_Mime_SimpleMessage $message The message to store
8787
*
88-
* @throws Swift_IoException
89-
*
9088
* @return bool
89+
*
90+
* @throws Swift_IoException
9191
*/
9292
public function queueMessage(Swift_Mime_SimpleMessage $message)
9393
{

lib/classes/Swift/InputByteStream.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ interface Swift_InputByteStream
3030
*
3131
* @param string $bytes
3232
*
33-
* @throws Swift_IoException
34-
*
3533
* @return int
34+
*
35+
* @throws Swift_IoException
3636
*/
3737
public function write($bytes);
3838

@@ -49,8 +49,6 @@ public function commit();
4949
*
5050
* The stream acts as an observer, receiving all data that is written.
5151
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
52-
*
53-
* @param Swift_InputByteStream $is
5452
*/
5553
public function bind(self $is);
5654

@@ -60,8 +58,6 @@ public function bind(self $is);
6058
* If $is is not bound, no errors will be raised.
6159
* If the stream currently has any buffered data it will be written to $is
6260
* before unbinding occurs.
63-
*
64-
* @param Swift_InputByteStream $is
6561
*/
6662
public function unbind(self $is);
6763

lib/classes/Swift/IoException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Swift_IoException extends Swift_SwiftException
2121
* @param string $message
2222
* @param int $code
2323
*/
24-
public function __construct($message, $code = 0, Exception $previous = null)
24+
public function __construct($message, $code = 0, ?Exception $previous = null)
2525
{
2626
parent::__construct($message, $code, $previous);
2727
}

lib/classes/Swift/KeyCache.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
interface Swift_KeyCache
1717
{
1818
/** Mode for replacing existing cached data */
19-
const MODE_WRITE = 1;
19+
public const MODE_WRITE = 1;
2020

2121
/** Mode for appending data to the end of existing cached data */
22-
const MODE_APPEND = 2;
22+
public const MODE_APPEND = 2;
2323

2424
/**
2525
* Set a string into the cache under $itemKey for the namespace $nsKey.
@@ -56,7 +56,7 @@ public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $o
5656
*
5757
* @return Swift_InputByteStream
5858
*/
59-
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $is = null);
59+
public function getInputByteStream($nsKey, $itemKey, ?Swift_InputByteStream $is = null);
6060

6161
/**
6262
* Get data back out of the cache as a string.

lib/classes/Swift/KeyCache/ArrayKeyCache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $o
105105
*
106106
* @return Swift_InputByteStream
107107
*/
108-
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null)
108+
public function getInputByteStream($nsKey, $itemKey, ?Swift_InputByteStream $writeThrough = null)
109109
{
110110
$is = clone $this->stream;
111111
$is->setKeyCache($this);

0 commit comments

Comments
 (0)