Skip to content

Array syntax #532

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

Closed
wants to merge 1 commit into from
Closed

Array syntax #532

wants to merge 1 commit into from

Conversation

MathiasReker
Copy link
Contributor

PHP arrays should be declared using the short syntax.

PHP arrays should be declared using the short syntax.
@cmb69 cmb69 added the CS label Jun 17, 2022
Copy link
Contributor

@localheinz localheinz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cmb69
Copy link
Member

cmb69 commented Jun 27, 2022

Besides that this PR has merge conflicts, I really think we should discuss the introduction of a coding standard on the webmaster mailing list.

@localheinz
Copy link
Contributor

@cmb69

I have sent an email on June 17 - not sure if anyone received it or nobody has an interest in discussing it:

CleanShot 2022-06-27 at 15 00 46@2x

@cmb69
Copy link
Member

cmb69 commented Jun 27, 2022

Indeed, the mail went through; however, I missed it, and have only yet replied.

@localheinz
Copy link
Contributor

For reference, see https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v3.8.0/doc/rules/array_notation/array_syntax.rst.

@localheinz
Copy link
Contributor

@MathiasReker

Once #559 has been merged, how do you feel about adjusting this pull request here by

  • applying this patch

    diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
    index b2d69e0e..e9bb8e25 100644
    --- a/.php-cs-fixer.php
    +++ b/.php-cs-fixer.php
    @@ -9,6 +9,10 @@ $finder = $config->getFinder()
         ->in(__DIR__)
         ->name(__FILE__);
    
    -$config->setRules([]);
    +$config->setRules([
    +    'array_syntax' => [
    +        'syntax' => 'short',
    +    ],
    +]);
    
    return $config;

    or this patch

    diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
    index b2d69e0e..5d466468 100644
    --- a/.php-cs-fixer.php
    +++ b/.php-cs-fixer.php
    @@ -9,6 +9,8 @@ $finder = $config->getFinder()
         ->in(__DIR__)
         ->name(__FILE__);
    
    -$config->setRules([]);
    +$config->setRules([
    +    'array_syntax' => true,
    +]);
    
    return $config;
  • committing and pushing to fail the build

  • running

    make coding-standards
  • committing and pushing to fix the build

@localheinz
Copy link
Contributor

@cmb69 @MathiasReker

I have opened #659 as a replacement!

@cmb69
Copy link
Member

cmb69 commented Jul 15, 2022

I'm closing this, since #659 also adds the respective fixer. Nonetheless, thanks for the PR!

@cmb69 cmb69 closed this Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants