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

Incorrect line number reported for Kohana.Operators.TernaryOperator.TernaryParenthesized #16

Open
samwilson opened this issue Jun 26, 2014 · 0 comments

Comments

@samwilson
Copy link

The following code is not being sniffed correctly:

<?php

function test($test)
{
    $bar = 'foobar';
    $foo = $test ? $bar : (1);
}

This is the error:

$ ./vendor/bin/phpcs.bat --standard=vendor/kohana/coding-standards/Kohana -s test.php

Notice: Undefined offset: -1 in C:\work\public_html\kohana_test\vendor\squizlabs\php_codesniffer\CodeSniffer\File.php on line 2665

FILE: C:\work\public_html\kohana_test\test.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 3 | ERROR | Comparisons and operations must be in parentheses in the false
   |       | value portion of ternary operations
   |       | (Kohana.Operators.TernaryOperator.TernaryParenthesized)
--------------------------------------------------------------------------------

Time: 0 seconds, Memory: 1.25Mb

The coding standard error also seems to be wrong, but perhaps that's just related to the line number thing?

(I'll dig into this deeper when I've got time... just putting this here now as a reminder, and in case someone smarter than me can tell me where I'm going wrong.)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant