-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a combination of 195 commits.
new Application version strategy - see GH-267 make compatibility analyser compatible with Sniff architecture - see GH-268 removes old phpunit result printer system fix DeclareSniff following code reorganization applied to solve issue GH-186 fix AnonymousClassSniff following code reorganization applied to solve issue GH-186 fix ReturnTypeDeclarationSniff following code reorganization applied to solve issue GH-186 migrate old documentation from AsciiDoc to Markdown format add FilterVisitor and DataCollector(s) component in new architecture 5.4 add contract for ReferenceCollection add Profiler component in new architecture 5.4 includes part of PHP_Reflect code to decouple CompatInfo from Reflect runner better identification of anonymous classes, closures, generators reorganize sniffs by sub folders use rename ExponantiationSniff to PowOperatorSniff (with ParamTypeDeclarationSniff) to fully fix issue GH-142 use ShortTernaryOperatorSniff to detect elvis syntax renamed AnonymousFunctionSniff to ClosureSniff add UseTraitSniff to solve issue gh-227 add CombinedComparisonOperatorSniff to detect Spaceship syntax since PHP 7.0 rename ClassMemberAccessOnInstantiationSniff to ClassMemberAccessSniff and add onCloning PHP 7 feature add MagicClassConstantSniff to detect ::class syntax since PHP 5.5 add GeneratorSniff to solve issue gh-226; Return expression is not yet handle add TypedPropertySniff for PHP 7.4 new feature add phpunit group not_implemented to solve situation of generator return expression (test case exists but not yet implementation) use ClassExprSyntaxSniff to detect Class::{'expr'} syntax since PHP 5.4 add BinaryNumberFormatSniff to detect bin number format syntax introduced in PHP 5.4 switch from internal api v3 to v5 with a lite analyser:run command with only source path (no more json config file required) introduces ErrorHandler compatible with nikic/php-parser handled by --stop-on-failure option introduces logger with --debug option to replace old plugin system refactor event dispatcher/subscriber features and add container with symfony/dependency-injection component allow to use the new config option to load dynamically php external configuration via symfony/dependency-injection add MagicMethodsSniff to detect magic methods since PHP 5.1 replace hard-coded sniffs by a dynamic collection (see dependency-injection/container) introduces ApplicationInterface to be able to replace instance of console application easily remove display of php.all info in compatibility analyser analyser V5 never used anymore the Reflect common v3 component add CryptStringSniff to solve issue gh-220 (refactor for v5.4) add new ConditionalCodeSniff speed-up analysis process by removing priority file queue that is no more necessary
- Loading branch information
Showing
489 changed files
with
12,459 additions
and
22,722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,27 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
$appName = 'phpcompatinfo'; | ||
|
||
if (PHP_SAPI !== 'cli') { | ||
return; | ||
} | ||
|
||
if (\Phar::running()) { | ||
$vendorDir = 'phar://' . $appName . '.phar/vendor'; | ||
$vendorDir = 'phar://phpcompatinfo.phar/vendor'; | ||
} else { | ||
$baseDir = dirname(__DIR__); | ||
$vendorDir = $baseDir . '/vendor'; | ||
|
||
if (!file_exists($vendorDir . '/autoload.php')) { | ||
$vendorDir = dirname(dirname($baseDir)); | ||
} | ||
|
||
if (!getenv("BARTLETTRC")) { | ||
putenv("BARTLETTRC=" . $appName . '.json'); | ||
} | ||
} | ||
$loader = require_once $vendorDir . '/autoload.php'; | ||
$loader->setUseIncludePath(true); | ||
|
||
if (PHP_SAPI !== 'cli') { | ||
return; | ||
} | ||
require_once $vendorDir . '/autoload.php'; | ||
|
||
use Bartlett\Reflect\Environment; | ||
use Bartlett\CompatInfo\Console\Application; | ||
use Bartlett\CompatInfo\Console\ApplicationInterface; | ||
|
||
Environment::setScanDir(); | ||
/** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */ | ||
$container = require dirname(__DIR__) . '/config/container.php'; | ||
|
||
$application = new Application(); | ||
$application->run(); | ||
$app = $container->get(ApplicationInterface::class); | ||
$app->setContainer($container); | ||
exit($app->run()); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; | ||
|
||
$containerBuilder = new ContainerBuilder(); | ||
$loader = new PhpFileLoader($containerBuilder, new FileLocator(__DIR__ . '/set')); | ||
$loader->load('default.php'); | ||
|
||
$containerBuilder->compile(); // mandatory or the sniffCollection won't be populated | ||
return $containerBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bartlett\CompatInfo\Collection\SniffCollection; | ||
use Bartlett\CompatInfo\Console\Application; | ||
use Bartlett\CompatInfo\Console\ApplicationInterface; | ||
use Bartlett\CompatInfo\Sniffs\SniffInterface; | ||
|
||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; | ||
|
||
/** | ||
* Build the Container with common parameters and services | ||
* | ||
* @link https://symfony.com/doc/current/components/dependency_injection.html#avoiding-your-code-becoming-dependent-on-the-container | ||
* | ||
* @param ContainerConfigurator $containerConfigurator | ||
* @return void | ||
*/ | ||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
|
||
$services = $containerConfigurator->services(); | ||
|
||
$services->defaults() | ||
->autowire() | ||
->public() | ||
; | ||
|
||
$services->set(ApplicationInterface::class, Application::class) | ||
// for bin file | ||
->public() | ||
; | ||
|
||
// @link https://symfony.com/doc/current/service_container/tags.html#autoconfiguring-tags | ||
$services->instanceof(SniffInterface::class) | ||
->tag('phpcompatinfo.compatibility_sniff') | ||
; | ||
|
||
$services->load('Bartlett\CompatInfo\Sniffs\\', __DIR__ . '/../../src/Bartlett/CompatInfo/Sniffs') | ||
; | ||
|
||
// @link https://symfony.com/doc/current/service_container/tags.html#reference-tagged-services | ||
$services->set(SniffCollection::class, SniffCollection::class) | ||
->args([tagged_iterator('phpcompatinfo.compatibility_sniff')]) | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bartlett\CompatInfo\Console\Input\Input; | ||
use Bartlett\CompatInfo\Console\Output\Output; | ||
use Bartlett\CompatInfo\Event\Dispatcher\EventDispatcher; | ||
use Bartlett\CompatInfo\Event\Subscriber\LogEventSubscriber; | ||
use Bartlett\CompatInfo\Event\Subscriber\ProfileEventSubscriber; | ||
use Bartlett\CompatInfo\Logger\DefaultLogger; | ||
|
||
use Psr\Log\LoggerInterface; | ||
use Psr\Log\LogLevel; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
use Symfony\Component\Stopwatch\Stopwatch; | ||
use function Symfony\Component\DependencyInjection\Loader\Configurator\ref; | ||
|
||
/** | ||
* Build the Container with default parameters and services | ||
* | ||
* @link https://symfony.com/doc/current/components/dependency_injection.html#avoiding-your-code-becoming-dependent-on-the-container | ||
* | ||
* @param ContainerConfigurator $containerConfigurator | ||
* @return void | ||
*/ | ||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$containerConfigurator->import(__DIR__ . '/common.php'); | ||
|
||
$parameters = $containerConfigurator->parameters(); | ||
|
||
$parameters->set('app.log_stream_path', sprintf('/tmp/compatinfo-%s.log', date('YmdHi'))); | ||
$parameters->set('app.log_channel', 'App'); | ||
$parameters->set('app.log_level', LogLevel::DEBUG); | ||
|
||
$services = $containerConfigurator->services(); | ||
|
||
$services->defaults() | ||
->autowire() | ||
->public() | ||
; | ||
|
||
$services->set(InputInterface::class, Input::class); | ||
$services->set(OutputInterface::class, Output::class); | ||
|
||
$services->set(Stopwatch::class, Stopwatch::class); | ||
|
||
$services->set(LoggerInterface::class, DefaultLogger::class) | ||
->args(['%app.log_stream_path%', '%app.log_channel%', '%app.log_level%']) | ||
; | ||
|
||
$services->set(ProfileEventSubscriber::class, ProfileEventSubscriber::class) | ||
->args([ref(Stopwatch::class)]) | ||
; | ||
|
||
$services->set(LogEventSubscriber::class, LogEventSubscriber::class) | ||
->args([ref(LoggerInterface::class)]) | ||
; | ||
|
||
$services->set(EventDispatcherInterface::class, EventDispatcher::class) | ||
->args([ | ||
ref(InputInterface::class), | ||
ref(ProfileEventSubscriber::class), | ||
ref(LogEventSubscriber::class) | ||
]) | ||
; | ||
}; |
Oops, something went wrong.