Skip to content

Commit

Permalink
fix(cs): php-cs-fixer and stan
Browse files Browse the repository at this point in the history
  • Loading branch information
JellyBellyDev committed May 19, 2020
1 parent 98af003 commit 5b66a68
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Expand Up @@ -250,16 +250,6 @@ parameters:
count: 1
path: tests/Contributors/Command/UpdateCommandTest.php

-
message: "#^Method App\\\\Tests\\\\Contributors\\\\Service\\\\RepositoryTest\\:\\:checkUrl\\(\\) has parameter \\$url with no typehint specified\\.$#"
count: 1
path: tests/Contributors/Service/RepositoryTest.php

-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
path: tests/Contributors/Service/RepositoryTest.php

-
message: "#^Method App\\\\Tests\\\\Contributors\\\\Service\\\\RepositoryTest\\:\\:getFakeResultPagerFetchAll\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
8 changes: 4 additions & 4 deletions src/Badge/Infrastructure/Package/PackageRepository.php
Expand Up @@ -57,10 +57,10 @@ public function fetchByRepository(string $repository): Package
}

if (
$apiPackage instanceof ApiPackage
&& !empty($repoGitHubData)
&& array_key_exists('default_branch', $repoGitHubData)
&& is_string($repoGitHubData['default_branch'])
$apiPackage instanceof ApiPackage
&& !empty($repoGitHubData)
&& \array_key_exists('default_branch', $repoGitHubData)
&& \is_string($repoGitHubData['default_branch'])
) {
// create a new Package from the ApiPackage
/** @var Package $class */
Expand Down
2 changes: 1 addition & 1 deletion src/Badge/Model/Badge.php
Expand Up @@ -87,7 +87,7 @@ private function escapeValue(string $value): string
'-',
];
$ret = \preg_replace($pattern, $replacement, $value);
if ($ret === null) {
if (null === $ret) {
throw new \RuntimeException('Error while escaping');
}

Expand Down
6 changes: 3 additions & 3 deletions src/Badge/Model/Image.php
Expand Up @@ -57,12 +57,12 @@ public function getOutputFileName(): string
private function cleanName(): string
{
$clean = \iconv('UTF-8', 'ASCII//TRANSLIT', $this->name);
if ($clean === false) {
if (false === $clean) {
throw new \RuntimeException('Error while parsing image name');
}

$clean = \preg_replace('/[^a-zA-Z0-9_|+ -]/', '', $clean);
if ($clean === null) {
if (null === $clean) {
throw new \RuntimeException('Error while parsing image name');
}

Expand Down
2 changes: 2 additions & 0 deletions src/Badge/Model/Package.php
Expand Up @@ -41,6 +41,7 @@ private function __construct(ApiPackage $apiPackage, array $repoGitHubData)

/**
* Create a new Package decorated with the Api Package.
*
* @param array{default_branch: string} $repoGitHubData
*/
public static function createFromApi(ApiPackage $apiPackage, array $repoGitHubData): self
Expand Down Expand Up @@ -93,6 +94,7 @@ private function calculateLatestVersions(): self

/**
* Get all the branch aliases.
*
* @return array<string, string>|null
*/
private function getBranchAliases(ApiPackage\Version $version): ?array
Expand Down
4 changes: 2 additions & 2 deletions tests/Contributors/Service/RepositoryTest.php
Expand Up @@ -81,8 +81,8 @@ public function testUpdateCache(): void
private function checkUrl(string $url): void
{
$data = \file_get_contents($url);
$this->assertNotFalse($data, 'Unable to open URL: '.$url);
$this->assertGreaterThan(0, \strlen($data));
$this->assertNotFalse((bool) $data, 'Unable to open URL: '.$url);
$this->assertGreaterThan(0, \strlen((string) $data));
}

private function getFakeResultPagerFetchAll(): array
Expand Down

0 comments on commit 5b66a68

Please sign in to comment.