Skip to content
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

PHP array sniff does not detect some values in nested arrays #13

Open
svenmuennich opened this issue Nov 1, 2017 · 0 comments
Open
Labels
bug Issues that describe an unexpected behaviour in an existing functionality. minor "bug" issues that are neither "critical" nor "major".

Comments

@svenmuennich
Copy link
Member

I ran into a strange case where our array sniff for PHP CodeSniffer does not detect a value that's part of a nested array and hence does not enforce a missing trailing comma. Here's a code snippet for reproducing this:

<?php

$a = [
    'bla' => [
        'blubb' // <-- This line is missing a trailing comma! 
    ],
];

I wasn't able to come up with an quick easy fix, because the code that collects the array values is mixed with the code that validates key/value pairs (which IMHO is not necessary at all, since php -l validates keyed arrays):

https://github.com/VIISON/style-guide/blob/6ae0a65a3fb21bb5e80f5276c4fa7b81681a695d/php/php-codesniffer-standard/VIISON/Sniffs/Arrays/ArrayDeclarationSniff.php#L348-L501

@svenmuennich svenmuennich added the bug Issues that describe an unexpected behaviour in an existing functionality. label Nov 1, 2017
@svenmuennich svenmuennich added the minor "bug" issues that are neither "critical" nor "major". label Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that describe an unexpected behaviour in an existing functionality. minor "bug" issues that are neither "critical" nor "major".
Projects
None yet
Development

No branches or pull requests

1 participant