Skip to content

Commit

Permalink
[Rector] Update to rector 0.12.13, apply parallel, and RemoveUnusedPr…
Browse files Browse the repository at this point in the history
…ivatePropertyRector
  • Loading branch information
samsonasik committed Jan 22, 2022
1 parent 96e97d9 commit 353583d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 30 deletions.
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^8.5|^9.0",
"ramsey/uuid": "^3.9",
"rector/rector": "0.12.3",
"rector/rector": "0.12.13",
"spiral/broadcast": "^2.0",
"spiral/broadcast-ws": "^1.0",
"spiral/code-style": "^1.0",
Expand Down Expand Up @@ -271,7 +271,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
8 changes: 5 additions & 3 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,14 +17,17 @@
__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,
RemoveUnusedPrivatePropertyRector::class => [
// buggy when used in middle of parameter along with RemoveUnusedConstructorParamRector that may cause BC break
__DIR__ . '/src/Console/src/Sequence/CallableSequence.php',
],

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
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 353583d

Please sign in to comment.