Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Commit 5023d9a

Browse files
committed
CS fix
1 parent a707e2f commit 5023d9a

27 files changed

+338
-304
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ docs
1010
vendor
1111
node_modules
1212
.php-cs-fixer.cache
13+
runtime

.php-cs-fixer.dist.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
declare(strict_types=1);
44

5-
if (!file_exists(__DIR__.'/src')) {
6-
exit(0);
7-
}
5+
require_once 'vendor/autoload.php';
86

9-
return (new PhpCsFixer\Config())
10-
->setRules([
11-
'@PSR12' => true,
12-
'ternary_operator_spaces' => false,
13-
])
14-
->setRiskyAllowed(true)
15-
->setFinder(
16-
(new PhpCsFixer\Finder())
17-
->in(__DIR__.'/src')
18-
->append([__FILE__])
19-
)
20-
->setCacheFile('.php-cs-fixer.cache');
7+
return \Spiral\CodeStyle\Builder::create()
8+
->include(__DIR__ . '/src')
9+
->include(__DIR__ . '/tests')
10+
->include(__DIR__ . '/rector.php')
11+
->build();

composer.json

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,65 @@
11
{
2-
"name": "spiral/json-schema-generator",
3-
"description": "Provides the ability to generate JSON schemas from Data Transfer Object (DTO) classes",
4-
"keywords": [],
5-
"homepage": "https://github.com/spiral/json-schema-generator",
6-
"license": "MIT",
7-
"authors": [
8-
{
9-
"name": "Anton Titov (wolfy-j)",
10-
"email": "[email protected]"
11-
},
12-
{
13-
"name": "Pavel Buchnev (butschster)",
14-
"email": "[email protected]"
15-
},
16-
{
17-
"name": "Aleksei Gagarin (roxblnfk)",
18-
"email": "[email protected]"
19-
},
20-
{
21-
"name": "Maksim Smakouz (msmakouz)",
22-
"email": "[email protected]"
23-
}
24-
],
25-
"require": {
26-
"php": ">=8.1",
27-
"symfony/property-info": "^6.3 || ^7.0",
28-
"phpstan/phpdoc-parser": "^1.24",
29-
"phpdocumentor/reflection-docblock": "^5.3"
2+
"name": "context-hub/json-schema-generator",
3+
"description": "Provides the ability to generate JSON schemas from Data Transfer Object (DTO) classes",
4+
"keywords": [],
5+
"homepage": "https://github.com/spiral/json-schema-generator",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Anton Titov (wolfy-j)",
10+
"email": "[email protected]"
3011
},
31-
"require-dev": {
32-
"roave/security-advisories": "dev-latest",
33-
"phpunit/phpunit": "^10.4",
34-
"friendsofphp/php-cs-fixer": "^3.38",
35-
"vimeo/psalm": "^5.15"
12+
{
13+
"name": "Pavel Buchnev (butschster)",
14+
"email": "[email protected]"
3615
},
37-
"autoload": {
38-
"psr-4": {
39-
"Spiral\\JsonSchemaGenerator\\": "src"
40-
}
16+
{
17+
"name": "Aleksei Gagarin (roxblnfk)",
18+
"email": "[email protected]"
4119
},
42-
"autoload-dev": {
43-
"psr-4": {
44-
"Spiral\\JsonSchemaGenerator\\Tests\\": "tests"
45-
}
46-
},
47-
"scripts": {
48-
"test": "vendor/bin/phpunit",
49-
"psalm": "vendor/bin/psalm --config=psalm.xml ./src"
50-
},
51-
"config": {
52-
"sort-packages": true
53-
},
54-
"minimum-stability": "dev",
55-
"prefer-stable": true
20+
{
21+
"name": "Maksim Smakouz (msmakouz)",
22+
"email": "[email protected]"
23+
}
24+
],
25+
"require": {
26+
"php": ">=8.3",
27+
"symfony/property-info": "^6.0 | ^7.0 | ^8.0",
28+
"phpstan/phpdoc-parser": "^2.1",
29+
"phpdocumentor/reflection-docblock": "^5.6"
30+
},
31+
"require-dev": {
32+
"spiral/code-style": "^2.2.2",
33+
"phpunit/phpunit": "^10.2",
34+
"rector/rector": "^2.0",
35+
"vimeo/psalm": "^6.0"
36+
},
37+
"autoload": {
38+
"psr-4": {
39+
"Spiral\\JsonSchemaGenerator\\": "src"
40+
}
41+
},
42+
"autoload-dev": {
43+
"psr-4": {
44+
"Spiral\\JsonSchemaGenerator\\Tests\\": "tests"
45+
}
46+
},
47+
"scripts": {
48+
"cs-check": "vendor/bin/php-cs-fixer fix --dry-run",
49+
"cs-fix": "vendor/bin/php-cs-fixer fix",
50+
"psalm": "vendor/bin/psalm --config=psalm.xml ./src",
51+
"psalm:ci": "vendor/bin/psalm --config=psalm.xml ./src --output-format=github --shepherd --show-info=false --stats --threads=4 --no-cache",
52+
"refactor": "rector process --config=rector.php",
53+
"refactor:ci": "rector process --config=rector.php --dry-run --ansi",
54+
"test": "vendor/bin/phpunit",
55+
"test:cc": [
56+
"@putenv XDEBUG_MODE=coverage",
57+
"phpunit --coverage-clover=.build/phpunit/logs/clover.xml --color=always"
58+
]
59+
},
60+
"config": {
61+
"sort-packages": true
62+
},
63+
"minimum-stability": "dev",
64+
"prefer-stable": true
5665
}

psalm.xml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,45 @@
11
<?xml version="1.0"?>
22
<psalm
3-
errorLevel="2"
3+
errorLevel="4"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7-
findUnusedCode="false"
8-
findUnusedBaselineEntry="true"
97
>
108
<projectFiles>
11-
<directory name="src" />
9+
<directory name="src"/>
1210
<ignoreFiles>
13-
<directory name="vendor" />
11+
<directory name="vendor"/>
1412
</ignoreFiles>
1513
</projectFiles>
1614
<issueHandlers>
17-
<UndefinedAttributeClass>
15+
<InvalidArgument>
1816
<errorLevel type="suppress">
19-
<referencedClass name="JetBrains\PhpStorm\ExpectedValues" />
17+
<referencedFunction name="Spiral\Core\ScopeInterface::runScope"/>
2018
</errorLevel>
21-
</UndefinedAttributeClass>
19+
</InvalidArgument>
20+
<InternalMethod>
21+
<errorLevel type="suppress">
22+
<referencedMethod name="Spiral\Core\Attribute\Scope::__construct"/>
23+
<referencedMethod name="Spiral\Core\Scope::__construct"/>
24+
</errorLevel>
25+
</InternalMethod>
26+
<PossiblyUnusedMethod errorLevel="suppress" />
27+
<InternalClass>
28+
<errorLevel type="suppress">
29+
<referencedClass name="Spiral\Core\Attribute\Scope"/>
30+
<referencedClass name="Spiral\Core\Attribute\Proxy"/>
31+
<referencedClass name="Spiral\Core\Scope"/>
32+
</errorLevel>
33+
</InternalClass>
34+
<MissingOverrideAttribute errorLevel="suppress" />
35+
<UnusedParam errorLevel="suppress" />
2236
</issueHandlers>
37+
<forbiddenFunctions>
38+
<function name="var_dump"/>
39+
<function name="dd"/>
40+
<function name="dump"/>
41+
<function name="trap"/>
42+
<function name="tr"/>
43+
<function name="td"/>
44+
</forbiddenFunctions>
2345
</psalm>

rector.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Set\ValueObject\LevelSetList;
7+
use Rector\Set\ValueObject\SetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->paths([
11+
__DIR__ . '/src',
12+
__DIR__ . '/tests',
13+
]);
14+
15+
// Register rules for PHP 8.4 migration
16+
$rectorConfig->sets([
17+
SetList::PHP_83,
18+
LevelSetList::UP_TO_PHP_83,
19+
]);
20+
21+
// Skip vendor directories
22+
$rectorConfig->skip([
23+
__DIR__ . '/vendor',
24+
]);
25+
};

src/Exception/DefinitionException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class DefinitionException extends \RuntimeException
8-
{
9-
}
7+
class DefinitionException extends \RuntimeException {}

src/Exception/GeneratorException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class GeneratorException extends \RuntimeException
8-
{
9-
}
7+
class GeneratorException extends \RuntimeException {}

src/Exception/InvalidTypeException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
namespace Spiral\JsonSchemaGenerator\Exception;
66

7-
class InvalidTypeException extends \RuntimeException
8-
{
9-
}
7+
class InvalidTypeException extends \RuntimeException {}

src/Generator.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Generator implements GeneratorInterface
1919

2020
public function __construct(
2121
protected readonly ParserInterface $parser = new Parser(),
22-
) {
23-
}
22+
) {}
2423

2524
/**
2625
* @param class-string|\ReflectionClass $class
@@ -88,7 +87,7 @@ protected function generateDefinition(ClassParserInterface $class, array &$depen
8887
return new Definition(
8988
type: $class->getName(),
9089
options: $class->getEnumValues(),
91-
title: $class->getShortName()
90+
title: $class->getShortName(),
9291
);
9392
}
9493

@@ -129,8 +128,8 @@ protected function generateProperty(PropertyInterface $property): ?Property
129128
$options = [];
130129
if ($property->isCollection()) {
131130
$options = \array_map(
132-
static fn (TypeInterface $type) => $type->getName(),
133-
$property->getCollectionValueTypes()
131+
static fn(TypeInterface $type) => $type->getName(),
132+
$property->getCollectionValueTypes(),
134133
);
135134
}
136135

src/GeneratorInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Spiral\JsonSchemaGenerator;
46

57
interface GeneratorInterface

0 commit comments

Comments
 (0)