Skip to content

Commit 501b52f

Browse files
committed
Merge branch 'release/3.3.3'
2 parents 391a55f + d9022e8 commit 501b52f

File tree

14 files changed

+343
-168
lines changed

14 files changed

+343
-168
lines changed

.php_cs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* PHP Code Style Fixer (config created for version 2.16.1 (Yellow Bird)).
4+
* PHP Code Style Fixer (config created for version 2.16.4 (Yellow Bird)).
55
*
66
* Use one of the following console commands to just see the
77
* changes that will be made.
@@ -119,7 +119,7 @@ $rules = [
119119
*
120120
* Risky!
121121
* Risky as new docblocks might mean more, e.g. a Doctrine entity
122-
* might have a new column in database
122+
* might have a new column in database.
123123
*/
124124
'comment_to_phpdoc' => [
125125
'ignored_tags' => [
@@ -238,6 +238,7 @@ $rules = [
238238
'iconv',
239239
'mime_content_type',
240240
'rename',
241+
'rmdir',
241242
'unlink',
242243
],
243244
],
@@ -283,7 +284,7 @@ $rules = [
283284
* - Explicit syntax allows word concatenation inside strings, e.g.
284285
* `"${var}IsAVar"`, implicit doesn't
285286
* - Explicit syntax is easier to detect for IDE/editors and
286-
* therefore has colors/hightlight with higher contrast, which is
287+
* therefore has colors/highlight with higher contrast, which is
287288
* easier to read
288289
* Backtick operator is skipped because it is harder to handle; you
289290
* can use `backtick_to_shell_exec` fixer to normalize backticks to
@@ -327,7 +328,7 @@ $rules = [
327328
* want to override a method, use the Template method pattern.
328329
*
329330
* Risky!
330-
* Risky when overriding `public` methods of `abstract` classes
331+
* Risky when overriding `public` methods of `abstract` classes.
331332
*/
332333
'final_public_method_for_abstract_class' => false,
333334

@@ -725,8 +726,8 @@ $rules = [
725726
'no_superfluous_elseif' => true,
726727

727728
/*
728-
* Removes `@param` and `@return` tags that don't provide any useful
729-
* information.
729+
* Removes `@param`, `@return` and `@var` tags that don't provide
730+
* any useful information.
730731
*/
731732
'no_superfluous_phpdoc_tags' => false,
732733

@@ -751,7 +752,13 @@ $rules = [
751752
*/
752753
'no_unneeded_curly_braces' => true,
753754

754-
// A final class must not have final methods.
755+
/*
756+
* A `final` class must not have `final` methods and `private`
757+
* methods must not be `final`.
758+
*
759+
* Risky!
760+
* Risky when child class overrides a `private` method.
761+
*/
755762
'no_unneeded_final_method' => true,
756763

757764
/*
@@ -1140,7 +1147,7 @@ $rules = [
11401147
* adjusts accordingly the function signature. Requires PHP >= 7.0.
11411148
*
11421149
* Risky!
1143-
* [1] This rule is EXPERIMENTAL and is not covered with backward
1150+
* This rule is EXPERIMENTAL and [1] is not covered with backward
11441151
* compatibility promise. [2] `@param` annotation is mandatory for
11451152
* the fixer to make changes, signatures of methods without it (no
11461153
* docblock, inheritdocs) will not be fixed. [3] Manual actions are
@@ -1153,7 +1160,7 @@ $rules = [
11531160
* adjusts accordingly the function signature. Requires PHP >= 7.0.
11541161
*
11551162
* Risky!
1156-
* [1] This rule is EXPERIMENTAL and is not covered with backward
1163+
* This rule is EXPERIMENTAL and [1] is not covered with backward
11571164
* compatibility promise. [2] `@return` annotation is mandatory for
11581165
* the fixer to make changes, signatures of methods without it (no
11591166
* docblock, inheritdocs) will not be fixed. [3] Manual actions are
@@ -1190,8 +1197,8 @@ $rules = [
11901197
'phpdoc_var_annotation_correct_order' => true,
11911198

11921199
/*
1193-
* `@var` and `@type` annotations should not contain the variable
1194-
* name.
1200+
* `@var` and `@type` annotations of classy properties should not
1201+
* contain the name.
11951202
*/
11961203
'phpdoc_var_without_name' => false,
11971204

@@ -1366,7 +1373,7 @@ $rules = [
13661373
* `static`.
13671374
*
13681375
* Risky!
1369-
* Risky when using "->bindTo" on lambdas without referencing to
1376+
* Risky when using `->bindTo` on lambdas without referencing to
13701377
* `$this`.
13711378
*/
13721379
'static_lambda' => true,
@@ -1464,12 +1471,14 @@ $rules = [
14641471

14651472
if (\PHP_SAPI === 'cli' && !class_exists(\PhpCsFixer\Config::class)) {
14661473
$binFixer = __DIR__ . '/vendor/bin/php-cs-fixer';
1474+
14671475
if (!is_file($binFixer)) {
14681476
$binFixer = 'php-cs-fixer';
14691477
}
1470-
$dryRun = !\in_array('--force', $_SERVER['argv'], true);
1478+
$dryRun = !in_array('--force', $_SERVER['argv'], true);
1479+
1480+
$command = escapeshellarg($binFixer) . ' fix --config ' . escapeshellarg(__FILE__) . ' --diff-format udiff --ansi -vv';
14711481

1472-
$command = escapeshellarg($binFixer) . ' fix --config ' . escapeshellarg(__FILE__) . ' --diff-format udiff --ansi';
14731482
if ($dryRun) {
14741483
$command .= ' --dry-run';
14751484
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016-2020 Ne-Lexa
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/IO/ZipReader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ protected function readCentralDirectory(EndOfCentralDirectory $endCD)
354354
fseek($this->inStream, $cdOffset);
355355

356356
if (!($cdStream = fopen('php://temp', 'w+b'))) {
357-
throw new ZipException('Temp resource can not open from write');
357+
// @codeCoverageIgnoreStart
358+
throw new ZipException('A temporary resource cannot be opened for writing.');
359+
// @codeCoverageIgnoreEnd
358360
}
359361
stream_copy_to_stream($this->inStream, $cdStream, $endCD->getCdSize());
360362
rewind($cdStream);

src/Model/Data/ZipNewData.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public function __construct(ZipEntry $zipEntry, $data)
3939
$zipEntry->setUncompressedSize(\strlen($data));
4040

4141
if (!($handle = fopen('php://temp', 'w+b'))) {
42-
throw new \RuntimeException('Temp resource can not open from write.');
42+
// @codeCoverageIgnoreStart
43+
throw new \RuntimeException('A temporary resource cannot be opened for writing.');
44+
// @codeCoverageIgnoreEnd
4345
}
4446
fwrite($handle, $data);
4547
rewind($handle);
@@ -61,7 +63,7 @@ public function __construct(ZipEntry $zipEntry, $data)
6163
public function getDataAsStream()
6264
{
6365
if (!\is_resource($this->stream)) {
64-
throw new \LogicException(sprintf('Resource was closed (entry=%s).', $this->zipEntry->getName()));
66+
throw new \LogicException(sprintf('Resource has been closed (entry=%s).', $this->zipEntry->getName()));
6567
}
6668

6769
return $this->stream;

src/Util/FilesUtil.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function removeDir($dir)
4848
$function = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
4949
$function($fileInfo->getPathname());
5050
}
51-
rmdir($dir);
51+
@rmdir($dir);
5252
}
5353

5454
/**
@@ -198,10 +198,10 @@ public static function globFileSearch($globPattern, $flags = 0, $recursive = tru
198198
return $files;
199199
}
200200

201-
foreach (glob(\dirname($globPattern) . '/*', \GLOB_ONLYDIR | \GLOB_NOSORT) as $dir) {
201+
foreach (glob(\dirname($globPattern) . \DIRECTORY_SEPARATOR . '*', \GLOB_ONLYDIR | \GLOB_NOSORT) as $dir) {
202202
// Unpacking the argument via ... is supported starting from php 5.6 only
203203
/** @noinspection SlowArrayOperationsInLoopInspection */
204-
$files = array_merge($files, self::globFileSearch($dir . '/' . basename($globPattern), $flags, $recursive));
204+
$files = array_merge($files, self::globFileSearch($dir . \DIRECTORY_SEPARATOR . basename($globPattern), $flags, $recursive));
205205
}
206206

207207
return $files;
@@ -273,7 +273,7 @@ public static function humanSize($size, $unit = null)
273273
public static function normalizeZipPath($path)
274274
{
275275
return implode(
276-
'/',
276+
\DIRECTORY_SEPARATOR,
277277
array_filter(
278278
explode('/', (string) $path),
279279
static function ($part) {

0 commit comments

Comments
 (0)