Skip to content

Commit

Permalink
Merge pull request #98 from CSBill/analysis-XVBGwK
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
pierredup committed May 20, 2016
2 parents 87fba36 + 7155cf8 commit 3c795a3
Show file tree
Hide file tree
Showing 123 changed files with 636 additions and 636 deletions.
6 changes: 3 additions & 3 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AppKernel extends Kernel implements ContainerClassKernelInterface
{
public function registerBundles()
{
$bundles = array(
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
Expand Down Expand Up @@ -61,9 +61,9 @@ public function registerBundles()
new CSBill\CronBundle\CSBillCronBundle(),
new CSBill\MoneyBundle\CSBillMoneyBundle(),
new CSBill\MenuBundle\CSBillMenuBundle(),
);
];

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
if (in_array($this->getEnvironment(), ['dev', 'test'])) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
Expand Down
12 changes: 6 additions & 6 deletions app/SymfonyRequirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $
*/
class RequirementCollection implements IteratorAggregate
{
private $requirements = array();
private $requirements = [];

/**
* Gets the current RequirementCollection as an Iterator.
Expand Down Expand Up @@ -279,7 +279,7 @@ public function all()
*/
public function getRequirements()
{
$array = array();
$array = [];
foreach ($this->requirements as $req) {
if (!$req->isOptional()) {
$array[] = $req;
Expand All @@ -296,7 +296,7 @@ public function getRequirements()
*/
public function getFailedRequirements()
{
$array = array();
$array = [];
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && !$req->isOptional()) {
$array[] = $req;
Expand All @@ -313,7 +313,7 @@ public function getFailedRequirements()
*/
public function getRecommendations()
{
$array = array();
$array = [];
foreach ($this->requirements as $req) {
if ($req->isOptional()) {
$array[] = $req;
Expand All @@ -330,7 +330,7 @@ public function getRecommendations()
*/
public function getFailedRecommendations()
{
$array = array();
$array = [];
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req->isOptional()) {
$array[] = $req;
Expand Down Expand Up @@ -432,7 +432,7 @@ public function __construct()
);

if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
$timezones = array();
$timezones = [];
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
Expand Down
6 changes: 3 additions & 3 deletions app/app_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

echo '> Checking CSBill requirements:'.PHP_EOL.' ';

$messages = array();
$messages = [];
foreach ($appRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) {
Expand Down Expand Up @@ -108,15 +108,15 @@ function echo_title($title, $style = null)
function echo_style($style, $message)
{
// ANSI color codes
$styles = array(
$styles = [
'reset' => "\033[0m",
'red' => "\033[31m",
'green' => "\033[32m",
'yellow' => "\033[33m",
'error' => "\033[37;41m",
'success' => "\033[37;42m",
'title' => "\033[34m",
);
];
$supports = has_color_support();

echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
Expand Down
2 changes: 1 addition & 1 deletion app/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

$loader = require __DIR__.'/../vendor/autoload.php';

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
AnnotationRegistry::registerLoader([$loader, 'loadClass']);

return $loader;
6 changes: 3 additions & 3 deletions app/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

echo '> Checking Symfony requirements:'.PHP_EOL.' ';

$messages = array();
$messages = [];
foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) {
Expand Down Expand Up @@ -108,15 +108,15 @@ function echo_title($title, $style = null)
function echo_style($style, $message)
{
// ANSI color codes
$styles = array(
$styles = [
'reset' => "\033[0m",
'red' => "\033[31m",
'green' => "\033[32m",
'yellow' => "\033[33m",
'error' => "\033[37;41m",
'success' => "\033[37;42m",
'title' => "\033[34m",
);
];
$supports = has_color_support();

echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
Expand Down
6 changes: 3 additions & 3 deletions src/CSBill/ApiBundle/Security/ApiTokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public function authenticateToken(TokenInterface $token, UserProviderInterface $

$roles = array_merge(
$user->getRoles(),
array(
[
'ROLE_API_AUTHENTICATED',
)
]
);

return new PreAuthenticatedToken($user, $apiToken, $providerKey, $roles);
Expand All @@ -129,7 +129,7 @@ public function supportsToken(TokenInterface $token, $providerKey)
*/
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$response = array('message' => $exception->getMessage());
$response = ['message' => $exception->getMessage()];

$content = $this->serializer->serialize($response, $request->getRequestFormat());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getUsernameForToken($token)
*/
public function loadUserByUsername($username)
{
$user = $this->userRepository->findOneBy(array('username' => $username));
$user = $this->userRepository->findOneBy(['username' => $username]);

if (!$user) {
throw new UsernameNotFoundException();
Expand Down
26 changes: 13 additions & 13 deletions src/CSBill/ClientBundle/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function infoAction(Client $client, $type = 'quote')
{
$content = $this->renderView(
'CSBillClientBundle:Ajax:info.html.twig',
array(
[
'client' => $client,
'type' => $type,
)
]
);

return $this->json(array('content' => $content));
return $this->json(['content' => $content]);
}

/**
Expand All @@ -60,9 +60,9 @@ public function addcontactAction(Request $request, Client $client)
$contact = new Contact();
$contact->setClient($client);

$form = $this->createForm('contact', $contact, array('allow_delete' => false));
$form = $this->createForm('contact', $contact, ['allow_delete' => false]);

$response = array();
$response = [];

$form->handleRequest($request);

Expand All @@ -81,10 +81,10 @@ public function addcontactAction(Request $request, Client $client)

$content = $this->renderView(
'CSBillClientBundle:Ajax:contact_add.html.twig',
array(
[
'form' => $form->createView(),
'client' => $client,
)
]
);
$response['content'] = $content;

Expand All @@ -111,7 +111,7 @@ public function editcontactAction(Request $request, Contact $contact)

$originalContactDetails = $contact->getAdditionalDetails()->toArray();

$form = $this->createForm('contact', $contact, array('allow_delete' => false));
$form = $this->createForm('contact', $contact, ['allow_delete' => false]);

if ($request->isMethod('POST')) {
$contact->getAdditionalDetails()->clear();
Expand All @@ -128,16 +128,16 @@ public function editcontactAction(Request $request, Contact $contact)
}

return $this->json(
array(
[
'content' => $this->renderView(
'CSBillClientBundle:Ajax:contact_edit.html.twig',
array(
[
'form' => $form->createView(),
'contact' => $contact,
)
]
),
'status' => $status,
)
]
);
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function deleteclientAction(Client $client)

$this->flash($this->trans('client.delete_success'), 'success');

return $this->json(array('status' => 'success'));
return $this->json(['status' => 'success']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CSBill/ClientBundle/Entity/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public function getAdditionalDetail($type)
*/
public function serialize()
{
return serialize(array($this->id, $this->firstname, $this->lastname, $this->created, $this->updated));
return serialize([$this->id, $this->firstname, $this->lastname, $this->created, $this->updated]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/CSBill/ClientBundle/Form/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add(
'contacts',
new ContactType(),
array(
[
'type' => 'contact',
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'prototype' => true,
'prototype_name' => '__contact_prototype__',
)
]
);

$builder->add(
'addresses',
'collection',
array(
[
'type' => new AddressType(),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'required' => false,
)
]
);
}

Expand All @@ -57,7 +57,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array('data_class' => 'CSBill\ClientBundle\Entity\Client'));
$resolver->setDefaults(['data_class' => 'CSBill\ClientBundle\Entity\Client']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CSBill/ClientBundle/Form/ConstraintBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConstraintBuilder
*/
public static function build(array $options)
{
$constraints = array();
$constraints = [];

foreach ($options as $constraint) {
$constraint = str_replace(' ', '', self::humanize($constraint));
Expand Down
18 changes: 9 additions & 9 deletions src/CSBill/ClientBundle/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Contact extends AbstractType
/**
* @param array $types
*/
public function __construct(array $types = array())
public function __construct(array $types = [])
{
$this->types = $types;
}
Expand All @@ -47,11 +47,11 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$contactDetails = $builder->create(
'details_'.$item->getName(),
new PrimaryContactDetailType($item),
array(
[
'required' => true,
'property_path' => 'primaryDetails',
'by_reference' => true,
)
]
);

$contactDetails->addModelTransformer(new DataTransformer\ContactDetailTransformer($item));
Expand All @@ -65,7 +65,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add(
'additionalDetails',
new ContactDetailType(),
array(
[
'type' => new ContactDetail($this->types),
'allow_add' => true,
'allow_delete' => true,
Expand All @@ -76,10 +76,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'prototype' => true,
'prototype_name' => '__contact_details_prototype__',
'error_bubbling' => false,
'options' => array(
'options' => [
'data_class' => 'CSBill\ClientBundle\Entity\AdditionalContactDetail',
),
)
],
]
);
}

Expand All @@ -97,11 +97,11 @@ public function buildView(FormView $view, FormInterface $form, array $options)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
[
'data_class' => 'CSBill\ClientBundle\Entity\Contact',
'csrf_protection' => false,
'allow_delete' => true,
)
]
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/CSBill/ClientBundle/Form/ContactDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public function __construct(array $types)
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$options = array(
$options = [
'data_class' => null,
'attr' => array(
'attr' => [
'class' => 'input-group-select-val',
),
);
],
];

$builder->add(
$builder
Expand Down
Loading

0 comments on commit 3c795a3

Please sign in to comment.