Use short array syntax (#135)
This commit is contained in:
committed by
Kevin Papst
parent
4c6158c1ea
commit
5527f29caf
@@ -344,8 +344,8 @@ class KimaiImporterCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function bytesHumanReadable($size)
|
protected function bytesHumanReadable($size)
|
||||||
{
|
{
|
||||||
$unit=array('b','kB','MB','GB');
|
$unit = ['b', 'kB', 'MB', 'GB'];
|
||||||
return @round($size/pow(1024, ($i=floor(log($size, 1024)))), 2).' '.$unit[$i];
|
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ class ProfileController extends AbstractController
|
|||||||
UserPasswordType::class,
|
UserPasswordType::class,
|
||||||
$user,
|
$user,
|
||||||
[
|
[
|
||||||
'validation_groups' => array('passwordUpdate'),
|
'validation_groups' => ['passwordUpdate'],
|
||||||
'action' => $this->generateUrl('user_profile_password', ['username' => $user->getUsername()]),
|
'action' => $this->generateUrl('user_profile_password', ['username' => $user->getUsername()]),
|
||||||
'method' => 'POST'
|
'method' => 'POST'
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -114,13 +114,13 @@ class DoctrineCompilerPass implements CompilerPassInterface
|
|||||||
$ormConfig = $container->getDefinition('doctrine.orm.default_configuration');
|
$ormConfig = $container->getDefinition('doctrine.orm.default_configuration');
|
||||||
|
|
||||||
foreach ($sql['string_functions'] as $name => $function) {
|
foreach ($sql['string_functions'] as $name => $function) {
|
||||||
$ormConfig->addMethodCall('addCustomStringFunction', array($name, $function));
|
$ormConfig->addMethodCall('addCustomStringFunction', [$name, $function]);
|
||||||
}
|
}
|
||||||
foreach ($sql['numeric_functions'] as $name => $function) {
|
foreach ($sql['numeric_functions'] as $name => $function) {
|
||||||
$ormConfig->addMethodCall('addCustomNumericFunction', array($name, $function));
|
$ormConfig->addMethodCall('addCustomNumericFunction', [$name, $function]);
|
||||||
}
|
}
|
||||||
foreach ($sql['datetime_functions'] as $name => $function) {
|
foreach ($sql['datetime_functions'] as $name => $function) {
|
||||||
$ormConfig->addMethodCall('addCustomDatetimeFunction', array($name, $function));
|
$ormConfig->addMethodCall('addCustomDatetimeFunction', [$name, $function]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->defaultValue(array())
|
->defaultValue([])
|
||||||
->end()
|
->end()
|
||||||
|
|
||||||
->arrayNode('rates')
|
->arrayNode('rates')
|
||||||
@@ -84,27 +84,27 @@ class Configuration implements ConfigurationInterface
|
|||||||
->useAttributeAsKey('key')
|
->useAttributeAsKey('key')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
->defaultValue(array(
|
->defaultValue([
|
||||||
'default' => 'App\Controller\InvoiceController::invoiceAction',
|
'default' => 'App\Controller\InvoiceController::invoiceAction',
|
||||||
))
|
])
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('calculator')
|
->arrayNode('calculator')
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->useAttributeAsKey('key')
|
->useAttributeAsKey('key')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
->defaultValue(array(
|
->defaultValue([
|
||||||
'default' => 'App\Invoice\DefaultCalculator',
|
'default' => 'App\Invoice\DefaultCalculator',
|
||||||
))
|
])
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('number_generator')
|
->arrayNode('number_generator')
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->useAttributeAsKey('key')
|
->useAttributeAsKey('key')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->prototype('scalar')->end()
|
->prototype('scalar')->end()
|
||||||
->defaultValue(array(
|
->defaultValue([
|
||||||
'default' => 'App\Invoice\DateNumberGenerator',
|
'default' => 'App\Invoice\DateNumberGenerator',
|
||||||
))
|
])
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class TablePrefixSubscriber implements EventSubscriber
|
|||||||
|
|
||||||
public function getSubscribedEvents()
|
public function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return array('loadClassMetadata');
|
return ['loadClassMetadata'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
|
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ class TimesheetSubscriber implements EventSubscriber
|
|||||||
*/
|
*/
|
||||||
public function getSubscribedEvents()
|
public function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
'prePersist',
|
'prePersist',
|
||||||
'preUpdate',
|
'preUpdate',
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->getForm()->add('project', ProjectType::class, array(
|
$event->getForm()->add('project', ProjectType::class, [
|
||||||
'group_by' => null,
|
'group_by' => null,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'query_builder' => function (ProjectRepository $repo) use ($data) {
|
'query_builder' => function (ProjectRepository $repo) use ($data) {
|
||||||
@@ -145,7 +145,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
|||||||
$qb->where('p.customer = :customer')->setParameter('customer', $data['customer']);
|
$qb->where('p.customer = :customer')->setParameter('customer', $data['customer']);
|
||||||
return $qb;
|
return $qb;
|
||||||
},
|
},
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->getForm()->add('activity', ActivityType::class, array(
|
$event->getForm()->add('activity', ActivityType::class, [
|
||||||
'group_by' => null,
|
'group_by' => null,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'query_builder' => function (ActivityRepository $repo) use ($data) {
|
'query_builder' => function (ActivityRepository $repo) use ($data) {
|
||||||
@@ -171,7 +171,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
|||||||
$qb->where('a.project = :project')->setParameter('project', $data['project']);
|
$qb->where('a.project = :project')->setParameter('project', $data['project']);
|
||||||
return $qb;
|
return $qb;
|
||||||
},
|
},
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ class LanguageType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'choices' => array(
|
'choices' => [
|
||||||
Intl::getLocaleBundle()->getLocaleName('de', 'de') => 'de',
|
Intl::getLocaleBundle()->getLocaleName('de', 'de') => 'de',
|
||||||
Intl::getLocaleBundle()->getLocaleName('en', 'en') => 'en',
|
Intl::getLocaleBundle()->getLocaleName('en', 'en') => 'en',
|
||||||
)
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class SkinType extends AbstractType
|
|||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'choices' => array(
|
'choices' => [
|
||||||
'blue' => 'blue',
|
'blue' => 'blue',
|
||||||
'black' => 'black',
|
'black' => 'black',
|
||||||
'green' => 'green',
|
'green' => 'green',
|
||||||
@@ -39,7 +39,7 @@ class SkinType extends AbstractType
|
|||||||
'purple-light' => 'purple-light',
|
'purple-light' => 'purple-light',
|
||||||
'red-light' => 'red-light',
|
'red-light' => 'red-light',
|
||||||
'yellow-light' => 'yellow-light',
|
'yellow-light' => 'yellow-light',
|
||||||
)
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ class UserPreferenceType extends AbstractType
|
|||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults([
|
||||||
'data_class' => UserPreference::class,
|
'data_class' => UserPreference::class,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class UserCreateType extends UserEditType
|
|||||||
->add('plainPassword', RepeatedType::class, [
|
->add('plainPassword', RepeatedType::class, [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => PasswordType::class,
|
'type' => PasswordType::class,
|
||||||
'first_options' => array('label' => 'label.password'),
|
'first_options' => ['label' => 'label.password'],
|
||||||
'second_options' => array('label' => 'label.password_repeat'),
|
'second_options' => ['label' => 'label.password_repeat'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
parent::buildForm($builder, $options);
|
parent::buildForm($builder, $options);
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class UserPasswordType extends AbstractType
|
|||||||
$builder
|
$builder
|
||||||
->add('plainPassword', RepeatedType::class, [
|
->add('plainPassword', RepeatedType::class, [
|
||||||
'type' => PasswordType::class,
|
'type' => PasswordType::class,
|
||||||
'first_options' => array('label' => 'label.password'),
|
'first_options' => ['label' => 'label.password'],
|
||||||
'second_options' => array('label' => 'label.password_repeat'),
|
'second_options' => ['label' => 'label.password_repeat'],
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class UserPreferencesForm extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder->add('preferences', CollectionType::class, [
|
$builder->add('preferences', CollectionType::class, [
|
||||||
'entry_type' => UserPreferenceType::class,
|
'entry_type' => UserPreferenceType::class,
|
||||||
'entry_options' => array('label' => false),
|
'entry_options' => ['label' => false],
|
||||||
'allow_add' => false,
|
'allow_add' => false,
|
||||||
'allow_delete' => false,
|
'allow_delete' => false,
|
||||||
'label' => false,
|
'label' => false,
|
||||||
@@ -46,7 +46,6 @@ class UserPreferencesForm extends AbstractType
|
|||||||
'csrf_protection' => true,
|
'csrf_protection' => true,
|
||||||
'csrf_field_name' => '_token',
|
'csrf_field_name' => '_token',
|
||||||
'csrf_token_id' => 'edit_user_preferences',
|
'csrf_token_id' => 'edit_user_preferences',
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class Role extends Constraint
|
|||||||
{
|
{
|
||||||
const ROLE_ERROR = 'xd5hffg-dsfef3-426a-83d7-1f2d33hs5d84';
|
const ROLE_ERROR = 'xd5hffg-dsfef3-426a-83d7-1f2d33hs5d84';
|
||||||
|
|
||||||
protected static $errorNames = array(
|
protected static $errorNames = [
|
||||||
self::ROLE_ERROR => 'ROLE_ERROR',
|
self::ROLE_ERROR => 'ROLE_ERROR',
|
||||||
);
|
];
|
||||||
|
|
||||||
public $message = 'This value is not a valid role.';
|
public $message = 'This value is not a valid role.';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user