Issues (24)

examples/file_source_mispelling_finder.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
use PhpSpellcheck\MisspellingFinder;
6
use PhpSpellcheck\MisspellingHandler\EchoHandler;
7
use PhpSpellcheck\Spellchecker\Aspell;
8
9
require_once __DIR__ . '/../vendor/autoload.php';
10
11
$misspellingFinder = new MisspellingFinder(
12
    Aspell::create(), // Creates aspell spellchecker pointing to "aspell" as it's binary path
13
    new EchoHandler() // Handles all the misspellings found by echoing their information
14
);
15
/** @var \Generator|\PhpSpellcheck\Misspelling[] $misspellings */
16
$misspellings = $misspellingFinder->find(
17
    new \PhpSpellcheck\Source\File(__DIR__ . '/../tests/Fixtures/Text/mispelling1.txt'),
0 ignored issues
show
new PhpSpellcheck\Source.../Text/mispelling1.txt') of type PhpSpellcheck\Source\File is incompatible with the type iterable expected by parameter $source of PhpSpellcheck\MisspellingFinder::find(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
    /** @scrutinizer ignore-type */ new \PhpSpellcheck\Source\File(__DIR__ . '/../tests/Fixtures/Text/mispelling1.txt'),
Loading history...
18
    ['en_US'],
19
    ['from' => 'aspell spellchecker']
20
);
21