Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom properties #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
env:
DB_HOST: mysql
run: |
vendor/bin/phpunit
vendor/bin/phpunit tests/Unit

- name: Code sniffer
run: |
vendor/bin/phpcs -s
vendor/bin/php-cs-fixer fix --dry-run --diff
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ vendor
coverage
.phpunit.result.cache
.idea
.php-cs-fixer.cache
143 changes: 143 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?php

return (new PhpCsFixer\Config)
->setFinder(
PhpCsFixer\Finder::create()
->in('./src/')
->in('./config/')
->in('./tests/')
->in('./translations/')
)
->setRules([
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => ['return'],
],
'braces' => true,
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
'trait_import' => 'none',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
],
'concat_space' => [
'spacing' => 'none',
],
'constant_case' => ['case' => 'lower'],
'declare_equal_normalize' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => true, // added by Shift
'function_declaration' => true,
'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true, // added from Symfony
'magic_method_casing' => true, // added from Symfony
'magic_constant_casing' => true,
'method_argument_space' => [
'on_multiline' => 'ignore',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'native_function_casing' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => [
'positions' => ['inside', 'outside'],
],
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'],
],
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => false,
'phpdoc_to_comment' => false, // override to preserve user preference
'phpdoc_tag_type' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'short_scalar_cast' => true,
'simplified_null_return' => false, // disabled as "risky"
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => [
'elements' => ['const', 'property'],
],
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => [
'comment_types' => ['hash'],
],
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => ['method', 'property'],
],
'whitespace_after_comma_in_array' => true,
'method_chaining_indentation' => true,
'no_extra_blank_lines' => ['tokens' => ['extra', 'curly_brace_block']],
'no_superfluous_phpdoc_tags' => true,
'phpdoc_order' => true,
'phpdoc_types_order' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'parameters']],
]);
32 changes: 0 additions & 32 deletions .phpcs.xml

This file was deleted.

9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@
}
],
"require": {
"php": "^7.4|^8.0|^8.1",
"illuminate/support": "^8.0|^9.0",
"php": "^8.0|^8.1",
"owowagency/laravel-resources": "^3.1",
"spatie/laravel-medialibrary": "^8.0|^9.0|^10.0",
"xantios/mimey": "^2.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.13",
"orchestra/testbench": "^6.2",
"owowagency/phpunit-snapshot-assertions": "^0.0.8",
"phpunit/phpunit": "^8.0|^9.0",
"squizlabs/php_codesniffer": "^3.5"
"phpunit/phpunit": "^8.0|^9.0"
},
"autoload": {
"psr-4": {
Expand All @@ -46,6 +45,8 @@
}
},
"scripts": {
"lint": "php-cs-fixer fix --dry-run --diff",
"lint:fix": "php-cs-fixer fix",
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ networks:

services:
mysql_testing:
image: mysql:5.7
image: mysql/mysql-server:8.0
container_name: lm-mysql-testing
tmpfs: /var/lib/mysql
restart: unless-stopped
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: laravel
MYSQL_USER: laravel
MYSQL_PASSWORD: laravel
MYSQL_ROOT_PASSWORD: laravel
networks:
- laravel-media

Expand Down
5 changes: 3 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_HOST" value="mysql_testing"/>
<env name="DB_DATABASE" value="laravel"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_USERNAME" value="laravel"/>
<env name="DB_PASSWORD" value="laravel"/>
</php>

<testsuites>
z <testsuite name="Unit Tests">
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
Expand Down
2 changes: 0 additions & 2 deletions src/Exceptions/UploadException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class UploadException extends Exception
{
/**
* UploadException constructor.
*
* @param string $type
*/
public function __construct(string $type = 'string')
{
Expand Down
4 changes: 0 additions & 4 deletions src/LaravelMediaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class LaravelMediaServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot(): void
{
Expand All @@ -28,8 +26,6 @@ public function boot(): void

/**
* Register the application services.
*
* @return void
*/
public function register(): void
{
Expand Down
Loading