Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/schema
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use ApiPlatform\SchemaGenerator\Command\DumpConfigurationCommand;
use ApiPlatform\SchemaGenerator\Command\GenerateCommand;

$application = new Application();
$application->add(new ExtractCardinalitiesCommand());
$application->add(new DumpConfigurationCommand());
$application->add(new GenerateCommand());
$application->addCommand(new ExtractCardinalitiesCommand());
$application->addCommand(new DumpConfigurationCommand());
$application->addCommand(new GenerateCommand());
$application->run();
3 changes: 0 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,3 @@ parameters:
}
'''
inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
# False positive
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)\.#'
2 changes: 2 additions & 0 deletions src/AttributeGenerator/ApiPlatformCoreAttributeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ private static function extractParameters(string $type, array $values): array
],
[]
);

// @phpstan-ignore-next-line
if (isset(self::$parameterTypes[$type])) {
$types = self::$parameterTypes[$type];
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$configuration = $this->processConfiguration($configContent, $outputDir, $dir === $defaultOutput ? $this->namespacePrefix : null);

(new SchemaGenerator())->generate($configuration, $output, $io);
(new OpenApiGenerator())->generate($configuration, $configArgument ?? self::DEFAULT_CONFIG_FILE, $output, $io);
(new OpenApiGenerator())->generate($configuration, $configArgument ?? self::DEFAULT_CONFIG_FILE, $output, $io); // @phpstan-ignore-line

return Command::SUCCESS;
}

/**
* @return Configuration
* @return array<string, mixed>
*/
private function processConfiguration(string $configContent, string $outputDir, ?string $defaultNamespacePrefix): array
{
Expand All @@ -146,7 +146,6 @@ private function processConfiguration(string $configContent, string $outputDir,

$processor = new Processor();
$configuration = new SchemaGeneratorConfiguration($defaultNamespacePrefix);
/** @var Configuration $processedConfiguration */
$processedConfiguration = $processor->processConfiguration($configuration, [$config]);
$processedConfiguration['output'] = $outputDir;
if (!$processedConfiguration['output']) {
Expand Down
8 changes: 4 additions & 4 deletions src/OpenApi/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
final class Generator
{
/**
* @param Configuration $configuration
* @param array<string, mixed> $configuration
*/
public function generate(array $configuration, string $configurationPath, OutputInterface $output, SymfonyStyle $io): void
{
Expand All @@ -51,12 +51,12 @@ public function generate(array $configuration, string $configurationPath, Output

$classGenerator = new ClassGenerator($inflector, new PhpTypeConverter());
$classGenerator->setLogger($logger);
$classes = $classGenerator->generate($openApi, $configuration);
$classes = $classGenerator->generate($openApi, $configuration); // @phpstan-ignore-line

$twig = (new TwigBuilder())->build($configuration);
$twig = (new TwigBuilder())->build($configuration); // @phpstan-ignore-line

$filesGenerator = new FilesGenerator($inflector, new Printer(), $twig, $io);
$filesGenerator->setLogger($logger);
$filesGenerator->generate($classes, $configuration);
$filesGenerator->generate($classes, $configuration); // @phpstan-ignore-line
}
}
8 changes: 4 additions & 4 deletions src/Schema/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
final class Generator
{
/**
* @param Configuration $configuration
* @param array<string, mixed> $configuration
*/
public function generate(array $configuration, OutputInterface $output, SymfonyStyle $io): void
{
Expand Down Expand Up @@ -66,12 +66,12 @@ public function generate(array $configuration, OutputInterface $output, SymfonyS
);
$entitiesGenerator->setLogger($logger);

$classes = $entitiesGenerator->generate($graphs, $configuration);
$classes = $entitiesGenerator->generate($graphs, $configuration); // @phpstan-ignore-line

$twig = (new TwigBuilder())->build($configuration);
$twig = (new TwigBuilder())->build($configuration); // @phpstan-ignore-line

$filesGenerator = new FilesGenerator($inflector, new Printer(), $twig, $io);
$filesGenerator->setLogger($logger);
$filesGenerator->generate($classes, $configuration);
$filesGenerator->generate($classes, $configuration); // @phpstan-ignore-line
}
}
1 change: 0 additions & 1 deletion src/SchemaGeneratorConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function getConfigTreeBuilder(): TreeBuilder
array_keys($nodeConfig)
);

// @phpstan-ignore-next-line node is not null
$attributesNode = static fn () => (new NodeBuilder())
->arrayNode('attributes')
->info('Attributes (merged with generated attributes)')
Expand Down
1 change: 1 addition & 0 deletions src/TypesGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public function generate(array $graphs, array $config): array
?? ($class->hasChild && !$class->isReferencedBy);

// When including all properties, ignore properties already set on parent
// @phpstan-ignore-next-line
if (($config['types'][$class->name()]['allProperties'] ?? true) && isset($classes[$class->parent()])) {
$type = $class->resource();
foreach ($propertiesMap[$type->getUri()] as $property) {
Expand Down