Skip to content

Commit

Permalink
Remove PHP version comparison if statements (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
nimah79 authored Jan 6, 2024
1 parent 899b05e commit fce42df
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 fce42df

Please sign in to comment.