-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19b13ed
commit 1163539
Showing
48 changed files
with
2,310 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ export enum PhpVersion { | |
PHP80 = 'PHP 8.0', | ||
PHP81 = 'PHP 8.1', | ||
PHP82 = 'PHP 8.2', | ||
PHP83 = 'PHP 8.3', | ||
} |
57 changes: 57 additions & 0 deletions
57
tests/converter/fixtures/results/all_types_json_php_8_3_with_constructor.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
class RootObject | ||
{ | ||
/** @var string[] */ | ||
public array $stringArray; | ||
/** @var (string|int|null)[] */ | ||
public array $mixedArray; | ||
public array $nullArray; | ||
public array $unknownArray; | ||
public bool $boolean; | ||
public float $float; | ||
public int $int; | ||
public null $null; | ||
public NestedClass $nestedClass; | ||
public string $string; | ||
|
||
/** | ||
* @param string[] $stringArray | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function __construct( | ||
array $stringArray, | ||
array $mixedArray, | ||
array $nullArray, | ||
array $unknownArray, | ||
bool $boolean, | ||
float $float, | ||
int $int, | ||
null $null, | ||
NestedClass $nestedClass, | ||
string $string | ||
) { | ||
$this->stringArray = $stringArray; | ||
$this->mixedArray = $mixedArray; | ||
$this->nullArray = $nullArray; | ||
$this->unknownArray = $unknownArray; | ||
$this->boolean = $boolean; | ||
$this->float = $float; | ||
$this->int = $int; | ||
$this->null = $null; | ||
$this->nestedClass = $nestedClass; | ||
$this->string = $string; | ||
} | ||
} | ||
|
||
<?php | ||
|
||
class NestedClass | ||
{ | ||
public int $var; | ||
|
||
public function __construct(int $var) | ||
{ | ||
$this->var = $var; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...rter/fixtures/results/all_types_json_php_8_3_with_constructor_and_readonly_properties.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
class RootObject | ||
{ | ||
/** @var string[] */ | ||
public readonly array $stringArray; | ||
/** @var (string|int|null)[] */ | ||
public readonly array $mixedArray; | ||
public readonly array $nullArray; | ||
public readonly array $unknownArray; | ||
public readonly bool $boolean; | ||
public readonly float $float; | ||
public readonly int $int; | ||
public readonly null $null; | ||
public readonly NestedClass $nestedClass; | ||
public readonly string $string; | ||
|
||
/** | ||
* @param string[] $stringArray | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function __construct( | ||
array $stringArray, | ||
array $mixedArray, | ||
array $nullArray, | ||
array $unknownArray, | ||
bool $boolean, | ||
float $float, | ||
int $int, | ||
null $null, | ||
NestedClass $nestedClass, | ||
string $string | ||
) { | ||
$this->stringArray = $stringArray; | ||
$this->mixedArray = $mixedArray; | ||
$this->nullArray = $nullArray; | ||
$this->unknownArray = $unknownArray; | ||
$this->boolean = $boolean; | ||
$this->float = $float; | ||
$this->int = $int; | ||
$this->null = $null; | ||
$this->nestedClass = $nestedClass; | ||
$this->string = $string; | ||
} | ||
} | ||
|
||
<?php | ||
|
||
class NestedClass | ||
{ | ||
public readonly int $var; | ||
|
||
public function __construct(int $var) | ||
{ | ||
$this->var = $var; | ||
} | ||
} |
153 changes: 153 additions & 0 deletions
153
...sults/all_types_json_php_8_3_with_constructor_promoted_properties_getters_and_setters.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
|
||
class RootObject | ||
{ | ||
/** | ||
* @param string[] $stringArray | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function __construct( | ||
public array $stringArray, | ||
public array $mixedArray, | ||
public array $nullArray, | ||
public array $unknownArray, | ||
public bool $boolean, | ||
public float $float, | ||
public int $int, | ||
public null $null, | ||
public NestedClass $nestedClass, | ||
public string $string | ||
) { | ||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
public function getStringArray(): array | ||
{ | ||
return $this->stringArray; | ||
} | ||
|
||
/** | ||
* @return (string|int|null)[] | ||
*/ | ||
public function getMixedArray(): array | ||
{ | ||
return $this->mixedArray; | ||
} | ||
|
||
public function getNullArray(): array | ||
{ | ||
return $this->nullArray; | ||
} | ||
|
||
public function getUnknownArray(): array | ||
{ | ||
return $this->unknownArray; | ||
} | ||
|
||
public function getBoolean(): bool | ||
{ | ||
return $this->boolean; | ||
} | ||
|
||
public function getFloat(): float | ||
{ | ||
return $this->float; | ||
} | ||
|
||
public function getInt(): int | ||
{ | ||
return $this->int; | ||
} | ||
|
||
public function getNull(): null | ||
{ | ||
return $this->null; | ||
} | ||
|
||
public function getNestedClass(): NestedClass | ||
{ | ||
return $this->nestedClass; | ||
} | ||
|
||
public function getString(): string | ||
{ | ||
return $this->string; | ||
} | ||
|
||
/** | ||
* @param string[] $stringArray | ||
*/ | ||
public function setStringArray(array $stringArray): void | ||
{ | ||
$this->stringArray = $stringArray; | ||
} | ||
|
||
/** | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function setMixedArray(array $mixedArray): void | ||
{ | ||
$this->mixedArray = $mixedArray; | ||
} | ||
|
||
public function setNullArray(array $nullArray): void | ||
{ | ||
$this->nullArray = $nullArray; | ||
} | ||
|
||
public function setUnknownArray(array $unknownArray): void | ||
{ | ||
$this->unknownArray = $unknownArray; | ||
} | ||
|
||
public function setBoolean(bool $boolean): void | ||
{ | ||
$this->boolean = $boolean; | ||
} | ||
|
||
public function setFloat(float $float): void | ||
{ | ||
$this->float = $float; | ||
} | ||
|
||
public function setInt(int $int): void | ||
{ | ||
$this->int = $int; | ||
} | ||
|
||
public function setNull(null $null): void | ||
{ | ||
$this->null = $null; | ||
} | ||
|
||
public function setNestedClass(NestedClass $nestedClass): void | ||
{ | ||
$this->nestedClass = $nestedClass; | ||
} | ||
|
||
public function setString(string $string): void | ||
{ | ||
$this->string = $string; | ||
} | ||
} | ||
|
||
<?php | ||
|
||
class NestedClass | ||
{ | ||
public function __construct(public int $var) | ||
{ | ||
} | ||
|
||
public function getVar(): int | ||
{ | ||
return $this->var; | ||
} | ||
|
||
public function setVar(int $var): void | ||
{ | ||
$this->var = $var; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...s/all_types_json_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
class RootObject | ||
{ | ||
/** | ||
* @param string[] $stringArray | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function __construct( | ||
public readonly array $stringArray, | ||
public readonly array $mixedArray, | ||
public readonly array $nullArray, | ||
public readonly array $unknownArray, | ||
public readonly bool $boolean, | ||
public readonly float $float, | ||
public readonly int $int, | ||
public readonly null $null, | ||
public readonly NestedClass $nestedClass, | ||
public readonly string $string | ||
) { | ||
} | ||
} | ||
|
||
<?php | ||
|
||
class NestedClass | ||
{ | ||
public function __construct(public readonly int $var) | ||
{ | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
class RootObject | ||
{ | ||
/** | ||
* @param string[] $stringArray | ||
* @param (string|int|null)[] $mixedArray | ||
*/ | ||
public function __construct( | ||
public readonly array $stringArray, | ||
public readonly array $mixedArray, | ||
public readonly array $nullArray, | ||
public readonly array $unknownArray, | ||
public readonly bool $boolean, | ||
public readonly float $float, | ||
public readonly int $int, | ||
public readonly null $null, | ||
public readonly NestedClass $nestedClass, | ||
public readonly string $string | ||
) { | ||
} | ||
|
||
public static function fromJson(array $data): self | ||
{ | ||
return new self( | ||
$data['string_array'], | ||
$data['mixed_array'], | ||
$data['null_array'], | ||
$data['unknown_array'], | ||
$data['boolean'], | ||
$data['float'], | ||
$data['int'], | ||
$data['null'] ?? null, | ||
NestedClass::fromJson($data['nested_class']), | ||
$data['string'] | ||
); | ||
} | ||
} | ||
|
||
<?php | ||
|
||
class NestedClass | ||
{ | ||
public function __construct(public readonly int $var) | ||
{ | ||
} | ||
|
||
public static function fromJson(array $data): self | ||
{ | ||
return new self( | ||
$data['var'] | ||
); | ||
} | ||
} |
Oops, something went wrong.