Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Safe package #1409

Merged
merged 7 commits into from Feb 2, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -33,7 +33,6 @@
"symfony/process": "^3.4|^4.1",
"symfony/routing": "^3.4|^4.1",
"symfony/yaml": "^3.4|^4.1",
"thecodingmachine/safe": "^0.1.13",
"twig/twig": "^2.5"
},
"require-dev": {
@@ -46,7 +45,6 @@
"symfony/templating": "^3.4|^4.1",
"symfony/translation": "^3.4|^4.1",
"symfony/twig-bundle": "^3.4|^4.1",
"thecodingmachine/phpstan-safe-rule": "^0.1.1",
"thecodingmachine/phpstan-strict-rules": "^0.11.0",
"tracy/tracy": "^2.5"
},
@@ -5,7 +5,6 @@ parameters:
phpstan/phpstan: '^0.11'
phpunit/phpunit: '^7.5'
tracy/tracy: '^2.5'
thecodingmachine/phpstan-safe-rule: '^0.1.1'
thecodingmachine/phpstan-strict-rules: '^0.11.0'

# remove these to merge of packages' composer.json
@@ -12,8 +12,7 @@
"symfony/dependency-injection": "^3.4|^4.1",
"symfony/finder": "^3.4|^4.1",
"symfony/routing": "^3.4|^4.1",
"symplify/package-builder": "^5.5",
"thecodingmachine/safe": "^0.1.13"
"symplify/package-builder": "^5.5"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.9",
@@ -18,7 +18,6 @@
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireSinglyImplementedCompilerPass;
use Symplify\PackageBuilder\FileSystem\FinderSanitizer;
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
use function Safe\sprintf;
final class ConvertYamlCommand extends Command
{
@@ -3,7 +3,6 @@
namespace Symplify\Autodiscovery\DependencyInjection;
use Psr\Container\ContainerInterface;
use function Safe\putenv;
final class ContainerFactory
{
@@ -0,0 +1,9 @@
<?php declare(strict_types=1);
namespace Symplify\Autodiscovery\Exception;
use Exception;
final class ClassLocationNotFoundException extends Exception
{
}
@@ -5,7 +5,6 @@
use Nette\Utils\FileSystem;
use Nette\Utils\Strings;
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
use function Safe\glob;
final class NamespaceDetector
{
@@ -2,8 +2,6 @@
namespace Symplify\Autodiscovery\Php;
use function Safe\class_implements;
final class InterfaceAnalyzer
{
public function isInterfaceOnlyImplementation(string $interface, string $class): bool
@@ -6,11 +6,10 @@
use ReflectionClass;
use Symfony\Component\Filesystem\Filesystem;
use Symplify\Autodiscovery\Arrays;
use Symplify\Autodiscovery\Exception\ClassLocationNotFoundException;
use Symplify\Autodiscovery\Exception\ClassNotFoundException;
use Symplify\Autodiscovery\Php\InterfaceAnalyzer;
use function Safe\realpath;
use function Safe\sort;
use function Safe\sprintf;
use Symplify\PackageBuilder\FileSystem\SmartFileInfo;
final class ExplicitToAutodiscoveryConverter
{
@@ -399,7 +398,12 @@ private function getRelativeClassLocation(string $class, string $configFilePath)
$classDirectory = dirname($fileName);
}
$configDirectory = realpath(dirname($configFilePath));
if ($classDirectory === false) {
throw new ClassLocationNotFoundException(sprintf('Location for "%s" class was not found.', $class));
}
$fileInfo = new SmartFileInfo($configFilePath);
$configDirectory = dirname($fileInfo->getRealPath());
$relativePath = $this->filesystem->makePathRelative($classDirectory, $configDirectory);
@@ -6,7 +6,6 @@
use Symplify\Autodiscovery\Tests\AbstractAppKernelAwareTestCase;
use Twig\Loader\FilesystemLoader as TwigFilesystemLoader;
use Twig_Environment;
use function Safe\realpath;
/**
* @covers \Symplify\Autodiscovery\Twig\TwigPathAutodiscoverer
@@ -6,8 +6,7 @@
"php": "^7.1",
"nette/utils": "^2.5",
"phpstan/phpdoc-parser": "^0.3",
"symplify/package-builder": "^5.5",
"thecodingmachine/safe": "^0.1.13"
"symplify/package-builder": "^5.5"
},
"require-dev": {
"phpunit/phpunit": "^7.5"
@@ -5,7 +5,6 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
use function Safe\putenv;
final class ContainerFactory
{
@@ -11,7 +11,6 @@
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
use Symplify\BetterPhpDocParser\Exception\NotImplementedYetException;
use function Safe\sprintf;
/**
* @inspiration https://github.com/rectorphp/rector/blob/6006a75c8f3bec3aa976f48c7394d4a4b3a0e2ac/src/PhpParser/Node/Resolver/NameResolver.php#L21
@@ -6,7 +6,6 @@
use Nette\Utils\Strings;
use PHPStan\PhpDocParser\Lexer\Lexer;
use Symplify\BetterPhpDocParser\PhpDocNodeInfo;
use function Safe\substr;
final class OriginalSpacingRestorer
{
@@ -35,7 +34,7 @@ public function restoreInOutputWithTokensAndPhpDocNodeInfo(
}
// remove first space, added by the printer above
return substr($newNodeOutput, 1);
return Strings::substring($newNodeOutput, 1);
}
/**
@@ -12,8 +12,7 @@
"symfony/console": "^3.4|^4.1",
"symfony/http-kernel": "^3.4|^4.1",
"symfony/process": "^3.4|^4.1",
"symplify/package-builder": "^5.5",
"thecodingmachine/safe": "^0.1.13"
"symplify/package-builder": "^5.5"
},
"require-dev": {
"phpunit/phpunit": "^7.5"
@@ -6,7 +6,6 @@
use Symplify\ChangelogLinker\ChangeTree\Resolver\CategoryResolver;
use Symplify\ChangelogLinker\ChangeTree\Resolver\PackageResolver;
use Symplify\ChangelogLinker\Git\GitCommitDateTagResolver;
use function Safe\sprintf;
final class ChangeFactory
{
@@ -2,8 +2,6 @@
namespace Symplify\ChangelogLinker\ChangeTree;
use function Safe\usort;
final class ChangeSorter
{
/**
@@ -4,7 +4,6 @@
use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Analyzer\LinksAnalyzer;
use function Safe\sprintf;
final class ChangelogCleaner
{
@@ -5,7 +5,6 @@
use Symplify\ChangelogLinker\Analyzer\LinksAnalyzer;
use Symplify\ChangelogLinker\Analyzer\VersionsAnalyzer;
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use function Safe\usort;
final class ChangelogLinker
{
@@ -12,7 +12,6 @@
use Symplify\ChangelogLinker\Configuration\Option;
use Symplify\PackageBuilder\Console\HelpfulApplicationTrait;
use Symplify\PackageBuilder\Parameter\ParameterProvider;
use function Safe\getcwd;
final class ChangelogConsoleApplication extends Application
{
@@ -18,7 +18,6 @@
use Symplify\ChangelogLinker\Github\GithubApi;
use Symplify\PackageBuilder\Console\Command\CommandNaming;
use Symplify\PackageBuilder\Console\ShellCode;
use function Safe\sprintf;
/**
* @inspired by https://github.com/weierophinney/changelog_generator
@@ -2,11 +2,11 @@
namespace Symplify\ChangelogLinker\DependencyInjection\CompilerPass;
use Nette\Utils\Strings;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Process\Process;
use Symplify\ChangelogLinker\Github\GithubRepositoryFromRemoteResolver;
use function Safe\substr;
final class DetectParametersCompilerPass implements CompilerPassInterface
{
@@ -56,6 +56,6 @@ private function detectRepositoryName(ContainerBuilder $containerBuilder): ?stri
{
$repositoryUrl = $containerBuilder->getParameter(self::OPTION_REPOSITORY_URL);
return substr($repositoryUrl, strlen('https://github.com/'));
return Strings::substring($repositoryUrl, Strings::length('https://github.com/'));
}
}
@@ -3,7 +3,6 @@
namespace Symplify\ChangelogLinker\DependencyInjection;
use Psr\Container\ContainerInterface;
use function Safe\putenv;
final class ContainerFactory
{
@@ -7,8 +7,6 @@
use Symplify\ChangelogLinker\Configuration\Option;
use Symplify\ChangelogLinker\LinkAppender;
use Symplify\PackageBuilder\Parameter\ParameterProvider;
use function Safe\getcwd;
use function Safe\sprintf;
final class ChangelogFileSystem
{
@@ -5,7 +5,6 @@
use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Exception\FileNotFoundException;
use Symplify\ChangelogLinker\Exception\MissingPlaceholderInChangelogException;
use function Safe\sprintf;
final class ChangelogFileSystemGuard
{
@@ -11,7 +11,6 @@
use Symplify\ChangelogLinker\Exception\Github\GithubApiException;
use Symplify\ChangelogLinker\Guzzle\ResponseFormatter;
use Throwable;
use function Safe\sprintf;
final class GithubApi
{
@@ -4,8 +4,6 @@
use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Exception\Git\InvalidGitRemoteException;
use function Safe\sprintf;
use function Safe\substr;
final class GithubRepositoryFromRemoteResolver
{
@@ -19,7 +17,7 @@ public function resolveFromUrl(string $url): string
if (Strings::startsWith($url, 'git@')) {
$url = rtrim($url, '.git');
$url = str_replace(':', '/', $url);
$url = substr($url, strlen('git@'));
$url = Strings::substring($url, Strings::length('git@'));
return 'https://' . $url;
}
@@ -3,7 +3,6 @@
namespace Symplify\ChangelogLinker;
use Symplify\ChangelogLinker\Analyzer\LinksAnalyzer;
use function Safe\krsort;
final class LinkAppender
{
@@ -5,7 +5,6 @@
use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use Symplify\ChangelogLinker\Regex\RegexPattern;
use function Safe\sprintf;
/**
* Comletes [] around commit, pull-request, issues and version references
@@ -6,7 +6,6 @@
use Symplify\ChangelogLinker\Analyzer\VersionsAnalyzer;
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use Symplify\ChangelogLinker\LinkAppender;
use function Safe\sprintf;
final class DiffLinksToVersionsWorker implements WorkerInterface
{
@@ -5,7 +5,6 @@
use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use Symplify\ChangelogLinker\LinkAppender;
use function Safe\sprintf;
final class LinkifyWorker implements WorkerInterface
{
@@ -6,7 +6,6 @@
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use Symplify\ChangelogLinker\LinkAppender;
use Symplify\ChangelogLinker\Regex\RegexPattern;
use function Safe\sprintf;
final class LinksToReferencesWorker implements WorkerInterface
{
@@ -6,7 +6,6 @@
use Symplify\ChangelogLinker\Contract\Worker\WorkerInterface;
use Symplify\ChangelogLinker\LinkAppender;
use Symplify\ChangelogLinker\Regex\RegexPattern;
use function Safe\sprintf;
/**
* Completes link to @user mentions
@@ -9,8 +9,7 @@
"squizlabs/php_codesniffer": "^3.4",
"friendsofphp/php-cs-fixer": "^2.14",
"symplify/token-runner": "^5.5",
"slam/php-cs-fixer-extensions": "^1.17",
"thecodingmachine/safe": "^0.1.13"
"slam/php-cs-fixer-extensions": "^1.17"
},
"require-dev": {
"nette/application": "^2.4",
@@ -13,7 +13,6 @@
use SplFileInfo;
use Symplify\CodingStandard\Fixer\AbstractSymplifyFixer;
use Symplify\TokenRunner\Wrapper\FixerWrapper\ClassWrapperFactory;
use function Safe\sprintf;
/**
* possible future-successor https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3810
@@ -9,7 +9,6 @@
use Symplify\CodingStandard\Fixer\AbstractSymplifyFixer;
use Symplify\TokenRunner\Transformer\FixerTransformer\ClassElementSorter;
use Symplify\TokenRunner\Wrapper\FixerWrapper\ClassWrapperFactory;
use function Safe\usort;
final class PrivateMethodOrderByUseFixer extends AbstractSymplifyFixer
{
@@ -14,7 +14,6 @@
use Symplify\TokenRunner\Transformer\FixerTransformer\ClassElementSorter;
use Symplify\TokenRunner\Wrapper\FixerWrapper\ClassWrapperFactory;
use Symplify\TokenRunner\Wrapper\FixerWrapper\DocBlockWrapperFactory;
use function Safe\usort;
/**
* Inspiration @see \PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer
@@ -13,7 +13,6 @@
use SplFileInfo;
use Symplify\CodingStandard\Fixer\AbstractSymplifyFixer;
use Symplify\PackageBuilder\Types\ClassLikeExistenceChecker;
use function Safe\substr;
final class ClassStringToClassConstantFixer extends AbstractSymplifyFixer implements ConfigurableFixerInterface
{
@@ -91,7 +90,7 @@ public function configure(?array $configuration = null): void
private function getNameFromToken(Token $token): string
{
// remove quotes "" around the string
$name = substr($token->getContent(), 1, -1);
$name = Strings::substring($token->getContent(), 1, -1);
// remove "\" prefix
return ltrim($name, '\\');
@@ -19,7 +19,6 @@
use Throwable;
use UnderflowException;
use UnexpectedValueException;
use function Safe\sprintf;
final class ExplicitExceptionSniff implements Sniff
{
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.