Skip to content

Commit

Permalink
Add support for Laravel 11 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Unleashed2k authored Mar 27, 2024
1 parent 8b2ae59 commit 476b7e6
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 345 deletions.
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/php-cs-fixer.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/pint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Fix Styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Fix styling issues
uses: aglipanci/laravel-pint-action@0.1.0

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
19 changes: 10 additions & 9 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
name: Run Tests

on: [push, pull_request, workflow_dispatch]
on: ['push', 'pull_request']

jobs:
phpunit:
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
php: [8.2, 8.1]
laravel: [10.*]
os: [ubuntu-latest]
php: [8.3, 8.2]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 11.*
testbench: 9.*

name: PHP ${{ matrix.php }} – Laravel ${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"guzzlehttp/guzzle": "^7.0",
"illuminate/support": "^10.0"
"illuminate/support": "^11.0"
},
"require-dev": {
"orchestra/testbench": "^8.0",
"nunomaduro/collision": "^7.0",
"orchestra/testbench": "^9.0",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.0"
},
"autoload": {
Expand Down
12 changes: 6 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
6 changes: 0 additions & 6 deletions src/CreateRequestAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class CreateRequestAction
/**
* Execute the pending request and return the response from the Spotify API.
*
* @param PendingRequest $pendingRequest
* @return array
* @throws SpotifyApiException
*/
public function execute(PendingRequest $pendingRequest): array
Expand All @@ -34,10 +32,6 @@ public function execute(PendingRequest $pendingRequest): array

/**
* This merges the requested and accepted parameters and outputs the final parameters ready for the API call.
*
* @param Collection $acceptedParams
* @param Collection $requestedParams
* @return array
*/
private function createFinalParams(Collection $acceptedParams, Collection $requestedParams): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/SpotifyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SpotifyException extends Exception
{
protected $apiResponse;

public function __construct($message = null, $code = 0, $apiResponse = null, Exception $previous = null)
public function __construct($message = null, $code = 0, $apiResponse = null, ?Exception $previous = null)
{
parent::__construct($message, $code, $previous);

Expand Down
3 changes: 0 additions & 3 deletions src/Normalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ class Normalizer
{
/**
* Normalize the provided argument.
*
* @param $argument
* @return string
*/
public static function normalizeArgument($argument): string
{
Expand Down
34 changes: 17 additions & 17 deletions src/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
class PendingRequest
{
public $endpoint;

public $acceptedParams;

public $responseArrayKey;

public $requestedParams;
Expand All @@ -19,11 +21,11 @@ public function __construct(string $endpoint, array $acceptedParams = [])
/**
* Set the country if provided.
*
* @param string $country
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function country(string $country = null): self
public function country(?string $country = null): self
{
$this->setRequestedParam('country', $country);

Expand All @@ -33,8 +35,8 @@ public function country(string $country = null): self
/**
* Set the fields if provided.
*
* @param string $fields
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function fields(string $fields): self
Expand All @@ -47,8 +49,8 @@ public function fields(string $fields): self
/**
* Set include_external if provided.
*
* @param string $value
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function includeExternal(string $value): self
Expand All @@ -61,8 +63,8 @@ public function includeExternal(string $value): self
/**
* Set include_groups if provided.
*
* @param string $value
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function includeGroups(string $value): self
Expand All @@ -75,8 +77,8 @@ public function includeGroups(string $value): self
/**
* Set the limit if provided.
*
* @param int $limit
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function limit(int $limit): self
Expand All @@ -89,8 +91,8 @@ public function limit(int $limit): self
/**
* Set the offset if provided.
*
* @param int $offset
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function offset(int $offset): self
Expand All @@ -103,11 +105,11 @@ public function offset(int $offset): self
/**
* Set the market if provided.
*
* @param string|null $market
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function market(string $market = null): self
public function market(?string $market = null): self
{
$this->setRequestedParam('market', $market);

Expand All @@ -117,11 +119,11 @@ public function market(string $market = null): self
/**
* Set the locale if provided.
*
* @param string|null $locale
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function locale(string $locale = null): self
public function locale(?string $locale = null): self
{
$this->setRequestedParam('locale', $locale);

Expand All @@ -131,8 +133,8 @@ public function locale(string $locale = null): self
/**
* Set the timestamp if provided.
*
* @param string $timestamp
* @return $this
*
* @throws Exceptions\ValidatorException
*/
public function timestamp(string $timestamp): self
Expand All @@ -145,8 +147,8 @@ public function timestamp(string $timestamp): self
/**
* Add the requested parameters to an array.
*
* @param string $requestedParam
* @param int|string|null $value
* @param int|string|null $value
*
* @throws Exceptions\ValidatorException
*/
private function setRequestedParam(string $requestedParam, $value): void
Expand All @@ -159,11 +161,9 @@ private function setRequestedParam(string $requestedParam, $value): void
/**
* Execute the request. This is the final method and has to be called at the end of the method chain.
*
* @param string|null $responseArrayKey
* @return array
* @throws Exceptions\SpotifyApiException
*/
public function get(string $responseArrayKey = null): array
public function get(?string $responseArrayKey = null): array
{
$this->responseArrayKey = $responseArrayKey;

Expand Down
Loading

0 comments on commit 476b7e6

Please sign in to comment.