Skip to content

Commit

Permalink
Apply some rector code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Feb 20, 2025
1 parent 222a90b commit e1aa219
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/Internal/GenericExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ public function exportArray(array $array, array $path, array $parentIds) : array
$exported = $this->export($value, $newPath, $parentIds);

if ($inline) {
if ($isList) {
$result[] = $exported[0];
} else {
$result[] = var_export($key, true) . ' => ' . $exported[0];
}
$result[] = $isList ? $exported[0] : var_export($key, true) . ' => ' . $exported[0];
} else {
$prepend = '';
$append = '';
Expand Down
3 changes: 1 addition & 2 deletions src/Internal/ObjectExporter/SetStateExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public function export(object $object, \ReflectionObject $reflectionObject, arra
$vars = $this->getObjectVars($object, $path);

$exportedVars = $this->exporter->exportArray($vars, $path, $parentIds);
$exportedVars = $this->exporter->wrap($exportedVars, '\\' . $className . '::__set_state(', ')');

return $exportedVars;
return $this->exporter->wrap($exportedVars, '\\' . $className . '::__set_state(', ')');
}

/**
Expand Down
6 changes: 2 additions & 4 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public function assertExportEquals(string $expected, mixed $var, int $options =
// if the exported value is a closure with no parameters, test that the exported closure returns the same
// value as the original closure

if ($var instanceof \Closure) {
if ((new \ReflectionFunction($var))->getNumberOfRequiredParameters() === 0) {
$this->assertSame($var(), ($exportedVar()), 'The exported closure does not return the same value as the original closure.');
}
if ($var instanceof \Closure && (new \ReflectionFunction($var))->getNumberOfRequiredParameters() === 0) {
$this->assertSame($var(), ($exportedVar()), 'The exported closure does not return the same value as the original closure.');
}
}

Expand Down

0 comments on commit e1aa219

Please sign in to comment.