Skip to content

Commit

Permalink
Merge pull request #489 from samsonasik/update-rector-01213
Browse files Browse the repository at this point in the history
[Rector] Update to rector 0.12.15, apply parallel, and RemoveUnusedPrivatePropertyRector
  • Loading branch information
butschster authored Jan 26, 2022
2 parents 2724356 + b78e5c4 commit 857948b
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 35 deletions.
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^8.5|^9.0",
"ramsey/uuid": "^4.2",
"rector/rector": "0.12.3",
"rector/rector": "0.12.15",
"spiral/broadcast": "^2.0",
"spiral/broadcast-ws": "^1.0",
"spiral/code-style": "^1.0",
Expand Down Expand Up @@ -272,7 +272,11 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"spiral/composer-publish-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
5 changes: 1 addition & 4 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Spiral\Boot\Bootloader\ConfigurationBootloader;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -18,15 +17,13 @@
__DIR__ . '/src/*/src',
]);

$parameters->set(Option::PARALLEL, true);
$parameters->set(Option::SKIP, [
CountOnNullRector::class,

// for PHP 8
RemoveUnusedPromotedPropertyRector::class,

// buggy when remove private property, but filled by construct in the middle of parameter
RemoveUnusedPrivatePropertyRector::class,

RemoveUnusedPrivateMethodRector::class => [
__DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php',
],
Expand Down
2 changes: 1 addition & 1 deletion src/Attributes/src/Internal/DoctrineAnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private function wrapDoctrineExceptions(\Closure $then): iterable
$class = AttributeException::class;
}

throw new $class($e->getMessage(), (int)$e->getCode(), $e);
throw new $class($e->getMessage(), $e->getCode(), $e);
}
}

Expand Down
4 changes: 0 additions & 4 deletions src/Console/src/Sequence/CallableSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ final class CallableSequence extends AbstractSequence
/** @var string */
private $function;

/** @var array */
private $parameters = [];

/**
* @param callable $function
*/
Expand All @@ -36,7 +33,6 @@ public function __construct(
string $footer = ''
) {
$this->function = $function;
$this->parameters = $parameters;

parent::__construct($header, $footer);
}
Expand Down
3 changes: 0 additions & 3 deletions src/Reactor/src/Traits/NamedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ trait NamedTrait

/**
* Attention, element name will be automatically classified.
*
*
* @return $this|self
*/
public function setName(string $name): self
{
Expand Down
4 changes: 0 additions & 4 deletions src/Stempler/src/Transform/Merge/Inject/InjectBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ final class InjectBlocks implements VisitorInterface
/** @var BlockClaims */
private $blocks;

/** @var BlockFetcher */
private $fetcher;

public function __construct(BlockClaims $blocks)
{
$this->blocks = $blocks;
$this->fetcher = new BlockFetcher();
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/Stempler/src/Transform/Merge/Inject/InjectPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ final class InjectPHP implements VisitorInterface
/** @var BlockClaims */
private $blocks;

/** @var BlockFetcher */
private $fetcher;

public function __construct(BlockClaims $blocks)
{
$this->blocks = $blocks;
$this->fetcher = new BlockFetcher();
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Storage/src/Bucket/ReadableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function exists(string $pathname): bool
try {
return $fs->fileExists($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -46,7 +46,7 @@ public function getContents(string $pathname): string
try {
return $fs->read($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -60,7 +60,7 @@ public function getStream(string $pathname)
try {
return $fs->readStream($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -74,7 +74,7 @@ public function getLastModified(string $pathname): int
try {
return $fs->lastModified($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -88,7 +88,7 @@ public function getSize(string $pathname): int
try {
return $fs->fileSize($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -102,7 +102,7 @@ public function getMimeType(string $pathname): string
try {
return $fs->mimeType($pathname);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -119,7 +119,7 @@ public function getVisibility(string $pathname): string
$fs->visibility($pathname)
);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Storage/src/Bucket/WritableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function write(string $pathname, $content, array $config = []): FileInter
throw new \InvalidArgumentException(\sprintf($message, \get_debug_type($content)));
}
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}

return $this->file($pathname);
Expand All @@ -80,7 +80,7 @@ public function setVisibility(
try {
$fs->setVisibility($pathname, $this->toFlysystemVisibility($visibility));
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}

return $this->file($pathname);
Expand All @@ -101,7 +101,7 @@ public function copy(
try {
$fs->copy($source, $destination, $config);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}

return $this->file($destination);
Expand All @@ -125,7 +125,7 @@ public function move(
try {
$fs->move($source, $destination, $config);
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}

return $this->file($destination);
Expand All @@ -152,7 +152,7 @@ public function delete(string $pathname, bool $clean = false): void
$this->deleteEmptyDirectories($this->getParentDirectory($pathname));
}
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}
abstract protected function getOperator(): FilesystemOperator;
Expand Down Expand Up @@ -220,7 +220,7 @@ private function deleteEmptyDirectories(string $directory): void
$this->deleteEmptyDirectories($this->getParentDirectory($directory));
}
} catch (FilesystemException $e) {
throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
}
}

Expand Down

0 comments on commit 857948b

Please sign in to comment.