mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-22 16:32:27 +02:00
remove safe
This commit is contained in:
parent
02e06703c0
commit
b8268f3897
@ -17,8 +17,7 @@
|
||||
"symfony/finder": "^3.4|^4.2",
|
||||
"symfony/process": "^3.4|^4.2",
|
||||
"symplify/better-phpdoc-parser": "^5.4",
|
||||
"symplify/package-builder": "^5.4",
|
||||
"thecodingmachine/safe": "^0.1.11"
|
||||
"symplify/package-builder": "^5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"ocramius/package-versions": "^1.3",
|
||||
@ -27,7 +26,6 @@
|
||||
"friendsofphp/php-cs-fixer": "^2.14",
|
||||
"symplify/monorepo-builder": "^5.4",
|
||||
"symplify/phpstan-extensions": "^5.4",
|
||||
"thecodingmachine/phpstan-safe-rule": "^0.1.1",
|
||||
"thecodingmachine/phpstan-strict-rules": "^0.11.0",
|
||||
"tracy/tracy": "^2.5"
|
||||
},
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Rector\ConsoleDiffer\Console\Formatter;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
|
||||
/**
|
||||
|
@ -8,9 +8,6 @@ use Rector\ContributorTools\Configuration\Configuration;
|
||||
use Rector\ContributorTools\Configuration\ConfigurationFactory;
|
||||
use Rector\ContributorTools\Exception\Command\ContributorCommandInterface;
|
||||
use Rector\ContributorTools\TemplateVariablesFactory;
|
||||
use function Safe\getcwd;
|
||||
use function Safe\sort;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
@ -13,8 +13,6 @@ use Rector\Error\ExceptionCorrector;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use ReflectionClass;
|
||||
use function Safe\ksort;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
@ -7,7 +7,6 @@ use Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use Rector\ContributorTools\Exception\ConfigurationException;
|
||||
use Rector\Exception\FileSystem\FileNotFoundException;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
@ -9,7 +9,6 @@ use PhpParser\Node\Expr\ClassConstFetch;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use Rector\ContributorTools\Configuration\Configuration;
|
||||
use Rector\PhpParser\Printer\BetterStandardPrinter;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class TemplateVariablesFactory
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class AliasToClassRector extends AbstractRector
|
||||
{
|
||||
|
@ -15,7 +15,6 @@ use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockAnalyzer;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,6 @@ use PHPStan\Analyser\ScopeFactory;
|
||||
use PHPStan\Analyser\TypeSpecifier;
|
||||
use PHPStan\Broker\Broker;
|
||||
use PHPStan\DependencyInjection\ContainerFactory;
|
||||
use function Safe\getcwd;
|
||||
|
||||
final class PHPStanServicesFactory
|
||||
{
|
||||
|
@ -9,7 +9,6 @@ use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\NullableType;
|
||||
use Rector\Php\PhpTypeSupport;
|
||||
use Rector\Php\TypeAnalyzer;
|
||||
use function Safe\sort;
|
||||
use Traversable;
|
||||
|
||||
abstract class AbstractTypeInfo
|
||||
|
@ -16,7 +16,6 @@ use Rector\NodeTypeResolver\Exception\MissingTagException;
|
||||
use Rector\NodeTypeResolver\Php\ParamTypeInfo;
|
||||
use Rector\NodeTypeResolver\Php\ReturnTypeInfo;
|
||||
use Rector\NodeTypeResolver\Php\VarTypeInfo;
|
||||
use function Safe\sprintf;
|
||||
use Symplify\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Symplify\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Symplify\BetterPhpDocParser\PhpDocParser\TypeNodeToStringsConverter;
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Php\TypeAnalyzer;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class NamespaceAnalyzer
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ use PhpParser\Comment\Doc;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockAnalyzer;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class DocBlockAnalyzerTest extends AbstractContainerAwareTestCase
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
/**
|
||||
* @see https://wiki.php.net/rfc/deprecate-bareword-strings
|
||||
|
@ -11,7 +11,6 @@ use Rector\Exception\Rector\InvalidRectorConfigurationException;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class PreferThisOrSelfMethodCallRector extends AbstractRector
|
||||
{
|
||||
|
@ -9,7 +9,6 @@ use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
/**
|
||||
* @see https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
|
||||
|
@ -7,7 +7,6 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\PhpParser\Node\Resolver\NameResolver;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class TemplateGuesser
|
||||
{
|
||||
|
@ -6,9 +6,6 @@ use Rector\Bridge\Contract\AnalyzedApplicationContainerInterface;
|
||||
use Rector\Configuration\Option;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\Symfony\Bridge\DependencyInjection\ContainerFactory;
|
||||
use function Safe\class_implements;
|
||||
use function Safe\class_parents;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symplify\PackageBuilder\Parameter\ParameterProvider;
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\Symfony\Bridge;
|
||||
|
||||
use Rector\Configuration\Option;
|
||||
use Rector\Exception\Configuration\InvalidConfigurationException;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
final class SymfonyKernelParameterGuard
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\Symfony\Tests\Rector\FrameworkBundle\GetToConstructorInjectionR
|
||||
|
||||
use Rector\Exception\Configuration\InvalidConfigurationException;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class SecondInvalidConfigurationConstructorInjectionRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ namespace Rector\Symfony\Tests\Rector\FrameworkBundle\GetToConstructorInjectionR
|
||||
use Rector\Exception\Configuration\InvalidConfigurationException;
|
||||
use Rector\Symfony\Tests\FrameworkBundle\AbstractToConstructorInjectionRectorSource\SomeNonKernelClass;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
final class ThirdInvalidConfigurationConstructorInjectionRectorTest extends AbstractRectorTestCase
|
||||
|
10
phpstan.neon
10
phpstan.neon
@ -2,7 +2,6 @@ includes:
|
||||
- 'utils/phpstan/config/phpstan-extensions.neon'
|
||||
- 'vendor/symplify/phpstan-extensions/config/config.neon'
|
||||
- 'vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon'
|
||||
- 'vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon'
|
||||
|
||||
parameters:
|
||||
# to allow intalling with various phsptan versions without reporting old errors here
|
||||
@ -100,3 +99,12 @@ parameters:
|
||||
# known values
|
||||
- '#Parameter \#(1|2) \$(left|right) of class PhpParser\\Node\\Expr\\BinaryOp\\Coalesce constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
|
||||
- '#Strict comparison using === between PhpParser\\Node\\Expr and null will always evaluate to false#'
|
||||
|
||||
# temp
|
||||
- '#Parameter \#1 \$currentWorkingDirectory of class PHPStan\\DependencyInjection\\ContainerFactory constructor expects string, string\|false given#'
|
||||
|
||||
# known values
|
||||
- '#Parameter \#1 \$code of method PhpParser\\Parser\:\:parse\(\) expects string, string\|false given#'
|
||||
|
||||
# console argument/option
|
||||
- '#Cannot cast array<string\>\|string\|null to string#'
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\Bridge\Doctrine;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Bridge\Contract\DoctrineEntityAndRepositoryMapperInterface;
|
||||
use function Safe\substr;
|
||||
|
||||
final class DefaultDoctrineEntityAndRepositoryMapper implements DoctrineEntityAndRepositoryMapperInterface
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Rector\CodingStyle;
|
||||
|
||||
use Rector\Exception\Configuration\InvalidConfigurationException;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
|
@ -5,7 +5,6 @@ namespace Rector\Collector;
|
||||
use Closure;
|
||||
use Rector\Exception\DependencyInjection\CallableCollectorException;
|
||||
use ReflectionFunction;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class CallableCollectorPopulator
|
||||
{
|
||||
|
@ -5,8 +5,6 @@ namespace Rector\Console;
|
||||
use Jean85\PrettyVersions;
|
||||
use Rector\ContributorTools\Command\GenerateDocsCommand;
|
||||
use Rector\ContributorTools\Exception\Command\ContributorCommandInterface;
|
||||
use function Safe\getcwd;
|
||||
use function Safe\realpath;
|
||||
use Symfony\Component\Console\Application as SymfonyApplication;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
|
@ -4,8 +4,6 @@ namespace Rector\Console\Command;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Console\Shell;
|
||||
use function Safe\sort;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -72,7 +70,7 @@ final class LevelsCommand extends AbstractCommand
|
||||
*/
|
||||
private function filterLevelsByName(InputInterface $input, array $levels): array
|
||||
{
|
||||
$name = $input->getArgument('name');
|
||||
$name = (string) $input->getArgument('name');
|
||||
|
||||
return array_filter($levels, function (string $level) use ($name): bool {
|
||||
return (bool) Strings::match($level, sprintf('#%s#', $name));
|
||||
|
@ -6,8 +6,6 @@ use Rector\Application\Error;
|
||||
use Rector\Application\RemovedFilesCollector;
|
||||
use Rector\Configuration\Configuration;
|
||||
use Rector\Reporting\FileDiff;
|
||||
use function Safe\ksort;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
final class ProcessCommandReporter
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Rector\DependencyInjection;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use function Safe\putenv;
|
||||
|
||||
final class ContainerFactory
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\DependencyInjection\Loader;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Exception\DependencyInjection\ClassNotFoundException;
|
||||
use function Safe\sprintf;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
|
||||
final class ClassExistenceValidator
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\Error;
|
||||
|
||||
use PHPStan\AnalysedCodeException;
|
||||
use Rector\Contract\Rector\RectorInterface;
|
||||
use function Safe\sprintf;
|
||||
use Throwable;
|
||||
|
||||
final class ExceptionCorrector
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Rector\Exception\Application;
|
||||
|
||||
use Exception;
|
||||
use function Safe\sprintf;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
use Throwable;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace Rector\FileSystem;
|
||||
|
||||
use Rector\Exception\FileSystem\FileNotFoundException;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class FileGuard
|
||||
{
|
||||
|
@ -4,8 +4,6 @@ namespace Rector\FileSystem;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Exception\FileSystem\DirectoryNotFoundException;
|
||||
use function Safe\glob;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class FilesystemTweaker
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\Guard;
|
||||
|
||||
use Rector\Exception\NoRectorsLoadedException;
|
||||
use Rector\PhpParser\NodeTraverser\RectorNodeTraverser;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class RectorGuard
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ use Rector\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
use Rector\PhpParser\Node\Resolver\NameResolver;
|
||||
use Rector\PhpParser\Node\VariableInfo;
|
||||
use function Safe\class_implements;
|
||||
|
||||
final class ClassMaintainer
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\PhpParser\Printer\BetterStandardPrinter;
|
||||
use function Safe\class_implements;
|
||||
|
||||
final class ClassMethodMaintainer
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Exception\NodeChanger\NodeMissingIdentifierException;
|
||||
use Rector\PhpParser\Node\Resolver\NameResolver;
|
||||
use function Safe\sprintf;
|
||||
|
||||
/**
|
||||
* This class renames node identifier, e.g. ClassMethod rename:
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node\Stmt\ClassConst;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Exception\InvalidNodeTypeException;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class VisibilityMaintainer
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Exception\NotImplementedException;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Php\TypeAnalyzer;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class NodeFactory
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\PrettyPrinter\Standard;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class BetterStandardPrinter extends Standard
|
||||
{
|
||||
|
@ -13,7 +13,6 @@ use Rector\Application\RemovedFilesCollector;
|
||||
use Rector\Contract\Rector\PhpRectorInterface;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
|
||||
|
@ -16,7 +16,6 @@ use Rector\PhpParser\Node\VariableInfo;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class MoveRepositoryFromParentToConstructorRector extends AbstractRector
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\CodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class ServiceLocatorToDIRector extends AbstractRector
|
||||
{
|
||||
|
@ -13,8 +13,6 @@ use Rector\NodeTypeResolver\Node\Attribute;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
use function Safe\krsort;
|
||||
use function Safe\substr;
|
||||
|
||||
final class NamespaceReplacerRector extends AbstractRector
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ namespace Rector\RectorDefinition;
|
||||
|
||||
use Rector\Contract\RectorDefinition\CodeSampleInterface;
|
||||
use Rector\Exception\RectorDefinition\CodeSamplesMissingException;
|
||||
use function Safe\sprintf;
|
||||
|
||||
final class RectorDefinition
|
||||
{
|
||||
|
@ -11,8 +11,6 @@ use Rector\Application\FileProcessor;
|
||||
use Rector\Configuration\Option;
|
||||
use Rector\DependencyInjection\ContainerFactory;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use function Safe\md5_file;
|
||||
use function Safe\sprintf;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
use Symplify\PackageBuilder\Parameter\ParameterProvider;
|
||||
|
@ -5,7 +5,6 @@ namespace Rector\Tests\FileSystem\FilesFinder;
|
||||
use Iterator;
|
||||
use Rector\FileSystem\FilesFinder;
|
||||
use Rector\Tests\AbstractContainerAwareTestCase;
|
||||
use function Safe\sort;
|
||||
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
|
||||
|
||||
final class FilesFinderTest extends AbstractContainerAwareTestCase
|
||||
|
@ -13,7 +13,6 @@ use PhpParser\ParserFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Rector\NodeTypeResolver\NodeVisitor\ParentAndNextNodeVisitor;
|
||||
use Rector\PhpParser\Node\BetterNodeFinder;
|
||||
use function Safe\file_get_contents;
|
||||
|
||||
final class BetterNodeFinderTest extends TestCase
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user