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
8 changes: 4 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
build:
strategy:
matrix:
php-versions: ['8.2', '8.3']
symfony-versions: ['~5.4', '~6.4', '~7.0']
php-versions: ['8.5']
symfony-versions: ['~6.4', '~7.4']
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
# Unit tests need to run before the type checker, because they generate code
# that the type checker needs to see.
- name: Run type checker (psalm)
run: ./vendor/bin/psalm --php-version=8.2
run: ./vendor/bin/psalm --php-version=8.5

- name: Run type checker (PHPStan)
run: ./vendor/bin/phpstan analyze
run: ./vendor/bin/phpstan analyze --memory-limit=1G
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ echo "Hello, " . $user->getGivenName() . "\n";

## Compatibility

This tool requires PHP 8.2 or newer to run.
This tool requires PHP 8.5 or newer to run.

The generated code can be backwards-compatible up until PHP 5.6. Use the `--target-php` flag to set the desired PHP version that the generated code should be compatible with. When [using a configuration file](#using-configuration-files), use the `targetPHPVersion` property.

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
}
],
"require": {
"php": "^8.2",
"symfony/console": "~3.0|~4.0|~5.0|~6.0|~7.0",
"symfony/yaml": "~3.0|~4.0|~5.0|~6.0|~7.0",
"php": "^8.5",
"symfony/console": "~6.4|~7.4",
"symfony/yaml": "~6.4|~7.4",
"justinrainbow/json-schema": "^6.0",
"ext-json": "*",
"composer/semver": "^3.0",
Expand All @@ -33,7 +33,7 @@
],
"require-dev": {
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "^5.26",
"vimeo/psalm": "^6.14.3",
"phpstan/phpstan": "^2.1.2",
"phpspec/prophecy": "^1.17",
"phpspec/prophecy-phpunit": "^2.0"
Expand Down
20 changes: 4 additions & 16 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
allowStringToStandInForClass="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down Expand Up @@ -39,28 +40,15 @@

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info">
<errorLevel type="suppress">
<directory name="src/Example"/>
<directory name="src/Spec"/>
</errorLevel>
</MissingClosureParamType>
<MissingParamType errorLevel="info" />

<RedundantCondition errorLevel="info" />

<DocblockTypeContradiction errorLevel="info">
<errorLevel type="suppress">
<directory name="src/Example"/>
<directory name="src/Spec"/>
</errorLevel>
</DocblockTypeContradiction>
<RedundantConditionGivenDocblockType errorLevel="info">
<ClassMustBeFinal errorLevel="info">
<errorLevel type="suppress">
<directory name="src/Example"/>
<directory name="src/Spec"/>
<directory name="src"/>
</errorLevel>
</RedundantConditionGivenDocblockType>
</ClassMustBeFinal>

<UnresolvableInclude errorLevel="info" />

Expand Down
261 changes: 0 additions & 261 deletions src/Codegen/PropertyGenerator.php

This file was deleted.

12 changes: 11 additions & 1 deletion src/Command/GenerateSpecCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
declare(strict_types = 1);
namespace Helmich\Schema2Class\Command;

use Exception;
use Helmich\Schema2Class\Generator\GeneratorException;
use Helmich\Schema2Class\Generator\GeneratorRequest;
use Helmich\Schema2Class\Generator\NamespaceInferrer;
Expand Down Expand Up @@ -56,14 +57,23 @@ protected function configure(): void
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$workingDir = getcwd();
if ($workingDir === false) {
throw new GeneratorException("cannot determine current working directory");
}

/** @var string $specFile */
$specFile = $input->getArgument("specfile") ?: getcwd() . "/.s2c.yaml";
$specFile = $input->getArgument("specfile") ?: $workingDir . DIRECTORY_SEPARATOR . ".s2c.yaml";

if (!file_exists($specFile)) {
throw new LoadingException($specFile, "specification file not found");
}

$contents = file_get_contents($specFile);
if ($contents === false) {
throw new LoadingException($specFile, "cannot read specification file");
}

$parsed = Yaml::parse($contents);
$specification = Specification::buildFromInput($parsed);

Expand Down
Loading