Skip to content

Commit

Permalink
8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
railken committed Mar 27, 2024
1 parent 869cde1 commit 8b39d11
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: 7.2
php-version: 8.3
extension-csv: mbstring, dom, fileinfo, mysql, zip
coverage: xdebug #optional
- name: Get composer cache directory
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: 8.3
extension-csv: mbstring, dom, fileinfo, mysql, zip
coverage: xdebug #optional
- name: Install Composer dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
Expand All @@ -23,7 +28,6 @@ jobs:
export PATH="$HOME/.composer/vendor/bin:$PATH"
./vendor/bin/php-cs-fixer fix src
./vendor/bin/php-cs-fixer fix tests
composer remove --dev friendsofphp/php-cs-fixer
- uses: stefanzweifel/git-auto-commit-action@v2.1.0
with:
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4']
laravel: ['5.8.*', '6.*', '7.*', '8.*']
exclude:
- php: '7.2'
laravel: '8.*'
php: ['8.2', '8.3']
laravel: ['9.*', '10.*']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
vendor/
var/cache
\.php_cs\.cache
build/
\.env
composer\.lock
phpunit.xml

.phpunit.result.cache
phpunit.xml
.php-cs-fixer.cache
.phpunit.cache/test-results
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ This is the core of all Amethyst packages.

# Requirements

- PHP from 7.2 to 7.4
- Laravel from 5.8 to 8.x
- PHP from 8.1

## Installation

Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"keywords": ["laravel"],
"license": "MIT",
"require": {
"php": ">=7.2",
"railken/bag": "^1.2",
"railken/eloquent-mapper": "0.3.*",
"laravel/framework": "5.8.*|6.*|7.*|8.*",
"php": ">=8.1",
"railken/bag": "^2.0",
"railken/eloquent-mapper": "0.4.*",
"laravel/framework": "9.* | 10.*",
"league/fractal": "^0.17.0",
"railken/lem": "^3.3",
"railken/cacheable": "0.1.*",
"doctrine/inflector": "^1.3",
"railken/eloquent-instance": "^1.0",
"laravel/helpers": "^1.2"
"railken/lem": "^4.0",
"railken/cacheable": "0.2.*",
"railken/eloquent-instance": "^2.0",
"laravel/helpers": "^1.2",
"doctrine/inflector": "^2.0"
},
"require-dev": {
"orchestra/testbench": "*"
Expand All @@ -27,4 +27,4 @@
"Amethyst\\Core\\Tests\\": "tests/"
}
}
}
}
20 changes: 6 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
</php>
Expand Down
4 changes: 2 additions & 2 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Amethyst\Core;

use Amethyst\Core\Exceptions\DataNotFoundException;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -229,7 +229,7 @@ public function findMorphByModel(string $class)
*/
public function tableize($obj): string
{
return str_replace('_', '-', (new Inflector())->tableize((new \ReflectionClass($obj))->getShortName()));
return str_replace('_', '-', (InflectorFactory::create()->build())->tableize((new \ReflectionClass($obj))->getShortName()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/RestManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Amethyst\Core\Http\Controllers;

use Amethyst\Core\Transformers\BaseTransformer;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
Expand Down Expand Up @@ -99,7 +99,7 @@ public function callAction($method, $parameters)
*/
public function getResourceName()
{
return $this->name !== null ? $this->name : str_replace('_', '-', (new Inflector())->tableize($this->getManager()->getName()));
return $this->name !== null ? $this->name : str_replace('_', '-', (InflectorFactory::create()->build())->tableize($this->getManager()->getName()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Providers/CommonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Amethyst\Core\Providers;

use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;

Expand Down Expand Up @@ -123,7 +123,7 @@ public function loadConfigs()
public function getPackageName()
{
$reflection = new \ReflectionClass($this);
$inflector = new Inflector();
$inflector = InflectorFactory::create()->build();

return str_replace('_', '-', $inflector->tableize(str_replace('ServiceProvider', '', $reflection->getShortName())));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Transformers/BaseTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Amethyst\Core\Transformers;

use Amethyst\Core\Contracts\TransformerContract;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
Expand Down Expand Up @@ -55,7 +55,7 @@ class BaseTransformer extends TransformerAbstract implements TransformerContract
public function __construct(ManagerContract $manager, Request $request)
{
$this->manager = $manager;
$this->inflector = new Inflector();
$this->inflector = InflectorFactory::create()->build();
$this->request = $request;

$this->map = app(MapContract::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/BaseTest.php → tests/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;

abstract class BaseTest extends \Orchestra\Testbench\TestCase
abstract class Base extends \Orchestra\Testbench\TestCase
{
/**
* Setup the test environment.
Expand Down
2 changes: 1 addition & 1 deletion tests/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Amethyst\Core\Tests\App\Managers\FooManager;
use Railken\Lem\Support\Testing\TestableBaseTrait;

class BasicTest extends BaseTest
class BasicTest extends Base
{
use TestableBaseTrait;

Expand Down

0 comments on commit 8b39d11

Please sign in to comment.