According to PSR-12:
When wishing to declare strict types in files containing markup outside PHP opening and closing tags, the declaration MUST be on the first line of the file and include an opening PHP tag, the strict types declaration and closing tag.
https://www.php-fig.org/psr/psr-12/
And an example from there:
<?php declare(strict_types=1) ?>
<html>
<body>
<?php
// ... additional PHP code ...
?>
</body>
</html>
According to PSR-12 it is a valid code style but phpcs reports errors:
-------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Header blocks must be separated by a single blank line
| | (PSR12.Files.FileHeader.SpacingAfterBlock)
1 | ERROR | [x] Header blocks must be separated by a single blank line
| | (PSR12.Files.FileHeader.SpacingAfterBlock)