Skip to content

Commit

Permalink
Fix CS to new version
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Oct 5, 2020
1 parent 3ec4fbe commit 943271e
Show file tree
Hide file tree
Showing 25 changed files with 70 additions and 61 deletions.
8 changes: 4 additions & 4 deletions src/Dictionary/DictionaryCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ class DictionaryCollection
/** @var string[] */
private $checkedFiles;

/** @var \SpellChecker\Dictionary\Dictionary[] */
/** @var Dictionary[] */
private $dictionaries;

/** @var string[] */
private $diacriticDictionaries;

/** @var \Dogma\Application\Console|null */
/** @var Console|null */
private $console;

/**
* @param string[] $directories
* @param string[] $diacriticDictionaries
* @param string[] $checkedFiles
* @param string|null $baseDir
* @param \Dogma\Application\Console|null $console
* @param Console|null $console
*/
public function __construct(
array $directories,
Expand Down Expand Up @@ -231,7 +231,7 @@ private function findDictionaryFiles(): void
}

/**
* @return \SpellChecker\Dictionary\Dictionary[]
* @return Dictionary[]
*/
public function getDictionaries(): array
{
Expand Down
7 changes: 4 additions & 3 deletions src/FileFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SpellChecker;

use Dogma\Application\Configurator;
use Dogma\ArrayIterator;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
use function array_intersect;
Expand Down Expand Up @@ -34,7 +35,7 @@ public function getBaseDir(): string
}

/**
* @param \Dogma\Application\Configurator $config
* @param Configurator $config
* @return string[]
*/
public function findFilesByConfig(Configurator $config): array
Expand Down Expand Up @@ -109,7 +110,7 @@ public function filterFiles(?array $files, ?array $directories, ?array $extensio

// filter files by extensions and excludes
if ($extensions || $excludes) {
return iterator_to_array(new FilenameFilterIterator(new \ArrayIterator($foundFiles), $extensions ?? [], $excludes ?? []));
return iterator_to_array(new FilenameFilterIterator(new ArrayIterator($foundFiles), $extensions ?? [], $excludes ?? []));
} else {
return $foundFiles;
}
Expand All @@ -121,7 +122,7 @@ public function filterFiles(?array $files, ?array $directories, ?array $extensio
/**
* @param string[]|null $extensions
* @param string[]|null $excludes
* @return \Symfony\Component\Finder\Finder
* @return Finder
*/
private function createFinder(?array $extensions = null, ?array $excludes = null): Finder
{
Expand Down
4 changes: 2 additions & 2 deletions src/Heuristic/AddressDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AddressDetector implements Heuristic
public const RESULT_URL = 'url';
public const RESULT_URL_PART = 'url-part';

/** @var \SpellChecker\Dictionary\DictionaryCollection */
/** @var DictionaryCollection */
private $dictionaries;

/** @var bool */
Expand All @@ -46,7 +46,7 @@ public function __construct(
}

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/Base64DataDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Base64DataDetector implements Heuristic
public const RESULT_IMAGE = 'image';

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/BulletsDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
}

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/CssUnitsDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CssUnitsDetector implements Heuristic
public const RESULT_UNIT = 'unit';

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
4 changes: 2 additions & 2 deletions src/Heuristic/DictionarySearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DictionarySearch implements Heuristic
public const TRY_CAPITALIZED = 2;
public const TRY_WITHOUT_DIACRITICS = 4;

/** @var \SpellChecker\Dictionary\DictionaryCollection */
/** @var DictionaryCollection */
private $dictionaries;

public function __construct(DictionaryCollection $dictionaries)
Expand All @@ -25,7 +25,7 @@ public function __construct(DictionaryCollection $dictionaries)
}

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/EscapeSequenceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EscapeSequenceDetector implements Heuristic
public const RESULT_ENTITY = 'entity';

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
4 changes: 2 additions & 2 deletions src/Heuristic/FileNameDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FileNameDetector implements Heuristic

public const RESULT_FILE_NAME = 'file';

/** @var \SpellChecker\Dictionary\DictionaryCollection */
/** @var DictionaryCollection */
private $dictionaries;

/** @var string[] */
Expand All @@ -34,7 +34,7 @@ public function __construct(DictionaryCollection $dictionaries)
}

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|string
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/GarbageDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GarbageDetector implements Heuristic
public const RESULT_GARBAGE = 'garbage';

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/Heuristic.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Heuristic
/**
* Checks the given word.
* Returns the name of rule or dictionary for which the word matches or null if it does not match.
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
4 changes: 2 additions & 2 deletions src/Heuristic/IdentifiersDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IdentifiersDetector implements Heuristic
public const ID = 'id';
public const CONSTANT = 'constant';

/** @var \SpellChecker\Dictionary\DictionaryCollection */
/** @var DictionaryCollection */
private $dictionaries;

public function __construct(DictionaryCollection $dictionaries)
Expand All @@ -28,7 +28,7 @@ public function __construct(DictionaryCollection $dictionaries)
}

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|string
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/PrintfDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PrintfDetector implements Heuristic
public const RESULT_PRINTF = 'printf';

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|string
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/SimpleHtmlDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SimpleHtmlDetector implements Heuristic
];

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic/SqlTableShortcutDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SqlTableShortcutDetector implements Heuristic
private $pattern;

/**
* @param \SpellChecker\Word $word
* @param Word $word
* @param string $string
* @param string[] $dictionaries
* @return string|null
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/DefaultParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(array $exceptions = [])
/**
* Parse code with camelCase and under_scores
* @param string $string
* @return \SpellChecker\Word[]
* @return Word[]
*/
public function parse(string $string): array
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function parse(string $string): array
* @param string $block
* @param int $position
* @param int $rowNumber
* @param \SpellChecker\Word[] $result
* @param Word[] $result
* @param string|null $context
*/
public function blocksToWords(string $block, int $position, int $rowNumber, array &$result, ?string $context = null): void
Expand Down
4 changes: 3 additions & 1 deletion src/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace SpellChecker\Parser;

use SpellChecker\Word;

interface Parser
{

Expand All @@ -13,7 +15,7 @@ interface Parser
/**
* Parse words from text
* @param string $string
* @return \SpellChecker\Word[]
* @return Word[]
*/
public function parse(string $string): array;

Expand Down
26 changes: 14 additions & 12 deletions src/Parser/PhpParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@

namespace SpellChecker\Parser;

use function explode;
use function ltrim;
use function preg_match_all;
use function rtrim;
use function str_replace;
use function strlen;
use function substr;
use function token_get_all;
use function trim;
use SpellChecker\Word;
use const PREG_OFFSET_CAPTURE;
use const T_COMMENT;
use const T_CONSTANT_ENCAPSED_STRING;
Expand All @@ -22,6 +14,16 @@
use const T_STRING;
use const T_STRING_VARNAME;
use const T_VARIABLE;
use function explode;
use function is_string;
use function ltrim;
use function preg_match_all;
use function rtrim;
use function str_replace;
use function strlen;
use function substr;
use function token_get_all;
use function trim;

class PhpParser implements Parser
{
Expand All @@ -33,7 +35,7 @@ class PhpParser implements Parser
public const CONTEXT_HTML = 'html';
public const CONTEXT_DATA = 'data';

/** @var \SpellChecker\Parser\DefaultParser */
/** @var DefaultParser */
private $defaultParser;

public function __construct(DefaultParser $defaultParser)
Expand All @@ -43,7 +45,7 @@ public function __construct(DefaultParser $defaultParser)

/**
* @param string $string
* @return \SpellChecker\Word[]
* @return Word[]
*/
public function parse(string $string): array
{
Expand Down Expand Up @@ -123,7 +125,7 @@ public function parse(string $string): array
}

/**
* @param \SpellChecker\Word[] $result
* @param Word[] $result
* @param string $string
* @param int $filePosition
* @param int $rowNumber
Expand Down
5 changes: 3 additions & 2 deletions src/Parser/PoParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SpellChecker\Parser;

use SpellChecker\Word;
use const PREG_OFFSET_CAPTURE;
use function explode;
use function preg_match;
Expand All @@ -14,7 +15,7 @@ class PoParser implements Parser
public const CONTEXT_MESSAGE = 'msgid';
public const CONTEXT_TRANSLATION = 'msgstr';

/** @var \SpellChecker\Parser\DefaultParser */
/** @var DefaultParser */
private $defaultParser;

public function __construct(DefaultParser $defaultParser)
Expand All @@ -24,7 +25,7 @@ public function __construct(DefaultParser $defaultParser)

/**
* @param string $string
* @return \SpellChecker\Word[]
* @return Word[]
*/
public function parse(string $string): array
{
Expand Down
6 changes: 3 additions & 3 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
class Result
{

/** @var \SpellChecker\Word[][] */
/** @var Word[][] */
private $errors;

/** @var int */
private $errorsCount;

/**
* @param \SpellChecker\Word[][] $errors
* @param Word[][] $errors
* @param int $errorsCount
*/
public function __construct(array $errors, int $errorsCount)
Expand All @@ -30,7 +30,7 @@ public function errorsFound(): bool
}

/**
* @return \SpellChecker\Word[][]
* @return Word[][]
*/
public function getErrors(): array
{
Expand Down
6 changes: 3 additions & 3 deletions src/ResultFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class ResultFormatter
{

/** @var \SpellChecker\Dictionary\DictionaryResolver */
/** @var DictionaryResolver */
private $dictionaryResolver;

/** @var string|null */
Expand Down Expand Up @@ -167,7 +167,7 @@ public function formatErrors(Result $result): string

/**
* @param string $fileName
* @param \SpellChecker\Word[] $errors
* @param Word[] $errors
* @param int $maxWidth
* @return string
*/
Expand Down Expand Up @@ -213,7 +213,7 @@ public function formatErrorsShort(Result $result): string

/**
* @param string $fileName
* @param \SpellChecker\Word[] $errors
* @param Word[] $errors
* @return string
*/
public function formatFileErrorsShort(string $fileName, array $errors): string
Expand Down

0 comments on commit 943271e

Please sign in to comment.