Skip to content

Commit

Permalink
#126: Fixes CS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Riley committed Aug 31, 2023
1 parent ab9c16d commit 4b6d35b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,15 @@ private function generatePropertyHydrateCall(ObjectProperty $property, string $i

/**
* @return string[]
*
* @psalm-return list<string>
*/
private function generatePropertyExtractCall(ObjectProperty $property): array
{
$propertyName = $property->name;
$assignmentStatement = sprintf(' $values[\'%s\'] = $object->%1$s;', $propertyName);
$requiresGuard = $property->hasType && !($property->hasDefault || $property->allowsNull);
$requiresGuard = $property->hasType && ! ($property->hasDefault || $property->allowsNull);

if (!$requiresGuard) {
if (! $requiresGuard) {
return [$assignmentStatement];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
*/
final class ObjectProperty
{
/** @psalm-var non-empty-string */
public string $name;

/** @psalm-param non-empty-string $name */
private function __construct(string $name, public bool $hasType, public bool $allowsNull, public bool $hasDefault)
private function __construct(public string $name, public bool $hasType, public bool $allowsNull, public bool $hasDefault)
{
$this->name = $name;
}

public static function fromReflection(ReflectionProperty $property): self
Expand Down

0 comments on commit 4b6d35b

Please sign in to comment.