Merge pull request #1100 from faissaloux/fix-use-strict-types

Fix `toUseStrictTypes`
This commit is contained in:
Nuno Maduro
2024-08-22 20:32:21 +01:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@ -441,7 +441,7 @@ final class Expectation
{
return Targeted::make(
$this,
fn (ObjectDescription $object): bool => str_contains((string) file_get_contents($object->path), 'declare(strict_types=1);'),
fn (ObjectDescription $object): bool => (bool) preg_match('/^<\?php\s+declare\(.*?strict_types\s?=\s?1.*?\);/', (string) file_get_contents($object->path)),
'to use strict types',
FileLineFinder::where(fn (string $line): bool => str_contains($line, '<?php')),
);