Skip to content

Commit

Permalink
remove fail-fast
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Dec 6, 2023
1 parent cb514cc commit 39ec064
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2]
Expand Down
4 changes: 3 additions & 1 deletion packages/google/src/Sleeper.php
Expand Up @@ -45,10 +45,12 @@ public function execSleep(): void

/**
* Exec a half sleep.
*
* @psalm-suppress ArgumentTypeCoercion
*/
public function execPartialSleep(float $howMuch = 0.5): void
{
if (0 !== $this->sleep) {
if (0 < $this->sleep) {
$sleep = (int) round($this->getSleep() * $howMuch);
usleep($sleep);
Logger::log('sleep '.($sleep / 1_000_000).'s');
Expand Down
Expand Up @@ -44,7 +44,7 @@ public function run(string $extensionClassName): string
$phpDoc .= ' * @method '.('' === $returnType ? '' : $returnType.' ').$method->getName().'('.implode(', ', $paramStrings).')';
if ($this->addLink) {
$phpDoc .= "\n".' * '
.ltrim(str_replace(\Safe\preg_replace('#/vendor/.+$#', '', __DIR__), '', $reflectionClass->getFileName() ?: ''), '/')
.ltrim(str_replace($this->getDir(), '', $reflectionClass->getFileName() ?: ''), '/')
.':'.$method->getStartLine()
."\n".' * ';
}
Expand All @@ -55,6 +55,14 @@ public function run(string $extensionClassName): string
return $phpDoc;
}

private function getDir(): string
{
/** @var string */
$dir = \Safe\preg_replace('#/vendor/.+$#', '', __DIR__);

return $dir;
}

private function formatType(\ReflectionType|null $returnType): string
{
if (null === $returnType) {
Expand Down
1 change: 1 addition & 0 deletions packages/text-analyzer/src/Analyzer.php
Expand Up @@ -58,6 +58,7 @@ public function exec(): Analysis
$sentences = $this->getSentences();

foreach ($sentences as $sentence) {
/** @var string[] */
$wordsGroups = \Safe\preg_split('/(,|\.|\(|\[|!|\?|;|\{|:)/', $sentence);
foreach ($wordsGroups as $wordsGroup) {
$wordsGroup = CleanText::removePunctuation($wordsGroup);
Expand Down
2 changes: 1 addition & 1 deletion packages/text-analyzer/src/CleanText.php
Expand Up @@ -67,7 +67,7 @@ public static function fixEncoding(string $text): string
$text = str_replace(mb_convert_encoding('’', 'ISO-8859-1'), "'", $text);
/** @var string $text */
$text = Encoding::toUTF8($text);
$text = html_entity_decode(htmlentities((string) $text), 0, 'UTF-8');
$text = html_entity_decode(htmlentities($text), 0, 'UTF-8');
$text = preg_replace('#[\x00-\x1F\x7F\xA0]#u', '', $text) ?? throw new \Exception();
$text = html_entity_decode($text, \ENT_QUOTES | \ENT_XML1 | \ENT_HTML5, 'UTF-8');
$text = str_replace(['™', '©', '®'], ' ', $text);
Expand Down

0 comments on commit 39ec064

Please sign in to comment.