-
Notifications
You must be signed in to change notification settings - Fork 160
Fix magento/magento-coding-standard#214 with class not found #215
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
Fix magento/magento-coding-standard#214 with class not found #215
Conversation
ea4f0dc
to
825857b
Compare
*/ | ||
public function setString($value) | ||
{ | ||
//phpcs:ignore Magento2.Functions.DiscouragedFunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally added this line for the pipeline.
Hi @edspc, Note: that's 2nd PR after #211 that fixes issues in this class, but we don't see these failures during the test runs. It seems like we should add some additional checks to them. |
Hi, @ihor-sviziev,
Currently, HtmlDirectiveSniff in develop branch has two references for non-existent classes (one & two). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔ Approved
Before:
❌ We have fatal error
$ vendor/bin/phpcs --standard=Magento2 /var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Html/_files --extensions=html
PHP Fatal error: Uncaught Error: Class 'Magento2\Sniffs\Html\Template\Tokenizer\Variable' not found in /var/www/html/magento-coding-standard/Magento2/Sniffs/Html/HtmlDirectiveSniff.php:188
Stack trace:
#0 /var/www/html/magento-coding-standard/Magento2/Sniffs/Html/HtmlDirectiveSniff.php(83): Magento2\Sniffs\Html\HtmlDirectiveSniff->validateVariableUsage()
#1 /var/www/html/magento-coding-standard/Magento2/Sniffs/Html/HtmlDirectiveSniff.php(63): Magento2\Sniffs\Html\HtmlDirectiveSniff->processIfDirectives()
#2 /var/www/html/magento-coding-standard/vendor/squizlabs/php_codesniffer/src/Files/File.php(498): Magento2\Sniffs\Html\HtmlDirectiveSniff->process()
#3 /var/www/html/magento-coding-standard/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process()
#4 /var/www/html/magento-coding-standard/vendor/squizlabs/php_codesniffer/src/Runner.php(630): PHP_CodeSniffer\Files\LocalFile->process()
#5 /var/www/html/m in /var/www/html/magento-coding-standard/Magento2/Sniffs/Html/HtmlDirectiveSniff.php on line 188
After:
✔ We don't have any fatal error
$ vendor/bin/phpcs --standard=Magento2 /var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Html/_files --extensions=html
FILE: /var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Html/_files/test-html-directive.html
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badif().bad"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badif3()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badDepend().bad"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badForLoop()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.bad()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.bad()|alsobad"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.bad($bad.param())"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.bad.baz()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.bad.trans()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "bad.bad()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "bad.multiline()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badif2()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badif4()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badif5()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.baddepend2()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
| | Found "foo.badFor()"
1 | ERROR | Template directives may not invoke methods. Only scalar array access is allowed.
...
FILE: /var/www/html/magento2/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Html/_files/test-html-binding.html
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "testError()" doesn't,
| | consider using text binding if the value is supposed to be text
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "test.getSomething().value.error()" doesn't,
| | consider using text binding if the value is supposed to be text
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "bind_stuff(1, 2)" doesn't,
| | consider using text binding if the value is supposed to be text
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "testError()" doesn't,
| | consider using text binding if the value is supposed to be text
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "test.getSomething().value.error(1)" doesn't,
| | consider using text binding if the value is supposed to be text
1 | ERROR | Variables/functions used for HTML binding must have UnsanitizedHtml suffix - "bind_stuff()" doesn't,
| | consider using text binding if the value is supposed to be text
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 42ms; Memory: 8MB
@magento import pr to magento-commerce/magento-coding-standard |
@sivaschenko the pull request successfully imported. |
ACP2E-1871: Extend PHPCompatibility.FunctionUse.RemovedFunctions to add deprecated/removed functions in PHP8.x
Just copied the original classes from the framework to fix the problem.