Skip to content

Commit

Permalink
Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-de-wit committed Jan 24, 2025
1 parent 561bc56 commit 49c5288
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 132 deletions.
13 changes: 9 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/docker export-ignore
/tests export-ignore
/.coveralls.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/docker-compose.yml export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/pint.json export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/run-fix-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: composer fix-style
commit_message: composer pint
64 changes: 0 additions & 64 deletions .php_cs.common.php

This file was deleted.

14 changes: 0 additions & 14 deletions .php_cs.dist

This file was deleted.

22 changes: 0 additions & 22 deletions .php_cs.tests.php

This file was deleted.

12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
setup:
@test -s phpunit.xml || cp phpunit.xml.dist phpunit.xml
@docker-compose run --rm app composer install

destroy:
@docker-compose down --remove-orphans --volumes

app:
@docker-compose run --rm app sh

test:
@docker-compose run --rm app sh -c "php ./vendor/bin/phpunit"
26 changes: 12 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
"illuminate/database": "^9.0 || ^10.0 || ^11.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"nunomaduro/larastan": "^0.7.2",
"orchestra/testbench": "^6.7",
"phpstan/phpstan-mockery": "^0.12.13",
"phpstan/phpstan-phpunit": "^0.12.18",
"larastan/larastan": "^2.9",
"laravel/pint": "^1.20",
"orchestra/testbench": "^7.11",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.2",
"phpunit/phpunit": "^9.5",
"thecodingmachine/phpstan-safe-rule": "^1.0"
"thecodingmachine/phpstan-safe-rule": "^1.0",
"rector/rector": "^0.14.8"
},
"autoload": {
"psr-4": {
Expand All @@ -52,16 +53,13 @@
}
},
"scripts": {
"analyze": "vendor/phpstan/phpstan/phpstan analyse",
"check-style": [
"php-cs-fixer fix --diff --diff-format=udiff --dry-run",
"php-cs-fixer fix --diff --diff-format=udiff --dry-run --config=.php_cs.tests.php"
"post-autoload-dump": [
"@php ./vendor/bin/testbench package:discover --ansi"
],
"coverage": "vendor/bin/phpunit",
"fix-style": [
"php-cs-fixer fix",
"php-cs-fixer fix --config=.php_cs.tests.php"
],
"phpstan": "vendor/bin/phpstan analyse",
"pint": "vendor/bin/pint",
"rector": "vendor/bin/rector",
"test": "vendor/bin/phpunit --no-coverage"
}
}
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
app:
build: docker
volumes:
- .:/var/www/html
20 changes: 20 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM php:8.1-cli-alpine

WORKDIR /var/www/html

COPY --from=composer /usr/bin/composer /usr/bin/composer

RUN apk add --no-cache \
icu-libs \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& pecl install \
pcov \
&& docker-php-ext-enable \
pcov \
&& apk del .build-deps

COPY conf.d /usr/local/etc/php/conf.d
1 change: 1 addition & 0 deletions docker/conf.d/memory-limit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = -1
18 changes: 9 additions & 9 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
- vendor/nunomaduro/larastan/extension.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
parameters:
level: max
paths:
- src
- tests
level: max
paths:
- src
- tests
9 changes: 9 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"preset": "laravel",
"rules": {
"declare_strict_types": true,
"binary_operator_spaces": {
"default": "align_single_space_minimal"
}
}
}
38 changes: 34 additions & 4 deletions src/Providers/LaravelIdeHelperHookTranslatableServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
<?php

declare(strict_types=1);

namespace DanielDeWit\LaravelIdeHelperHookTranslatable\Providers;

use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
use DanielDeWit\LaravelIdeHelperHookTranslatable\Hooks\TranslatableHook;
use Illuminate\Console\Command;
use Illuminate\Contracts\Config\Repository as Config;
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\ServiceProvider;

class LaravelIdeHelperHookTranslatableServiceProvider extends ServiceProvider
class LaravelIdeHelperHookTranslatableServiceProvider extends ServiceProvider implements DeferrableProvider
{
/**
* @var string
*/
const ModelsCommandAlias = 'laravel-ide-helper-hook-translatable-command-alias';

/**
* @return list<class-string<Command>|string>
*/
public function provides(): array
{
return [
static::ModelsCommandAlias,
];
}

public function boot(): void
{
// Laravel only allows a single deferred service provider to claim
// responsibility for a given class, interface, or service in the
// provides() method. To ensure this provider is properly loaded
// when running the ModelsCommand we bind an alias and use that instead.
$this->app->alias(ModelsCommand::class, static::ModelsCommandAlias);
}

public function register(): void
{
if ($this->app->isProduction()) {
return;
}
$this->registerIdeHelperHook();
}

protected function registerIdeHelperHook(): void
{
/** @var Config $config */
$config = $this->app->get('config');

Expand Down

0 comments on commit 49c5288

Please sign in to comment.