mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-27 05:19:31 +00:00
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
|
@ -30,12 +30,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class PermissionGroupType extends AbstractType
|
||||
{
|
||||
protected PermissionManager $resolver;
|
||||
protected array $perm_structure;
|
||||
|
||||
public function __construct(PermissionManager $resolver)
|
||||
public function __construct(protected PermissionManager $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
||||
|
|
@ -68,9 +66,7 @@ class PermissionGroupType extends AbstractType
|
|||
{
|
||||
parent::configureOptions($resolver);
|
||||
|
||||
$resolver->setDefault('group_name', static function (Options $options) {
|
||||
return trim($options['name']);
|
||||
});
|
||||
$resolver->setDefault('group_name', static fn(Options $options): string => trim((string) $options['name']));
|
||||
|
||||
$resolver->setDefault('inherit', false);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class PermissionType extends AbstractType
|
||||
{
|
||||
protected PermissionManager $resolver;
|
||||
protected array $perm_structure;
|
||||
|
||||
public function __construct(PermissionManager $resolver)
|
||||
public function __construct(protected PermissionManager $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
||||
|
|
@ -46,9 +44,7 @@ class PermissionType extends AbstractType
|
|||
{
|
||||
parent::configureOptions($resolver);
|
||||
|
||||
$resolver->setDefault('perm_name', static function (Options $options) {
|
||||
return $options['name'];
|
||||
});
|
||||
$resolver->setDefault('perm_name', static fn(Options $options) => $options['name']);
|
||||
|
||||
$resolver->setDefault('label', function (Options $options) {
|
||||
if (!empty($this->perm_structure['perms'][$options['perm_name']]['label'])) {
|
||||
|
|
@ -58,9 +54,7 @@ class PermissionType extends AbstractType
|
|||
return $options['name'];
|
||||
});
|
||||
|
||||
$resolver->setDefault('multi_checkbox', static function (Options $options) {
|
||||
return !$options['disabled'];
|
||||
});
|
||||
$resolver->setDefault('multi_checkbox', static fn(Options $options) => !$options['disabled']);
|
||||
|
||||
$resolver->setDefaults([
|
||||
'inherit' => false,
|
||||
|
|
|
|||
|
|
@ -34,13 +34,8 @@ use Traversable;
|
|||
*/
|
||||
final class PermissionsMapper implements DataMapperInterface
|
||||
{
|
||||
private PermissionManager $resolver;
|
||||
private bool $inherit;
|
||||
|
||||
public function __construct(PermissionManager $resolver, bool $inherit = false)
|
||||
public function __construct(private readonly PermissionManager $resolver, private readonly bool $inherit = false)
|
||||
{
|
||||
$this->inherit = $inherit;
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,12 +33,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class PermissionsType extends AbstractType
|
||||
{
|
||||
protected PermissionManager $resolver;
|
||||
protected array $perm_structure;
|
||||
|
||||
public function __construct(PermissionManager $resolver)
|
||||
public function __construct(protected PermissionManager $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue