Path => content of the PHP sources and the guides. */ private static function texts(): array { $root = dirname(__DIR__, 5); $texts = []; foreach (glob($root . '/docs/guides/*.md') ?: [] as $file) { $texts[$file] = (string) file_get_contents($file); } foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . '/src')) as $file) { if (str_ends_with((string) $file, '.php')) { $texts[(string) $file] = (string) file_get_contents((string) $file); } } return $texts; } public function testNoTextLocksWritingAsAWhole(): void { $texts = self::texts(); self::assertNotEmpty($texts); foreach ($texts as $path => $text) { // Join string literals split over lines ('a ' . 'b') so a phrase cannot hide in a line break. $text = (string) preg_replace('/\'\s*\.\s*\'/', '', $text); foreach (self::OLD_PHRASES as $phrase) { self::assertFalse( stripos($text, $phrase) !== false, sprintf('%s still says "%s" – name the feature instead', basename($path), $phrase) ); } } } }