Skip to content

Commit

Permalink
fix: remove extra \ character in nullable object property types.
Browse files Browse the repository at this point in the history
  • Loading branch information
osmianski committed Oct 28, 2021
1 parent 29ef1cf commit cd5c088
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions runtime/Compilation/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ protected function get_serialized_class_name(): string {
protected function parsePhpDocType(string $phpDocType): void {
foreach (explode('|', $phpDocType) as $type) {
$type = trim($type);
$type = ltrim($type, '\\');

if (!$type || $type == 'mixed') {
continue;
}

if (str_starts_with($type, '?')) {
$this->nullable = true;
$type = substr($type, strlen('?'));
}

$type = ltrim($type, '\\');

if (!$type || $type == 'mixed') {
continue;
}

if ($type == 'array') {
$this->array = true;
continue;
Expand Down
2 changes: 1 addition & 1 deletion samples/AfterSome/Traits/DynamicTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @property int $width
* @property int $area_size
* @property bool $round_pi
* @property App $app
* @property ?App $app
*/
#[UseIn(Some::class)]
trait DynamicTrait
Expand Down

0 comments on commit cd5c088

Please sign in to comment.