Skip to content

Commit

Permalink
Optimize PHP CS Fixer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
s-damian committed Aug 8, 2023
1 parent 2a6407f commit d32a57d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"laravel/pint": "^1.0",
"phpunit/phpunit": "9.5.*",
"orchestra/testbench": "^6",
"phpstan/phpstan": "^1.9"
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4" : {
Expand Down
19 changes: 19 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
{
"preset": "laravel",
"rules": {
"explicit_string_variable" : true,
"new_with_braces": {
"anonymous_class": true,
"named_class": true
},
"ordered_class_elements" : {
"order" : [
"use_trait",
"case",
"constant",
"property",
"construct",
"destruct",
"magic",
"phpunit",
"method_abstract",
"method"
]
},
"ordered_traits": true
}
}
8 changes: 4 additions & 4 deletions src/LarasortServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ public function boot(): void
// Blade Directives:

Blade::directive('sortableUrl', function ($expression) {
return "<?php echo \SDamian\Larasort\LarasortLink::getUrl($expression); ?>";
return "<?php echo \SDamian\Larasort\LarasortLink::getUrl({$expression}); ?>";
});

Blade::directive('sortableHref', function ($expression) {
return "<?php echo \SDamian\Larasort\LarasortLink::getHref($expression); ?>";
return "<?php echo \SDamian\Larasort\LarasortLink::getHref({$expression}); ?>";
});

Blade::directive('sortableIcon', function ($expression) {
return "<?php echo \SDamian\Larasort\LarasortLink::getIcon($expression); ?>";
return "<?php echo \SDamian\Larasort\LarasortLink::getIcon({$expression}); ?>";
});

Blade::directive('sortableLink', function ($expression) {
$ex = explode(', ', $expression);
$label = $ex[1] ?? null;

return "<?php echo \SDamian\Larasort\LarasortLink::getLink($ex[0], $label); ?>";
return "<?php echo \SDamian\Larasort\LarasortLink::getLink({$ex[0]}, {$label}); ?>";
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Relations/Related.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ final public function getTableColumnByUrl(): ?string

$ex = explode(config('larasort.relation_column_separator'), request()->orderby);

return $this->getRelatedTable().'.'.$ex[1];
return $this->getRelatedTable().'.'.$ex[1];
}
}

0 comments on commit d32a57d

Please sign in to comment.