Skip to content

Commit

Permalink
release PHP 7.2 downgraded
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 25, 2023
1 parent b350c93 commit 139938d
Show file tree
Hide file tree
Showing 2,001 changed files with 208,918 additions and 5,792 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/vendor
# we need the vendor
composer.lock

/.phpunit.cache
.phpunit.result.cache


# to keep local rector outside git repository
Expand Down
3 changes: 2 additions & 1 deletion bin/ecs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env php
<?php
<?php
namespace ECSPrefix202307;

require __DIR__ . '/ecs.php';
93 changes: 33 additions & 60 deletions bin/ecs.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
<?php

declare(strict_types=1);
declare (strict_types=1);
namespace ECSPrefix202307;

// decoupled in own "*.php" file, so ECS, Rector and PHPStan works out of the box here

use PHP_CodeSniffer\Util\Tokens;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArgvInput;
use ECSPrefix202307\Symfony\Component\Console\Command\Command;
use ECSPrefix202307\Symfony\Component\Console\Input\ArgvInput;
use Symplify\EasyCodingStandard\Console\EasyCodingStandardConsoleApplication;
use Symplify\EasyCodingStandard\Console\Style\SymfonyStyleFactory;
use Symplify\EasyCodingStandard\DependencyInjection\EasyCodingStandardContainerFactory;

// performance boost
gc_disable();

define('__ECS_RUNNING__', true);

\gc_disable();
\define('__ECS_RUNNING__', \true);
# 1. autoload
$autoloadIncluder = new AutoloadIncluder();

if (file_exists(__DIR__ . '/../preload.php')) {
if (\file_exists(__DIR__ . '/../preload.php')) {
require_once __DIR__ . '/../preload.php';
}

$autoloadIncluder->includeCwdVendorAutoloadIfExists();
$autoloadIncluder->loadIfNotLoadedYet(__DIR__ . '/../vendor/scoper-autoload.php');
$autoloadIncluder->autoloadProjectAutoloaderFile('/../../autoload.php');
$autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();
$autoloadIncluder->includePhpCodeSnifferAutoload();

/**
* Inspired by https://github.com/rectorphp/rector/pull/2373/files#diff-0fc04a2bb7928cac4ae339d5a8bf67f3
*/
Expand All @@ -45,112 +39,91 @@ final class AutoloadIncluder
// monorepo
__DIR__ . '/../../../vendor',
];

/**
* @var string[]
*/
private array $alreadyLoadedAutoloadFiles = [];

public function includeCwdVendorAutoloadIfExists(): void
private $alreadyLoadedAutoloadFiles = [];
public function includeCwdVendorAutoloadIfExists() : void
{
$cwdVendorAutoload = getcwd() . '/vendor/autoload.php';
if (! is_file($cwdVendorAutoload)) {
$cwdVendorAutoload = \getcwd() . '/vendor/autoload.php';
if (!\is_file($cwdVendorAutoload)) {
return;
}
$this->loadIfNotLoadedYet($cwdVendorAutoload);
}

public function includeDependencyOrRepositoryVendorAutoloadIfExists(): void
public function includeDependencyOrRepositoryVendorAutoloadIfExists() : void
{
// ECS' vendor is already loaded
if (class_exists('Symplify\EasyCodingStandard\DependencyInjection\NewContainerFactory')) {
if (\class_exists('Symplify\\EasyCodingStandard\\DependencyInjection\\NewContainerFactory')) {
return;
}

$devVendorAutoload = __DIR__ . '/../vendor/autoload.php';
if (! is_file($devVendorAutoload)) {
if (!\is_file($devVendorAutoload)) {
return;
}

$this->loadIfNotLoadedYet($devVendorAutoload);
}

public function autoloadProjectAutoloaderFile(string $file): void
public function autoloadProjectAutoloaderFile(string $file) : void
{
$path = dirname(__DIR__) . $file;
if (! is_file($path)) {
$path = \dirname(__DIR__) . $file;
if (!\is_file($path)) {
return;
}
$this->loadIfNotLoadedYet($path);
}

public function includePhpCodeSnifferAutoload(): void
public function includePhpCodeSnifferAutoload() : void
{
// 1. autoload
foreach (self::POSSIBLE_AUTOLOAD_PATHS as $possibleAutoloadPath) {
$possiblePhpCodeSnifferAutoloadPath = $possibleAutoloadPath . '/squizlabs/php_codesniffer/autoload.php';
if (! is_file($possiblePhpCodeSnifferAutoloadPath)) {
if (!\is_file($possiblePhpCodeSnifferAutoloadPath)) {
continue;
}

require_once $possiblePhpCodeSnifferAutoloadPath;
}

// initalize token with INT type, otherwise php-cs-fixer and php-parser breaks
if (! defined('T_MATCH')) {
define('T_MATCH', 5000);
if (!\defined('T_MATCH')) {
\define('T_MATCH', 5000);
}

if (! defined('T_READONLY')) {
define('T_READONLY', 5010);
if (!\defined('T_READONLY')) {
\define('T_READONLY', 5010);
}

if (! defined('T_ENUM')) {
define('T_ENUM', 5015);
if (!\defined('T_ENUM')) {
\define('T_ENUM', 5015);
}

// for PHP_CodeSniffer
define('PHP_CODESNIFFER_CBF', false);
define('PHP_CODESNIFFER_VERBOSITY', 0);

\define('PHP_CODESNIFFER_CBF', \false);
\define('PHP_CODESNIFFER_VERBOSITY', 0);
new Tokens();
}

public function loadIfNotLoadedYet(string $file): void
public function loadIfNotLoadedYet(string $file) : void
{
if (! file_exists($file)) {
if (!\file_exists($file)) {
return;
}

if (in_array($file, $this->alreadyLoadedAutoloadFiles, true)) {
if (\in_array($file, $this->alreadyLoadedAutoloadFiles, \true)) {
return;
}

$realPath = realpath($file);
if (! is_string($realPath)) {
$realPath = \realpath($file);
if (!\is_string($realPath)) {
return;
}

$this->alreadyLoadedAutoloadFiles[] = $realPath;
require_once $file;
}
}

try {
$input = new ArgvInput();
$ecsContainerFactory = new EasyCodingStandardContainerFactory();
$container = $ecsContainerFactory->createFromFromInput($input);
} catch (Throwable $throwable) {
} catch (\Throwable $throwable) {
$symfonyStyleFactory = new SymfonyStyleFactory();
$symfonyStyle = $symfonyStyleFactory->create();

$symfonyStyle->error($throwable->getMessage());
$symfonyStyle->writeln($throwable->getTraceAsString());
exit(Command::FAILURE);
}

/** @var EasyCodingStandardConsoleApplication $application */
$application = $container->get(EasyCodingStandardConsoleApplication::class);

$statusCode = $application->run();
exit($statusCode);
File renamed without changes.
16 changes: 0 additions & 16 deletions build/rector-downgrade-php-72.php

This file was deleted.

10 changes: 0 additions & 10 deletions build/target-repository/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions build/target-repository/composer.json

This file was deleted.

91 changes: 9 additions & 82 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,95 +1,22 @@
{
"name": "symplify/easy-coding-standard",
"description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer.",
"description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer",
"license": "MIT",
"keywords": [
"static analysis",
"code style",
"automation",
"fixer"
],
"keywords": ["static analysis", "code style", "automation", "fixer"],
"bin": [
"bin/ecs"
],
"require": {
"php": ">=8.1",
"composer/xdebug-handler": "^3.0",
"friendsofphp/php-cs-fixer": "^3.22.0",
"illuminate/container": "^10.15",
"nette/utils": "^3.2",
"sebastian/diff": "^5.0",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/console": "^6.3",
"symfony/finder": "^6.3",
"symplify/coding-standard": "^12.0",
"symplify/easy-parallel": "^11.1",
"webmozart/assert": "^1.11"
},
"require-dev": {
"cweagans/composer-patches": "^1.7",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.19",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.2",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.0",
"rector/rector": "^0.17.1",
"symplify/easy-ci": "^11.1",
"symplify/phpstan-extensions": "^11.2",
"symplify/vendor-patches": "^11.2",
"tomasvotruba/class-leak": "0.0.22.72",
"tracy/tracy": "^2.9"
"php": ">=7.2"
},
"autoload": {
"psr-4": {
"Symplify\\EasyCodingStandard\\": [
"src",
"packages"
]
}
},
"autoload-dev": {
"psr-4": {
"Symplify\\EasyCodingStandard\\Tests\\": [
"tests",
"packages-tests"
]
},
"files": [
"tests/functions.php"
"bootstrap.php"
]
},
"config": {
"sort-packages": true,
"platform-check": false,
"allow-plugins": {
"cweagans/composer-patches": true,
"phpstan/extension-installer": true
}
},
"scripts": {
"check-cs": "bin/ecs check --ansi",
"fix-cs": "bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"rector": "vendor/bin/rector process --dry-run --ansi"
},
"replace": {
"symfony/polyfill-intl-grapheme": "*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-intl-normalizer": "*",
"symfony/event-dispatcher": "6.*",
"symfony/process": "6.*",
"symfony/stopwatch": "6.*",
"symfony/string": "6.*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"patches": {
"symfony/console": [
"patches/symfony-console-helper-helper-php.patch"
]
}
"conflict": {
"symplify/coding-standard": "<11.3",
"squizlabs/php_codesniffer": "<3.6",
"friendsofphp/php-cs-fixer": "<3.0"
}
}
}
17 changes: 6 additions & 11 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<?php

declare(strict_types=1);
declare (strict_types=1);
namespace ECSPrefix202307;

use Symplify\EasyCodingStandard\Application\Version\StaticVersionResolver;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ECSConfig $ecsConfig): void {
return static function (ECSConfig $ecsConfig) : void {
$ecsConfig->indentation(Option::INDENTATION_SPACES);
$ecsConfig->lineEnding(PHP_EOL);

$cacheDirectory = sys_get_temp_dir() . '/changed_files_detector';
$ecsConfig->lineEnding(\PHP_EOL);
$cacheDirectory = \sys_get_temp_dir() . '/changed_files_detector';
if (StaticVersionResolver::PACKAGE_VERSION !== '@package_version@') {
$cacheDirectory .= '_' . StaticVersionResolver::PACKAGE_VERSION;
}

$ecsConfig->cacheDirectory($cacheDirectory);

// make cache individual per project
$cacheNamespace = str_replace(DIRECTORY_SEPARATOR, '_', getcwd());
$cacheNamespace = \str_replace(\DIRECTORY_SEPARATOR, '_', \getcwd());
$ecsConfig->cacheNamespace($cacheNamespace);

$ecsConfig->parallel();

$ecsConfig->paths([]);
$ecsConfig->skip([]);
$ecsConfig->fileExtensions(['php']);
Expand Down

0 comments on commit 139938d

Please sign in to comment.