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 Jan 9, 2023
1 parent d8cf7c4 commit be31d9b
Show file tree
Hide file tree
Showing 3,331 changed files with 326,630 additions and 5,987 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

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

.phpunit.result.cache
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 ECSPrefix202301;

require __DIR__ . '/ecs.php';
93 changes: 34 additions & 59 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 ECSPrefix202301;

// 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 ECSPrefix202301\Symfony\Component\Console\Command\Command;
use ECSPrefix202301\Symfony\Component\Console\Input\ArgvInput;
use Symplify\EasyCodingStandard\Console\EasyCodingStandardConsoleApplication;
use Symplify\EasyCodingStandard\DependencyInjection\EasyCodingStandardContainerFactory;
use Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;

use ECSPrefix202301\Symplify\PackageBuilder\Console\Style\SymfonyStyleFactory;
// 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->includePhpCodeSnifferAutoloadIfNotInPharAndInitliazeTokens();

/**
* Inspired by https://github.com/rectorphp/rector/pull/2373/files#diff-0fc04a2bb7928cac4ae339d5a8bf67f3
*/
Expand All @@ -45,110 +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\HttpKernel\EasyCodingStandardKernel')) {
if (\class_exists('\\Symplify\\EasyCodingStandard\\HttpKernel\\EasyCodingStandardKernel')) {
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 includePhpCodeSnifferAutoloadIfNotInPharAndInitliazeTokens(): void
public function includePhpCodeSnifferAutoloadIfNotInPharAndInitliazeTokens() : void
{
// file is autoloaded with classmap in PHAR
// without phar, we still need to autoload it
# 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);
}

$application = $container->get(EasyCodingStandardConsoleApplication::class);
exit($application->run());
File renamed without changes.
33 changes: 0 additions & 33 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.

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

This file was deleted.

83 changes: 9 additions & 74 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,20 @@
{
"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",
"bin": [
"bin/ecs"
],
"require": {
"php": ">=8.1",
"composer/xdebug-handler": "^3.0",
"friendsofphp/php-cs-fixer": "^3.12",
"nette/utils": "^3.2",
"squizlabs/php_codesniffer": "^3.7.1",
"symfony/config": "^6.2",
"symfony/console": "^6.2",
"symfony/dependency-injection": "6.1.*",
"symfony/finder": "^6.2",
"symplify/autowire-array-parameter": "^11.1",
"symplify/coding-standard": "^11.1.32",
"symplify/easy-parallel": "^11.1",
"symplify/package-builder": "^11.1",
"symplify/symplify-kernel": "^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.9.4",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-symfony": "^1.2",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^9.5.27",
"rector/rector": "^0.15.2",
"symplify/easy-ci": "^11.1",
"symplify/monorepo-builder": "^11.1",
"symplify/phpstan-extensions": "^11.1",
"tracy/tracy": "^2.9"
"php": ">=7.2"
},
"autoload": {
"psr-4": {
"Symplify\\EasyCodingStandard\\": [
"src",
"packages"
]
}
},
"autoload-dev": {
"psr-4": {
"Symplify\\EasyCodingStandard\\Tests\\": [
"tests",
"packages-tests"
]
}
},
"extra": {
"enable-patching": true,
"patches": {
"symfony/dependency-injection": [
"https://raw.githubusercontent.com/symplify/vendor-patch-files/main/patches/generic-php-config-loader.patch"
]
}
},
"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",
"docs": [
"vendor/bin/rule-doc-generator generate packages/coding-standard --output-file docs/rules_overview.md --ansi",
"bin/ecs check-markdown docs/rules_overview.md --fix --ansi"
],
"rector": "vendor/bin/rector process --dry-run --ansi",
"release": "vendor/bin/monorepo-builder release patch --ansi"
"files": [
"bootstrap.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true
"conflict": {
"squizlabs/php_codesniffer": "<3.6",
"friendsofphp/php-cs-fixer": "<3.0"
}
}
Loading

0 comments on commit be31d9b

Please sign in to comment.