Skip to content

Commit

Permalink
chore(deps-dev): upgrade static analysis tools (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey authored Aug 23, 2023
1 parent ee14c6a commit 69824a0
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
run: "composer dev:test:coverage:ci"

- name: "Publish coverage report to Codecov"
uses: "codecov/[email protected].0"
uses: "codecov/[email protected].4"

unit-tests:
name: "Unit tests"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "~1.8.0",
"phpstan/phpstan": "^1.10.30",
"phpstan/phpstan-mockery": "^1.0",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.0",
"psalm/plugin-mockery": "^0.9.1",
"psalm/plugin-phpunit": "^0.17.0",
"psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18.4",
"ramsey/coding-standard": "^2.0.3",
"ramsey/composer-repl": "^1.4",
"ramsey/conventional-commits": "^1.3",
"roave/security-advisories": "dev-latest",
"spatie/phpunit-snapshot-assertions": "^4.2",
"vimeo/psalm": "~4.26.0"
"vimeo/psalm": "^5.15"
},
"suggest": {
"mdwheele/zalgo": "Zalgo commands you install mdwheele/zalgo for Zalgo pseudo-locale support!"
Expand Down
2 changes: 0 additions & 2 deletions psalm-baseline.xml

This file was deleted.

5 changes: 3 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="1"
cacheDirectory="./build/cache/psalm"
errorBaseline="./psalm-baseline.xml">
findUnusedBaselineEntry="true"
findUnusedCode="false"
cacheDirectory="./build/cache/psalm">

<projectFiles>
<directory name="./src"/>
Expand Down
6 changes: 6 additions & 0 deletions src/Extractor/MessageExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,14 @@ public function __invoke(
};
}

/**
* @psalm-return Closure(DescriptorInterface):mixed
*/
private function flattenMessage(): Closure
{
/**
* @var Closure(DescriptorInterface):mixed
*/
return function (Descriptor $descriptor): ?Descriptor {
$message = $descriptor->getDefaultMessage();
$messageFormatParser = new MessageFormatParser((string) $message);
Expand Down
2 changes: 1 addition & 1 deletion src/FormatPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function formatMessage(array $descriptor, array $values = []): string
} catch (Exception\UnableToGenerateMessageIdException $exception) {
throw new Exception\InvalidArgumentException(
'The message descriptor must have an ID or default message',
(int) $exception->getCode(),
$exception->getCode(),
$exception,
);
}
Expand Down
1 change: 0 additions & 1 deletion src/Icu/MessageFormat/Parser/Type/OptionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function jsonSerialize()
$options = [];

/**
* @var string $property
* @var scalar | mixed[] | null $value
*/
foreach (get_object_vars($this) as $property => $value) {
Expand Down
12 changes: 7 additions & 5 deletions src/Intl/DateTimeFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use MessageFormatter as PhpMessageFormatter;
use Throwable;

use function assert;
use function date_default_timezone_get;
use function date_default_timezone_set;
use function is_int;
Expand Down Expand Up @@ -192,16 +193,17 @@ public function __construct(?LocaleInterface $locale = null, ?DateTimeFormatOpti
$this->timeStyle = $options->timeStyle;

$timeZoneId = $options->timeZone ?? date_default_timezone_get();
$this->intlTimeZone = IntlTimeZone::createTimeZone($timeZoneId);
$intlTimeZone = IntlTimeZone::createTimeZone($timeZoneId);
assert($intlTimeZone instanceof IntlTimeZone);
$this->intlTimeZone = $intlTimeZone;

if ($this->intlTimeZone->getID() === IntlTimeZone::getUnknown()->getID()) {
throw new InvalidArgumentException(sprintf('Unknown time zone "%s"', $timeZoneId));
}

$this->intlCalendar = IntlCalendar::createInstance(
$this->intlTimeZone,
$locale->toString(),
);
$intlCalendar = IntlCalendar::createInstance($this->intlTimeZone, $locale->toString());
assert($intlCalendar instanceof IntlCalendar);
$this->intlCalendar = $intlCalendar;

$this->localeName = $locale->toString();
$this->skeleton = $this->buildSkeleton($options, $locale);
Expand Down
1 change: 1 addition & 0 deletions src/Intl/MessageFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private function applyPreprocessing(string $pattern, array &$values = []): strin

assert($parsed->val instanceof Parser\Type\ElementCollection);

/** @psalm-suppress InvalidArgument */
return (new Printer())->printAst($this->processAst($parsed->val, $callbacks, $valuesWithoutCallables));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Util/FileSystemHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function writeContents($file, string $contents): void
public function writeJsonContents($file, $contents): void
{
try {
$encodedContents = (string) @json_encode($contents, self::JSON_ENCODE_FLAGS);
$encodedContents = @json_encode($contents, self::JSON_ENCODE_FLAGS);
} catch (JsonException $exception) {
throw new InvalidArgumentException('Unable to encode contents as JSON', 0, $exception);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Util/FormatHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public function validateReaderCallable(?callable $formatter): callable
));
}

/** @var ReaderCallableType */
return $formatter;
}

Expand Down Expand Up @@ -227,6 +228,7 @@ public function validateWriterCallable(?callable $formatter): callable
));
}

/** @var WriterCallableType */
return $formatter;
}
}

0 comments on commit 69824a0

Please sign in to comment.