diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8f0de65 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[docker-compose.yml] +indent_size = 4 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..782c426 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,20 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'esnext', + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + }, + settings: { + react: { + version: 'detect', + }, + }, + extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint', 'plugin:prettier/recommended'], + rules: { + // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs + // e.g. "@typescript-eslint/explicit-function-return-type": "off", + }, +}; diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..da7c3a5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Path-based git attributes +# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html + +# Ignore all test and documentation with "export-ignore". +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore +/art export-ignore +/docs export-ignore +/tests export-ignore +/.editorconfig export-ignore +/.php_cs.dist.php export-ignore +/phpstan* export-ignore +/CHANGELOG.md export-ignore +/CONTRIBUTING.md export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d197a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +vendor +composer.lock +.idea/ +.DS_Store +.phpunit.result.cache +node_modules/ +images/ +packages/* +build +.idea +.phpunit.cache +.phpunit.result.cache +.php-cs-fixer.cache diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..364905f --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,2 @@ +parameters: + ignoreErrors: diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..788c98d --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,14 @@ +includes: + - ./vendor/larastan/larastan/extension.neon + - phpstan-baseline.neon + +parameters: + level: 9 + paths: + - src + - config + tmpDir: build/phpstan + checkOctaneCompatibility: true + + ignoreErrors: + - '#Unsafe usage of new static#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..83fb5d5 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + src/ + + + + + tests + + + diff --git a/src/InvoicesServiceProvider.php b/src/InvoicesServiceProvider.php index 8f9077e..dd647b5 100644 --- a/src/InvoicesServiceProvider.php +++ b/src/InvoicesServiceProvider.php @@ -4,9 +4,10 @@ namespace SolumDeSignum\Invoices; +use Illuminate\Contracts\Support\DeferrableProvider; use Illuminate\Support\ServiceProvider; -class InvoicesServiceProvider extends ServiceProvider +class InvoicesServiceProvider extends ServiceProvider implements DeferrableProvider { /** * Perform post-registration booting of services. @@ -39,12 +40,19 @@ public function register(): void ); // Register the service the package provides. - $this->app->singleton( - 'package-translator-loader', - function ($app) { - return new Invoices($app); - } - ); + $this->app->singleton('invoices', function ($app) { + return new Invoices($app); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides(): array + { + return ['invoices']; } /** @@ -59,14 +67,4 @@ protected function bootForConsole(): void __DIR__ . '/../config/invoices.php' => config_path('invoices.php'), ], 'invoices'); } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides(): array - { - return ['invoices']; - } }