Edit report at https://pear.php.net/bugs/bug.php?id=20345&edit=1
ID: 20345
Updated by: [email protected]
Reported By: peter at avirtualhome dot com
Summary: String concat is not required here; use a single
string instead
-Status: Feedback
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Linux
Package Version: Unknown
PHP Version: 5.4.30
Assigned To: squiz
Roadmap Versions:
New Comment:
-Status: Feedback
+Status: Closed
Previous Comments:
------------------------------------------------------------------------
[2014-07-11 05:14:40] petervanderdoes
yep that was it, thanks for the quick response.
------------------------------------------------------------------------
[2014-07-11 03:39:33] squiz
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
When I run PHPCS over that code, I get 2 of those unnecessary concat
errors. But
the errors are being reported for the last two concat operators you have
there,
which join 3 single-quoted strings.
Scrutinizer-CI obviously isn't using the column position that the error
provides to
show you where PHPCS is complaining, which makes this confusing given
there are
4 concats happening on the same line number. I imagine it is just listen
the
message for you like the default screen-based output of PHPCS does.
Anyway, the change being asked for is this:
'<a class="adm-scored" data-scored="Yes" data-id="'.$competition-
>ID.'">No</a>';
If I run PHPCS over that code, I don't get any concat errors. Does that
work for
you too?
------------------------------------------------------------------------
[2014-07-10 17:04:57] petervanderdoes
Description:
------------
Codesniffer reports: String concat is not required here; use a single
string instead
Which only is true if I would switch all quotation marks from single to
double and vide
versa.
This comes through Scrutinizer-CI, I don't really know the exact PHP
version or Package
version.
Test script:
---------------
'<a class="adm-scored" data-scored="Yes" data-id="' . $competition->ID .
'">' . 'No' . '</a>';
Expected result:
----------------
No message
Actual result:
--------------
String concat is not required here; use a single string instead
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20345&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.