-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
PSR12.Files.FileHeader false positive for file with mixed PHP and HTML and no file header #2848
Comments
@pronist Could you run I suspect different installations of PHPCS are being used. |
@jrfnl Oh, global Installation is 3.5.3, but local Installation is 3.5.4 |
Yup, that looks like a regression. Probably related to a bug in PHPCS 3.5.3 which was fixed in 3.5.4. See: #2732 PSR 12 states:
Based on that and presuming this is the start of the file, your code should pass. However as the error you quote mentions line Nonetheless, I can confirm this is a bug as with your code sample I can reproduce the error on line 1. |
but, my file is just starting with It's a Full code sample. <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>phpblog - <?=$_SERVER['REQUEST_URI'] ?? ''?></title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Noto+Sans+KR:400,500&display=swap&subset=korean">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/uikit.min.css" />
<link rel="stylesheet" href="/app.css">
</head>
<body>
<div id="app" class="uk-container-expand">
<nav id="nav" role="navigation" class="uk-navbar-container uk-navbar-transparent uk-padding uk-padding-remove-vertical uk-margin-bottom" uk-navbar>
<div class="uk-navbar-right">
<ul class="uk-navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/user/register.php">Register</a></li>
<?php if (array_key_exists('user', $_SESSION)) : ?>
<li><a href="/user/update.php">My page</a></li>
<li><a href="/post/write.php">Write</a></li>
<li><a href="/auth/logout.php">Sign out</a></li>
<?php else : ?>
<li><a href="/auth/login.php">Sign in</a></li>
<?php endif; ?>
</ul>
</div>
</nav>
<main id="main" role="main"> |
… mixed PHP and HTML and no file header
… mixed PHP and HTML and no file header
Thanks for reporting this. The fix will be in 3.5.5. |
…file with mixed PHP and HTML and no file header
Check this.
My composer.json
Is it a bug?
The text was updated successfully, but these errors were encountered: