From 8d2b01562423a49ee791d318815f52687ac57180 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 24 Sep 2023 14:56:44 +0000 Subject: [PATCH] rector fixes --- Controller/ApiController.php | 4 +--- Models/EmployeeEducationHistory.php | 2 +- Models/EmployeeHistory.php | 2 +- Models/EmployeeWorkHistory.php | 2 +- tests/Bootstrap.php | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 8f30402..4b1146e 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -202,9 +202,7 @@ final class ApiController extends Controller $profile = new Profile($account); $profile->birthday = new \DateTime($request->getDataString('birthday') ?? 'now'); - $employee = new Employee($profile); - - return $employee; + return new Employee($profile); } /** diff --git a/Models/EmployeeEducationHistory.php b/Models/EmployeeEducationHistory.php index 9d5b763..b06209c 100755 --- a/Models/EmployeeEducationHistory.php +++ b/Models/EmployeeEducationHistory.php @@ -141,7 +141,7 @@ class EmployeeEducationHistory implements \JsonSerializable { return [ 'id' => $this->id, - 'employee' => !\is_int($this->employee) ? $this->employee->id : $this->employee, + 'employee' => \is_int($this->employee) ? $this->employee : $this->employee->id, 'educationTitle' => $this->educationTitle, 'passed' => $this->passed, 'score' => $this->score, diff --git a/Models/EmployeeHistory.php b/Models/EmployeeHistory.php index 19217ca..13dc0c4 100755 --- a/Models/EmployeeHistory.php +++ b/Models/EmployeeHistory.php @@ -164,7 +164,7 @@ class EmployeeHistory implements \JsonSerializable { return [ 'id' => $this->id, - 'employee' => !\is_int($this->employee) ? $this->employee->id : $this->employee, + 'employee' => \is_int($this->employee) ? $this->employee : $this->employee->id, 'unit' => $this->unit, 'department' => $this->department, 'position' => $this->position, diff --git a/Models/EmployeeWorkHistory.php b/Models/EmployeeWorkHistory.php index c29cffd..3d02a43 100755 --- a/Models/EmployeeWorkHistory.php +++ b/Models/EmployeeWorkHistory.php @@ -137,7 +137,7 @@ class EmployeeWorkHistory implements \JsonSerializable { return [ 'id' => $this->id, - 'employee' => !\is_int($this->employee) ? $this->employee->id : $this->employee, + 'employee' => \is_int($this->employee) ? $this->employee : $this->employee->id, 'jobTitle' => $this->jobTitle, 'start' => $this->start, 'end' => $this->end, diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index b904f0c..44438e2 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -381,7 +381,7 @@ function phpServe() : void // Execute the command and store the process ID $output = []; - echo \sprintf('Starting server...') . \PHP_EOL; + echo 'Starting server...' . \PHP_EOL; echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL; echo \sprintf(' %s', $command); \exec($command, $output); @@ -406,7 +406,7 @@ function phpServe() : void // Kill the web server when the process ends \register_shutdown_function(function() use ($killCommand, $pid) : void { - echo \PHP_EOL . \sprintf('Stopping server...') . \PHP_EOL; + echo \PHP_EOL . 'Stopping server...' . \PHP_EOL; echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL; \exec($killCommand . $pid); });