diff --git a/.gitattributes b/.gitattributes index 0e90da01c6a..e74aa095003 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,7 +5,7 @@ /tests/Differ/AbstractDifferTestCase.php export-ignore /tests/Fixtures/ export-ignore /tests/Linter/AbstractLinterTestCase.php export-ignore -/tests/Report/AbstractReporterTestCase.php export-ignore +/tests/Console/Report/FixReport/AbstractReporterTestCase.php export-ignore /tests/Test/AbstractFixerWithAliasedOptionsTestCase.php export-ignore /tests/Test/AbstractTransformerTestCase.php export-ignore diff --git a/doc/config.rst b/doc/config.rst index c48e91bf980..1373bde4645 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -71,6 +71,3 @@ configure them in your config file. ->setIndent("\t") ->setLineEnding("\r\n") ; - -By using ``--using-cache`` option with ``yes`` or ``no`` you can set if the caching -mechanism should be used. diff --git a/doc/report-schema/checkstyle.xsd b/doc/schemas/fix/checkstyle.xsd similarity index 100% rename from doc/report-schema/checkstyle.xsd rename to doc/schemas/fix/checkstyle.xsd diff --git a/doc/report-schema/junit-10.xsd b/doc/schemas/fix/junit-10.xsd similarity index 100% rename from doc/report-schema/junit-10.xsd rename to doc/schemas/fix/junit-10.xsd diff --git a/doc/report-schema/schema.json b/doc/schemas/fix/schema.json similarity index 100% rename from doc/report-schema/schema.json rename to doc/schemas/fix/schema.json diff --git a/doc/report-schema/xml.xsd b/doc/schemas/fix/xml.xsd similarity index 100% rename from doc/report-schema/xml.xsd rename to doc/schemas/fix/xml.xsd diff --git a/doc/usage.rst b/doc/usage.rst index 9974c3cd38f..0f3164c0e06 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -20,10 +20,12 @@ to merge paths from the config file and from the argument: The ``--format`` option for the output format. Supported formats are ``txt`` (default one), ``json``, ``xml``, ``checkstyle``, ``junit`` and ``gitlab``. -NOTE: the output for the following formats are generated in accordance with XML schemas +NOTE: the output for the following formats are generated in accordance with schemas -* ``checkstyle`` follows the common `"checkstyle" xml schema `_ -* ``junit`` follows the `JUnit xml schema from Jenkins `_ +* ``checkstyle` follows the common `"checkstyle" XML schema `_ +* ``json` follows the `own JSON schema `_ +* ``junit`` follows the `JUnit XML schema from Jenkins `_ +* ``xml`` follows the `own XML schema `_ The ``--quiet`` Do not output any message. diff --git a/src/Console/Command/FixCommand.php b/src/Console/Command/FixCommand.php index 492b9a6a5e0..0e08711ffca 100644 --- a/src/Console/Command/FixCommand.php +++ b/src/Console/Command/FixCommand.php @@ -18,8 +18,8 @@ use PhpCsFixer\Console\Output\ErrorOutput; use PhpCsFixer\Console\Output\NullOutput; use PhpCsFixer\Console\Output\ProcessOutput; +use PhpCsFixer\Console\Report\FixReport\ReportSummary; use PhpCsFixer\Error\ErrorsManager; -use PhpCsFixer\Report\ReportSummary; use PhpCsFixer\Runner\Runner; use PhpCsFixer\ToolInfoInterface; use Symfony\Component\Console\Command\Command; @@ -98,7 +98,7 @@ protected function configure() ->setDefinition( [ new InputArgument('path', InputArgument::IS_ARRAY, 'The path.'), - new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, 'Specify path mode (can be override or intersection).', 'override'), + new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, 'Specify path mode (can be override or intersection).', ConfigurationResolver::PATH_MODE_OVERRIDE), new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, 'Are risky fixers allowed (can be yes or no).'), new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a .php_cs file.'), new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified.'), diff --git a/src/Console/Command/HelpCommand.php b/src/Console/Command/HelpCommand.php index 86481588540..6fdf512db0d 100644 --- a/src/Console/Command/HelpCommand.php +++ b/src/Console/Command/HelpCommand.php @@ -67,10 +67,12 @@ public static function getHelpCopy() The --format option for the output format. Supported formats are `txt` (default one), `json`, `xml`, `checkstyle`, `junit` and `gitlab`. -NOTE: the output for the following formats are generated in accordance with XML schemas +NOTE: the output for the following formats are generated in accordance with schemas -* `checkstyle` follows the common `"checkstyle" xml schema `_ -* `junit` follows the `JUnit xml schema from Jenkins `_ +* `checkstyle` follows the common `"checkstyle" XML schema `_ +* `json` follows the `own JSON schema `_ +* `junit` follows the `JUnit XML schema from Jenkins `_ +* `xml` follows the `own XML schema `_ The --quiet Do not output any message. diff --git a/src/Console/ConfigurationResolver.php b/src/Console/ConfigurationResolver.php index 7f0d58fcdb1..991d3a19354 100644 --- a/src/Console/ConfigurationResolver.php +++ b/src/Console/ConfigurationResolver.php @@ -21,6 +21,8 @@ use PhpCsFixer\Cache\Signature; use PhpCsFixer\ConfigInterface; use PhpCsFixer\ConfigurationException\InvalidConfigurationException; +use PhpCsFixer\Console\Report\FixReport\ReporterFactory; +use PhpCsFixer\Console\Report\FixReport\ReporterInterface; use PhpCsFixer\Differ\DifferInterface; use PhpCsFixer\Differ\NullDiffer; use PhpCsFixer\Differ\SebastianBergmannDiffer; @@ -31,8 +33,6 @@ use PhpCsFixer\FixerFactory; use PhpCsFixer\Linter\Linter; use PhpCsFixer\Linter\LinterInterface; -use PhpCsFixer\Report\ReporterFactory; -use PhpCsFixer\Report\ReporterInterface; use PhpCsFixer\RuleSet\RuleSet; use PhpCsFixer\StdinFileInfo; use PhpCsFixer\ToolInfoInterface; diff --git a/src/Report/CheckstyleReporter.php b/src/Console/Report/FixReport/CheckstyleReporter.php similarity index 97% rename from src/Report/CheckstyleReporter.php rename to src/Console/Report/FixReport/CheckstyleReporter.php index 6ce5ab22859..a967e11ecf9 100644 --- a/src/Report/CheckstyleReporter.php +++ b/src/Console/Report/FixReport/CheckstyleReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/src/Report/GitlabReporter.php b/src/Console/Report/FixReport/GitlabReporter.php similarity index 97% rename from src/Report/GitlabReporter.php rename to src/Console/Report/FixReport/GitlabReporter.php index 7845ca74aa1..27436241fdb 100644 --- a/src/Report/GitlabReporter.php +++ b/src/Console/Report/FixReport/GitlabReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/src/Report/JsonReporter.php b/src/Console/Report/FixReport/JsonReporter.php similarity index 97% rename from src/Report/JsonReporter.php rename to src/Console/Report/FixReport/JsonReporter.php index 2772b2d8135..2e678ce7fd3 100644 --- a/src/Report/JsonReporter.php +++ b/src/Console/Report/FixReport/JsonReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/src/Report/JunitReporter.php b/src/Console/Report/FixReport/JunitReporter.php similarity index 98% rename from src/Report/JunitReporter.php rename to src/Console/Report/FixReport/JunitReporter.php index fa747b35a08..c48d803ff73 100644 --- a/src/Report/JunitReporter.php +++ b/src/Console/Report/FixReport/JunitReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use PhpCsFixer\Preg; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/src/Report/ReportSummary.php b/src/Console/Report/FixReport/ReportSummary.php similarity index 97% rename from src/Report/ReportSummary.php rename to src/Console/Report/FixReport/ReportSummary.php index a276649e751..6168fd549ca 100644 --- a/src/Report/ReportSummary.php +++ b/src/Console/Report/FixReport/ReportSummary.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; /** * @author Dariusz RumiƄski diff --git a/src/Report/ReporterFactory.php b/src/Console/Report/FixReport/ReporterFactory.php similarity index 98% rename from src/Report/ReporterFactory.php rename to src/Console/Report/FixReport/ReporterFactory.php index 092a9325549..18c39acb12d 100644 --- a/src/Report/ReporterFactory.php +++ b/src/Console/Report/FixReport/ReporterFactory.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use Symfony\Component\Finder\Finder as SymfonyFinder; use Symfony\Component\Finder\SplFileInfo; diff --git a/src/Report/ReporterInterface.php b/src/Console/Report/FixReport/ReporterInterface.php similarity index 90% rename from src/Report/ReporterInterface.php rename to src/Console/Report/FixReport/ReporterInterface.php index 6138558b31d..252b18a9167 100644 --- a/src/Report/ReporterInterface.php +++ b/src/Console/Report/FixReport/ReporterInterface.php @@ -10,10 +10,12 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; /** * @author Boris Gorbylev + * + * @internal */ interface ReporterInterface { diff --git a/src/Report/TextReporter.php b/src/Console/Report/FixReport/TextReporter.php similarity index 98% rename from src/Report/TextReporter.php rename to src/Console/Report/FixReport/TextReporter.php index c473d84ce9d..71f601892ee 100644 --- a/src/Report/TextReporter.php +++ b/src/Console/Report/FixReport/TextReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use PhpCsFixer\Differ\DiffConsoleFormatter; diff --git a/src/Report/XmlReporter.php b/src/Console/Report/FixReport/XmlReporter.php similarity index 98% rename from src/Report/XmlReporter.php rename to src/Console/Report/FixReport/XmlReporter.php index 080715aada9..17401bdd82b 100644 --- a/src/Report/XmlReporter.php +++ b/src/Console/Report/FixReport/XmlReporter.php @@ -10,7 +10,7 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Report; +namespace PhpCsFixer\Console\Report\FixReport; use Symfony\Component\Console\Formatter\OutputFormatter; diff --git a/tests/Report/AbstractReporterTestCase.php b/tests/Console/Report/FixReport/AbstractReporterTestCase.php similarity index 96% rename from tests/Report/AbstractReporterTestCase.php rename to tests/Console/Report/FixReport/AbstractReporterTestCase.php index c3c66ac92d3..f8a78d853ba 100644 --- a/tests/Report/AbstractReporterTestCase.php +++ b/tests/Console/Report/FixReport/AbstractReporterTestCase.php @@ -10,10 +10,10 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\ReporterInterface; -use PhpCsFixer\Report\ReportSummary; +use PhpCsFixer\Console\Report\FixReport\ReporterInterface; +use PhpCsFixer\Console\Report\FixReport\ReportSummary; use PhpCsFixer\Tests\TestCase; /** diff --git a/tests/Report/CheckstyleReporterTest.php b/tests/Console/Report/FixReport/CheckstyleReporterTest.php similarity index 93% rename from tests/Report/CheckstyleReporterTest.php rename to tests/Console/Report/FixReport/CheckstyleReporterTest.php index ea6841b3010..bb29942d31b 100644 --- a/tests/Report/CheckstyleReporterTest.php +++ b/tests/Console/Report/FixReport/CheckstyleReporterTest.php @@ -10,10 +10,10 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; +use PhpCsFixer\Console\Report\FixReport\CheckstyleReporter; use PhpCsFixer\PhpunitConstraintXmlMatchesXsd\Constraint\XmlMatchesXsd; -use PhpCsFixer\Report\CheckstyleReporter; use Symfony\Component\Console\Formatter\OutputFormatter; /** @@ -21,7 +21,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\CheckstyleReporter + * @covers \PhpCsFixer\Console\Report\FixReport\CheckstyleReporter */ final class CheckstyleReporterTest extends AbstractReporterTestCase { @@ -34,7 +34,7 @@ final class CheckstyleReporterTest extends AbstractReporterTestCase public static function doSetUpBeforeClass() { - self::$xsd = file_get_contents(__DIR__.'/../../doc/report-schema/checkstyle.xsd'); + self::$xsd = file_get_contents(__DIR__.'/../../../../doc/schemas/fix/checkstyle.xsd'); } public static function doTearDownAfterClass() diff --git a/tests/Report/GitlabReporterTest.php b/tests/Console/Report/FixReport/GitlabReporterTest.php similarity index 95% rename from tests/Report/GitlabReporterTest.php rename to tests/Console/Report/FixReport/GitlabReporterTest.php index 19061dcda9f..4d6fce68b6d 100644 --- a/tests/Report/GitlabReporterTest.php +++ b/tests/Console/Report/FixReport/GitlabReporterTest.php @@ -10,15 +10,15 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\GitlabReporter; +use PhpCsFixer\Console\Report\FixReport\GitlabReporter; /** * @author Hans-Christian Otto * * @internal - * @covers \PhpCsFixer\Report\GitlabReporter + * @covers \PhpCsFixer\Console\Report\FixReport\GitlabReporter */ final class GitlabReporterTest extends AbstractReporterTestCase { diff --git a/tests/Report/JsonReporterTest.php b/tests/Console/Report/FixReport/JsonReporterTest.php similarity index 93% rename from tests/Report/JsonReporterTest.php rename to tests/Console/Report/FixReport/JsonReporterTest.php index 80487adac14..c049b92e9dc 100644 --- a/tests/Report/JsonReporterTest.php +++ b/tests/Console/Report/FixReport/JsonReporterTest.php @@ -10,9 +10,9 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\JsonReporter; +use PhpCsFixer\Console\Report\FixReport\JsonReporter; /** * @author Boris Gorbylev @@ -20,7 +20,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\JsonReporter + * @covers \PhpCsFixer\Console\Report\FixReport\JsonReporter */ final class JsonReporterTest extends AbstractReporterTestCase { @@ -153,7 +153,7 @@ protected function assertFormat($expected, $input) */ private static function assertJsonSchema($json) { - $jsonPath = __DIR__.'/../../doc/report-schema/schema.json'; + $jsonPath = __DIR__.'/../../../../doc/schemas/fix/schema.json'; $data = json_decode($json); diff --git a/tests/Report/JunitReporterTest.php b/tests/Console/Report/FixReport/JunitReporterTest.php similarity index 94% rename from tests/Report/JunitReporterTest.php rename to tests/Console/Report/FixReport/JunitReporterTest.php index e0124231cc9..9c42ead726a 100644 --- a/tests/Report/JunitReporterTest.php +++ b/tests/Console/Report/FixReport/JunitReporterTest.php @@ -10,10 +10,10 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; +use PhpCsFixer\Console\Report\FixReport\JunitReporter; use PhpCsFixer\PhpunitConstraintXmlMatchesXsd\Constraint\XmlMatchesXsd; -use PhpCsFixer\Report\JunitReporter; use Symfony\Component\Console\Formatter\OutputFormatter; /** @@ -22,7 +22,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\JunitReporter + * @covers \PhpCsFixer\Console\Report\FixReport\JunitReporter */ final class JunitReporterTest extends AbstractReporterTestCase { @@ -39,7 +39,7 @@ public static function doSetUpBeforeClass() { parent::doSetUpBeforeClass(); - self::$xsd = file_get_contents(__DIR__.'/../../doc/report-schema/junit-10.xsd'); + self::$xsd = file_get_contents(__DIR__.'/../../../../doc/schemas/fix/junit-10.xsd'); } public static function doTearDownAfterClass() diff --git a/tests/Report/ReportSummaryTest.php b/tests/Console/Report/FixReport/ReportSummaryTest.php similarity index 88% rename from tests/Report/ReportSummaryTest.php rename to tests/Console/Report/FixReport/ReportSummaryTest.php index 76637d73ba4..8c412e24784 100644 --- a/tests/Report/ReportSummaryTest.php +++ b/tests/Console/Report/FixReport/ReportSummaryTest.php @@ -10,9 +10,9 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\ReportSummary; +use PhpCsFixer\Console\Report\FixReport\ReportSummary; use PhpCsFixer\Tests\TestCase; /** @@ -20,7 +20,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\ReportSummary + * @covers \PhpCsFixer\Console\Report\FixReport\ReportSummary */ final class ReportSummaryTest extends TestCase { diff --git a/tests/Report/ReporterFactoryTest.php b/tests/Console/Report/FixReport/ReporterFactoryTest.php similarity index 91% rename from tests/Report/ReporterFactoryTest.php rename to tests/Console/Report/FixReport/ReporterFactoryTest.php index bd60158e876..af7c815e7ce 100644 --- a/tests/Report/ReporterFactoryTest.php +++ b/tests/Console/Report/FixReport/ReporterFactoryTest.php @@ -10,9 +10,9 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\ReporterFactory; +use PhpCsFixer\Console\Report\FixReport\ReporterFactory; use PhpCsFixer\Tests\TestCase; /** @@ -20,7 +20,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\ReporterFactory + * @covers \PhpCsFixer\Console\Report\FixReport\ReporterFactory */ final class ReporterFactoryTest extends TestCase { @@ -106,7 +106,7 @@ public function testGetNonRegisteredReport() private function createReporterDouble($format) { - $reporter = $this->prophesize(\PhpCsFixer\Report\ReporterInterface::class); + $reporter = $this->prophesize(\PhpCsFixer\Console\Report\FixReport\ReporterInterface::class); $reporter->getFormat()->willReturn($format); return $reporter->reveal(); diff --git a/tests/Report/TextReporterTest.php b/tests/Console/Report/FixReport/TextReporterTest.php similarity index 93% rename from tests/Report/TextReporterTest.php rename to tests/Console/Report/FixReport/TextReporterTest.php index 4fddef90df1..37bb73526bf 100644 --- a/tests/Report/TextReporterTest.php +++ b/tests/Console/Report/FixReport/TextReporterTest.php @@ -10,9 +10,9 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; -use PhpCsFixer\Report\TextReporter; +use PhpCsFixer\Console\Report\FixReport\TextReporter; /** * @author Boris Gorbylev @@ -20,7 +20,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\TextReporter + * @covers \PhpCsFixer\Console\Report\FixReport\TextReporter */ final class TextReporterTest extends AbstractReporterTestCase { diff --git a/tests/Report/XmlReporterTest.php b/tests/Console/Report/FixReport/XmlReporterTest.php similarity index 92% rename from tests/Report/XmlReporterTest.php rename to tests/Console/Report/FixReport/XmlReporterTest.php index 5513a47593b..94a0ac3fbc9 100644 --- a/tests/Report/XmlReporterTest.php +++ b/tests/Console/Report/FixReport/XmlReporterTest.php @@ -10,10 +10,10 @@ * with this source code in the file LICENSE. */ -namespace PhpCsFixer\Tests\Report; +namespace PhpCsFixer\Tests\Console\Report\FixReport; +use PhpCsFixer\Console\Report\FixReport\XmlReporter; use PhpCsFixer\PhpunitConstraintXmlMatchesXsd\Constraint\XmlMatchesXsd; -use PhpCsFixer\Report\XmlReporter; use Symfony\Component\Console\Formatter\OutputFormatter; /** @@ -22,7 +22,7 @@ * * @internal * - * @covers \PhpCsFixer\Report\XmlReporter + * @covers \PhpCsFixer\Console\Report\FixReport\XmlReporter */ final class XmlReporterTest extends AbstractReporterTestCase { @@ -35,7 +35,7 @@ public static function doSetUpBeforeClass() { parent::doSetUpBeforeClass(); - self::$xsd = file_get_contents(__DIR__.'/../../doc/report-schema/xml.xsd'); + self::$xsd = file_get_contents(__DIR__.'/../../../../doc/schemas/fix/xml.xsd'); } public static function doTearDownAfterClass() diff --git a/tests/TextDiffTest.php b/tests/TextDiffTest.php index 097f63c0ec6..a94ce9e4557 100644 --- a/tests/TextDiffTest.php +++ b/tests/TextDiffTest.php @@ -13,7 +13,7 @@ namespace PhpCsFixer\Tests; use PhpCsFixer\Console\Command\FixCommand; -use PhpCsFixer\Report\ReporterFactory; +use PhpCsFixer\Console\Report\FixReport\ReporterFactory; use PhpCsFixer\ToolInfo; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester;