Skip to content

Commit

Permalink
Update return type and adjust the imports and namespace
Browse files Browse the repository at this point in the history
The commit updates the return type of filter methods in `Contacts.php` and `Invoices.php` from `static` to explicit class names, for better clarity and stability. It also changes some uses of fully qualified class names in `XeroAuthenticated.php` and `XeroShowAllCommand.php` to uses of `use` statements for better readability. Unnecessary namespace in `XeroShowAllCommand.php` was removed.
  • Loading branch information
dcblogdev committed Jun 19, 2024
1 parent 393d644 commit 992f3b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/Console/Commands/XeroShowAllCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Console\Commands;
namespace Dcblogdev\Xero\Console\Commands;

use Illuminate\Console\Command;
use Dcblogdev\Xero\Models\XeroToken;
Expand Down Expand Up @@ -45,7 +45,6 @@ public function handle()
$access_token = Crypt::decryptString($token->access_token);
} catch (DecryptException $e) {
$access_token = $token->access_token;
$refresh_token = $token->refresh_token;
}

// Split them as a refresh token may not exist...
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Contacts extends Xero
{
protected array $queryString = [];

public function filter($key, $value): static
public function filter($key, $value): Contacts
{
if (! FilterOptions::isValid($key)) {
throw new InvalidArgumentException("Filter option '$key' is not valid.");
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Invoices extends Xero
{
protected array $queryString = [];

public function filter($key, $value): static
public function filter($key, $value): Invoices
{
if (! FilterOptions::isValid($key)) {
throw new InvalidArgumentException("Filter option '$key' is not valid.");
Expand Down
10 changes: 6 additions & 4 deletions src/XeroAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@

use Closure;
use Dcblogdev\Xero\Facades\Xero;
use Exception;
use \Illuminate\Http\Request;

class XeroAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param Request $request
* @param Closure $next
* @return mixed
* @throws \Exception
* @throws Exception
*/
public function handle($request, Closure $next): mixed
public function handle(Request $request, Closure $next)
{
if (! Xero::isConnected()) {
return Xero::connect();
Expand Down

0 comments on commit 992f3b5

Please sign in to comment.