Skip to content

Commit

Permalink
style: fix (updated) code style
Browse files Browse the repository at this point in the history
  • Loading branch information
JaZo committed Mar 28, 2024
1 parent dace650 commit 673033b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 27 deletions.
10 changes: 4 additions & 6 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
class Builder
{
/**
* @param string $name The name for this data using dot notation
* @param mixed $data The data
* @param int $options Extra json_encode options
* @param string $name The name for this data using dot notation
* @param mixed $data The data
* @param int $options Extra json_encode options
*
* @throws \InvalidArgumentException
*
* @return string
*/
public function build(string $name, $data, int $options = 0): string
{
Expand All @@ -32,7 +30,7 @@ public function build(string $name, $data, int $options = 0): string
$json = json_encode($data, $options);
}

if (JSON_ERROR_NONE !== json_last_error()) {
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException(json_last_error_msg(), json_last_error());
}

Expand Down
13 changes: 2 additions & 11 deletions src/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class ResponseFactory
*/
private $builder;

/**
* @param \Illuminate\Contracts\Routing\ResponseFactory $responseFactory
* @param \Swis\Laravel\JavaScriptData\Builder $builder
*/
public function __construct(ResponseFactoryContract $responseFactory, Builder $builder)
{
$this->responseFactory = $responseFactory;
Expand All @@ -30,13 +26,8 @@ public function __construct(ResponseFactoryContract $responseFactory, Builder $b
/**
* Return a new JavaScript data response from the application.
*
* @param string $name
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
*
* @return \Illuminate\Http\Response
* @param mixed $data
* @param int $options
*/
public function make(string $name, $data = [], int $status = 200, array $headers = [], $options = 0): Response
{
Expand Down
10 changes: 2 additions & 8 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public function register()

/**
* Response macro for JavaScript data.
*
* @param string $name
*/
protected function registerResponseMacro(string $name)
{
Expand All @@ -39,12 +37,8 @@ protected function registerResponseMacro(string $name)
/**
* Return a new JavaScript data response from the application.
*
* @param string $name
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
*
* @param mixed $data
* @param int $options
* @return \Illuminate\Http\Response
*/
function (string $name, $data = [], int $status = 200, array $headers = [], $options = 0) {
Expand Down
3 changes: 1 addition & 2 deletions stubs/JsonableStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class JsonableStub implements Jsonable
/**
* Convert the object to its JSON representation.
*
* @param int $options
*
* @param int $options
* @return string
*/
public function toJson($options = 0)
Expand Down

0 comments on commit 673033b

Please sign in to comment.