Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Split a string by a string
<?php explode(string $separator, string $string, int $limit = PHP_INT_MAX): array
<?php $namesToCheck = [
...$namesToCheck,
...array_values(array_filter(
explode(PHP_EOL, $docComment),
fn (string $line): bool => ! str_contains($line, '* @',
))),
];
<?php $namesToCheck = [
...$namesToCheck,
...array_values(array_filter(
explode(PHP_EOL, $docComment),
fn (string $line): bool => ! str_contains($line, '* @',
))),
];
<?php $propertiesDocComments = array_reduce(
array_map(
fn (ReflectionProperty $property): array => explode(PHP_EOL, $property->getDocComment() ?: ''),
$properties,
),
fn (array $carry, array $item): array => [
<?php private function getErrorLine(SplFileInfo $file, string $misspellingWord): int
{
$contentsArray = explode(PHP_EOL, $file->getContents());
$contentsArrayLines = array_map(fn ($lineNumber): int => $lineNumber + 1, array_keys($contentsArray));
$lines = array_values(array_filter(
<?php $output = $process->getOutput();
return array_values(array_map(function (string $line): Misspelling {
[$wordMetadataAsString, $suggestionsAsString] = explode(':', trim($line));
$word = explode(' ', $wordMetadataAsString)[1];
$suggestions = explode(', ', trim($suggestionsAsString));
<?php return array_values(array_map(function (string $line): Misspelling {
[$wordMetadataAsString, $suggestionsAsString] = explode(':', trim($line));
$word = explode(' ', $wordMetadataAsString)[1];
$suggestions = explode(', ', trim($suggestionsAsString));
return new Misspelling($word, $this->takeSuggestions($suggestions));
<?php [$wordMetadataAsString, $suggestionsAsString] = explode(':', trim($line));
$word = explode(' ', $wordMetadataAsString)[1];
$suggestions = explode(', ', trim($suggestionsAsString));
return new Misspelling($word, $this->takeSuggestions($suggestions));
}, array_filter(explode(PHP_EOL, $output), fn (string $line): bool => str_starts_with($line, '&'))));
<?php $suggestions = explode(', ', trim($suggestionsAsString));
return new Misspelling($word, $this->takeSuggestions($suggestions));
}, array_filter(explode(PHP_EOL, $output), fn (string $line): bool => str_starts_with($line, '&'))));
}
<?php {
$path = sprintf('%s/%s.stub', self::PRESET_STUBS_DIRECTORY, $preset);
return array_values(array_filter(array_map('trim', explode("\n", (string) file_get_contents($path)))));
}