Skip to content

Commit

Permalink
Merge branch 'release/3.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne-Lexa committed Jul 11, 2020
2 parents 391a55f + d9022e8 commit 501b52f
Show file tree
Hide file tree
Showing 14 changed files with 343 additions and 168 deletions.
37 changes: 23 additions & 14 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* PHP Code Style Fixer (config created for version 2.16.1 (Yellow Bird)).
* PHP Code Style Fixer (config created for version 2.16.4 (Yellow Bird)).
*
* Use one of the following console commands to just see the
* changes that will be made.
Expand Down Expand Up @@ -119,7 +119,7 @@ $rules = [
*
* Risky!
* Risky as new docblocks might mean more, e.g. a Doctrine entity
* might have a new column in database
* might have a new column in database.
*/
'comment_to_phpdoc' => [
'ignored_tags' => [
Expand Down Expand Up @@ -238,6 +238,7 @@ $rules = [
'iconv',
'mime_content_type',
'rename',
'rmdir',
'unlink',
],
],
Expand Down Expand Up @@ -283,7 +284,7 @@ $rules = [
* - Explicit syntax allows word concatenation inside strings, e.g.
* `"${var}IsAVar"`, implicit doesn't
* - Explicit syntax is easier to detect for IDE/editors and
* therefore has colors/hightlight with higher contrast, which is
* therefore has colors/highlight with higher contrast, which is
* easier to read
* Backtick operator is skipped because it is harder to handle; you
* can use `backtick_to_shell_exec` fixer to normalize backticks to
Expand Down Expand Up @@ -327,7 +328,7 @@ $rules = [
* want to override a method, use the Template method pattern.
*
* Risky!
* Risky when overriding `public` methods of `abstract` classes
* Risky when overriding `public` methods of `abstract` classes.
*/
'final_public_method_for_abstract_class' => false,

Expand Down Expand Up @@ -725,8 +726,8 @@ $rules = [
'no_superfluous_elseif' => true,

/*
* Removes `@param` and `@return` tags that don't provide any useful
* information.
* Removes `@param`, `@return` and `@var` tags that don't provide
* any useful information.
*/
'no_superfluous_phpdoc_tags' => false,

Expand All @@ -751,7 +752,13 @@ $rules = [
*/
'no_unneeded_curly_braces' => true,

// A final class must not have final methods.
/*
* A `final` class must not have `final` methods and `private`
* methods must not be `final`.
*
* Risky!
* Risky when child class overrides a `private` method.
*/
'no_unneeded_final_method' => true,

/*
Expand Down Expand Up @@ -1140,7 +1147,7 @@ $rules = [
* adjusts accordingly the function signature. Requires PHP >= 7.0.
*
* Risky!
* [1] This rule is EXPERIMENTAL and is not covered with backward
* This rule is EXPERIMENTAL and [1] is not covered with backward
* compatibility promise. [2] `@param` annotation is mandatory for
* the fixer to make changes, signatures of methods without it (no
* docblock, inheritdocs) will not be fixed. [3] Manual actions are
Expand All @@ -1153,7 +1160,7 @@ $rules = [
* adjusts accordingly the function signature. Requires PHP >= 7.0.
*
* Risky!
* [1] This rule is EXPERIMENTAL and is not covered with backward
* This rule is EXPERIMENTAL and [1] is not covered with backward
* compatibility promise. [2] `@return` annotation is mandatory for
* the fixer to make changes, signatures of methods without it (no
* docblock, inheritdocs) will not be fixed. [3] Manual actions are
Expand Down Expand Up @@ -1190,8 +1197,8 @@ $rules = [
'phpdoc_var_annotation_correct_order' => true,

/*
* `@var` and `@type` annotations should not contain the variable
* name.
* `@var` and `@type` annotations of classy properties should not
* contain the name.
*/
'phpdoc_var_without_name' => false,

Expand Down Expand Up @@ -1366,7 +1373,7 @@ $rules = [
* `static`.
*
* Risky!
* Risky when using "->bindTo" on lambdas without referencing to
* Risky when using `->bindTo` on lambdas without referencing to
* `$this`.
*/
'static_lambda' => true,
Expand Down Expand Up @@ -1464,12 +1471,14 @@ $rules = [

if (\PHP_SAPI === 'cli' && !class_exists(\PhpCsFixer\Config::class)) {
$binFixer = __DIR__ . '/vendor/bin/php-cs-fixer';

if (!is_file($binFixer)) {
$binFixer = 'php-cs-fixer';
}
$dryRun = !\in_array('--force', $_SERVER['argv'], true);
$dryRun = !in_array('--force', $_SERVER['argv'], true);

$command = escapeshellarg($binFixer) . ' fix --config ' . escapeshellarg(__FILE__) . ' --diff-format udiff --ansi -vv';

$command = escapeshellarg($binFixer) . ' fix --config ' . escapeshellarg(__FILE__) . ' --diff-format udiff --ansi';
if ($dryRun) {
$command .= ' --dry-run';
}
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2020 Ne-Lexa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 3 additions & 1 deletion src/IO/ZipReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ protected function readCentralDirectory(EndOfCentralDirectory $endCD)
fseek($this->inStream, $cdOffset);

if (!($cdStream = fopen('php://temp', 'w+b'))) {
throw new ZipException('Temp resource can not open from write');
// @codeCoverageIgnoreStart
throw new ZipException('A temporary resource cannot be opened for writing.');
// @codeCoverageIgnoreEnd
}
stream_copy_to_stream($this->inStream, $cdStream, $endCD->getCdSize());
rewind($cdStream);
Expand Down
6 changes: 4 additions & 2 deletions src/Model/Data/ZipNewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function __construct(ZipEntry $zipEntry, $data)
$zipEntry->setUncompressedSize(\strlen($data));

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

return $this->stream;
Expand Down
8 changes: 4 additions & 4 deletions src/Util/FilesUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function removeDir($dir)
$function = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
$function($fileInfo->getPathname());
}
rmdir($dir);
@rmdir($dir);
}

/**
Expand Down Expand Up @@ -198,10 +198,10 @@ public static function globFileSearch($globPattern, $flags = 0, $recursive = tru
return $files;
}

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

return $files;
Expand Down Expand Up @@ -273,7 +273,7 @@ public static function humanSize($size, $unit = null)
public static function normalizeZipPath($path)
{
return implode(
'/',
\DIRECTORY_SEPARATOR,
array_filter(
explode('/', (string) $path),
static function ($part) {
Expand Down
Loading

0 comments on commit 501b52f

Please sign in to comment.