Skip to content

Commit

Permalink
Merge pull request #3 from wire-elements/main
Browse files Browse the repository at this point in the history
Remove PHP version comparison if statements (wire-elements#401)
  • Loading branch information
camerontucker authored Jan 16, 2024
2 parents 4e8ab2c + fce42df commit c79af38
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ public function openModal($component, $arguments = [], $modalAttributes = []): v
$this->dispatch('activeModalComponentChanged', id: $id);
}

public function resolveComponentProps(array $attributes, Component $component)
public function resolveComponentProps(array $attributes, Component $component): Collection
{
if (PHP_VERSION_ID < 70400) {
return;
}

return $this->getPublicPropertyTypes($component)
->intersectByKeys($attributes)
->map(function ($className, $propName) use ($attributes) {
Expand Down Expand Up @@ -101,12 +97,8 @@ protected function resolveParameter($attributes, $parameterName, $parameterClass
return $model;
}

public function getPublicPropertyTypes($component)
public function getPublicPropertyTypes($component): Collection
{
if (PHP_VERSION_ID < 70400) {
return new Collection();
}

return collect($component->all())
->map(function ($value, $name) use ($component) {
return Reflector::getParameterClassName(new \ReflectionProperty($component, $name));
Expand Down

0 comments on commit c79af38

Please sign in to comment.