diff --git a/composer.json b/composer.json index 1d6b7beb6..679fbc960 100644 --- a/composer.json +++ b/composer.json @@ -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", @@ -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 diff --git a/rector.php b/rector.php index dc5be0245..eb9375b68 100644 --- a/rector.php +++ b/rector.php @@ -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 { @@ -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', ], diff --git a/src/Attributes/src/Internal/DoctrineAnnotationReader.php b/src/Attributes/src/Internal/DoctrineAnnotationReader.php index b82aacdce..0f4e6fe10 100644 --- a/src/Attributes/src/Internal/DoctrineAnnotationReader.php +++ b/src/Attributes/src/Internal/DoctrineAnnotationReader.php @@ -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); } } diff --git a/src/Console/src/Sequence/CallableSequence.php b/src/Console/src/Sequence/CallableSequence.php index fb0d41348..2831edefd 100644 --- a/src/Console/src/Sequence/CallableSequence.php +++ b/src/Console/src/Sequence/CallableSequence.php @@ -23,9 +23,6 @@ final class CallableSequence extends AbstractSequence /** @var string */ private $function; - /** @var array */ - private $parameters = []; - /** * @param callable $function */ @@ -36,7 +33,6 @@ public function __construct( string $footer = '' ) { $this->function = $function; - $this->parameters = $parameters; parent::__construct($header, $footer); } diff --git a/src/Reactor/src/Traits/NamedTrait.php b/src/Reactor/src/Traits/NamedTrait.php index d8c2d1d6f..a82979328 100644 --- a/src/Reactor/src/Traits/NamedTrait.php +++ b/src/Reactor/src/Traits/NamedTrait.php @@ -23,9 +23,6 @@ trait NamedTrait /** * Attention, element name will be automatically classified. - * - * - * @return $this|self */ public function setName(string $name): self { diff --git a/src/Stempler/src/Transform/Merge/Inject/InjectBlocks.php b/src/Stempler/src/Transform/Merge/Inject/InjectBlocks.php index 3bbbc7fad..2cee1a2cb 100644 --- a/src/Stempler/src/Transform/Merge/Inject/InjectBlocks.php +++ b/src/Stempler/src/Transform/Merge/Inject/InjectBlocks.php @@ -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(); } /** diff --git a/src/Stempler/src/Transform/Merge/Inject/InjectPHP.php b/src/Stempler/src/Transform/Merge/Inject/InjectPHP.php index 14047da42..2b5ea042f 100644 --- a/src/Stempler/src/Transform/Merge/Inject/InjectPHP.php +++ b/src/Stempler/src/Transform/Merge/Inject/InjectPHP.php @@ -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(); } /** diff --git a/src/Storage/src/Bucket/ReadableTrait.php b/src/Storage/src/Bucket/ReadableTrait.php index 619929c39..5aa3889dc 100644 --- a/src/Storage/src/Bucket/ReadableTrait.php +++ b/src/Storage/src/Bucket/ReadableTrait.php @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } @@ -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); } } diff --git a/src/Storage/src/Bucket/WritableTrait.php b/src/Storage/src/Bucket/WritableTrait.php index ee29b7c6c..cb4190434 100644 --- a/src/Storage/src/Bucket/WritableTrait.php +++ b/src/Storage/src/Bucket/WritableTrait.php @@ -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); @@ -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); @@ -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); @@ -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); @@ -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; @@ -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); } }