Skip to content

Commit 3b84ebe

Browse files
committed
drop pretty printing option
1 parent ea4d65f commit 3b84ebe

File tree

8 files changed

+2
-64
lines changed

8 files changed

+2
-64
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ The class generation process basically splits up into three to four steps:
160160

161161
- Scan the given source directory to find all *.json files which should be processed.
162162
- Loop over all schemas which should be generated. This is the main step of the class generation. Now each schema is parsed and a Schema model class which holds the properties for the generated model is populated. All validation rules defined in the JSON-Schema are translated into plain PHP code. After the model is finished a RenderJob is generated and added to the RenderQueue. If a JSON-Schema contains nested objects or references multiple RenderJobs may be added to the RenderQueue for a given schema file.
163+
- If post processors are defined for the generation process the post processors will be applied.
163164
- After all schema files have been parsed without an error the RenderQueue will be worked off. All previous added RenderJobs will be executed and the PHP classes will be saved to the filesystem at the given destination directory.
164-
- If pretty printing is enabled the generated PHP classes will be cleaned up for a better code formatting. Done.
165165

166166
## Tests ##
167167

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
"require-dev": {
2222
"phpunit/phpunit": "^8.5 || ^9.4"
2323
},
24-
"suggest": {
25-
"symplify/easy-coding-standard": "Allows pretty printing of the generated code"
26-
},
2724
"autoload": {
2825
"psr-4": {
2926
"PHPModelGenerator\\": "src"

docs/source/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ The Ebay OpenAPIv3 spec for the sell-inventory API is an around 6000 lines API d
2525
->generateModelDirectory($resultDir)
2626
->generateModels(new OpenAPIv3Provider($file), $resultDir);
2727
28-
Measured runtime of the script (Pretty printing is disabled) is around 3 seconds at a memory peak consumption between 5 and 6 MB.
28+
Measured runtime of the script is around 3 seconds at a memory peak consumption between 5 and 6 MB.

docs/source/gettingStarted.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -254,24 +254,6 @@ If you want to customize the exception handling you can set an own ErrorRegistry
254254
(new GeneratorConfiguration())
255255
->setErrorRegistryClass(MyCustomException::class);
256256
257-
Code style of the generated classes
258-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
259-
260-
.. code-block:: php
261-
262-
setPrettyPrint(bool $prettyPrint);
263-
264-
If set to false, the generated model classes won't follow coding guidelines (but the generation is faster). If enabled the package `Symplify/EasyCodingStandard <https://github.com/Symplify/EasyCodingStandard>`_ will be used to clean up the generated code. By default pretty printing is disabled.
265-
266-
.. code-block:: php
267-
268-
(new GeneratorConfiguration())
269-
->setPrettyPrint(true);
270-
271-
.. warning::
272-
273-
The ECS package must be installed manually: `composer require --dev symplify/easy-coding-standard`
274-
275257
Serialization methods
276258
^^^^^^^^^^^^^^^^^^^^^
277259

src/Model/GeneratorConfiguration.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ class GeneratorConfiguration
3333
/** @var bool */
3434
protected $denyAdditionalProperties = false;
3535
/** @var bool */
36-
protected $prettyPrint = false;
37-
/** @var bool */
3836
protected $outputEnabled = true;
3937
/** @var bool */
4038
protected $collectErrors = true;
@@ -255,26 +253,6 @@ public function setDenyAdditionalProperties(bool $denyAdditionalProperties): sel
255253
return $this;
256254
}
257255

258-
/**
259-
* @return bool
260-
*/
261-
public function hasPrettyPrintEnabled(): bool
262-
{
263-
return $this->prettyPrint;
264-
}
265-
266-
/**
267-
* @param bool $prettyPrint
268-
*
269-
* @return $this
270-
*/
271-
public function setPrettyPrint(bool $prettyPrint): self
272-
{
273-
$this->prettyPrint = $prettyPrint;
274-
275-
return $this;
276-
}
277-
278256
/**
279257
* @return bool
280258
*/

src/ModelGenerator.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ public function generateModels(SchemaProviderInterface $schemaProvider, string $
128128
// render all collected classes
129129
$renderQueue->execute($this->generatorConfiguration, $this->postProcessors);
130130

131-
if ($this->generatorConfiguration->hasPrettyPrintEnabled()) {
132-
// @codeCoverageIgnoreStart
133-
$out = $this->generatorConfiguration->isOutputEnabled() ? '' : '2>&1';
134-
shell_exec(__DIR__ . "/../vendor/bin/ecs check $destination --config " . __DIR__ . "/cs.yml --fix $out");
135-
// @codeCoverageIgnoreEnd
136-
}
137-
138131
return $schemaProcessor->getGeneratedFiles();
139132
}
140133
}

src/cs.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/AbstractPHPModelGeneratorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ protected function generateClass(
213213
string $schemaProviderClass = RecursiveDirectoryProvider::class
214214
): string {
215215
$generatorConfiguration = ($generatorConfiguration ?? (new GeneratorConfiguration())->setCollectErrors(false))
216-
->setPrettyPrint(false)
217216
->setImplicitNull($implicitNull)
218217
->setOutputEnabled(false);
219218

0 commit comments

Comments
 (0)