Open Tklaversma opened 8 months ago
Yeah, this is confirm. I have also noticed this issue right now.
Yeah, this only uses a str_contains()
on the file contents.
I think what would make the most sense is to probably have a regex check for something like:
^<\?php\s+declare\(.*?strict_types\s?=\s?1.*?\);
That would be slower, but would resolve the issue. 🤷🏻 It would also ensure that it's at the start of a line (so no // <?php declare(strict_types=1);
) and also support a declare()
usage that includes ticks
or encoding
.
Bumping up the issue. Minor thing but annoying.
What Happened
The following test will check if
declare(strict_types=1);
is in any file within the directoryapp
.However, it is not checking if the line is actually being used. For example, whenever you comment the line, the test will still return true.
I would expect to check if the line is used.
How to Reproduce
Define the following test:
Comment
declare(strict_types=1);
in a file within the directoryapp
.Run the test and see it succeed, instead of returning failed.
Sample Repository
No response
Pest Version
2.24.3
PHP Version
8.1
Operation System
macOS, Windows, Linux
Notes
No response