Skip to content

Commit

Permalink
[PHPStan 1.0] Use Nette filesystem over phpstan filewriter (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 30, 2021
1 parent 6a894b4 commit e525dad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/Caching/ValueObject/Storage/FileCacheStorage.php
Expand Up @@ -5,8 +5,8 @@
namespace Rector\Caching\ValueObject\Storage;

use FilesystemIterator;
use Nette\Utils\FileSystem;
use Nette\Utils\Random;
use PHPStan\File\FileWriter;
use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface;
use Rector\Caching\ValueObject\CacheFilePaths;
use Rector\Caching\ValueObject\CacheItem;
Expand Down Expand Up @@ -70,7 +70,7 @@ public function save(string $key, string $variableKey, $data): void
}

// for performance reasons we don't use SmartFileSystem
FileWriter::write($tmpPath, \sprintf("<?php declare(strict_types = 1);\n\nreturn %s;", $exported));
FileSystem::write($tmpPath, \sprintf("<?php declare(strict_types = 1);\n\nreturn %s;", $exported));
$renameSuccess = @\rename($tmpPath, $path);
if ($renameSuccess) {
return;
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Expand Up @@ -522,3 +522,7 @@ parameters:
- '#Property Rector\\Transform\\Rector\\FuncCall\\ArgumentFuncCallToMethodCallRector\:\:\$arrayFunctionsToMethodCalls \(array<Rector\\Transform\\ValueObject\\ArrayFuncCallToMethodCall\>\) does not accept array<Rector\\Transform\\ValueObject\\ArgumentFuncCallToMethodCall\|Rector\\Transform\\ValueObject\\ArrayFuncCallToMethodCall\>#'
- '#Property Rector\\Transform\\Rector\\FuncCall\\ArgumentFuncCallToMethodCallRector\:\:\$argumentFuncCallToMethodCalls \(array<Rector\\Transform\\ValueObject\\ArgumentFuncCallToMethodCall\>\) does not accept array<Rector\\Transform\\ValueObject\\ArgumentFuncCallToMethodCall\|Rector\\Transform\\ValueObject\\ArrayFuncCallToMethodCall\>#'

# use lighter service for performance reasons
-
path: packages/Caching/ValueObject/Storage/FileCacheStorage.php
message: '#Instead of "Nette\\Utils\\FileSystem" class/interface use "Symplify\\SmartFileSystem\\SmartFileSystem"#'

0 comments on commit e525dad

Please sign in to comment.