Skip to content

Commit

Permalink
Tweak CS rules and static analysis issues (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann authored Feb 2, 2023
1 parent 75d7faa commit 3700114
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
'phpdoc_to_comment' => true,
'phpdoc_summary' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_separation' => true,
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
'phpdoc_scalar' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_no_empty_return' => true,
Expand Down
2 changes: 2 additions & 0 deletions src/Analysers/TokenAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ private function parseNamespaceList(array &$tokens, &$token, Context $parseConte

/**
* Parse a use statement.
*
* @param (int|mixed)[]|string $token
*/
private function parseUseStatement(array &$tokens, &$token, Context $parseContext): array
{
Expand Down
1 change: 1 addition & 0 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function __construct(?LoggerInterface $logger = null)
public function push(Generator $generator): void
{
$this->generator = $generator;
/* @phpstan-ignore-next-line */
if (class_exists(AnnotationRegistry::class, true) && method_exists(AnnotationRegistry::class, 'registerLoader')) {
// keeping track of &this->generator allows to 'disable' the loader after we are done;
// no unload, unfortunately :/
Expand Down
1 change: 1 addition & 0 deletions tests/Analysers/DocBlockParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function testParseContents(): void

public function testDeprecatedAnnotationWarning(): void
{
/* @phpstan-ignore-next-line */
if (!class_exists(AnnotationRegistry::class, true) || !method_exists(AnnotationRegistry::class, 'registerLoader')) {
$this->markTestSkipped('Not supported in doctrine/annotations v2');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testRemoveProcessor(): void
{
$generator = new Generator();
$processors = $generator->getProcessors();
$processor = function (Analysis $analysis) {
$processor = function (Analysis $analysis): void {
};
$generator->addProcessor($processor);
$generator->removeProcessor($processor);
Expand Down Expand Up @@ -137,7 +137,7 @@ public function configCases(): iterable
/**
* @dataProvider configCases
*/
public function testConfig(array $config, bool $expected)
public function testConfig(array $config, bool $expected): void
{
$generator = new Generator();
$this->assertOperationIdHash($generator, true);
Expand Down
4 changes: 2 additions & 2 deletions tests/OpenApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getAnalyzer(): AnalyserInterface

public function assertOpenApiLogEntryContains(string $needle, string $message = ''): void
{
$this->expectedLogMessages[] = [function ($entry, $type) use ($needle, $message) {
$this->expectedLogMessages[] = [function ($entry, $type) use ($needle, $message): void {
if ($entry instanceof \Exception) {
$entry = $entry->getMessage();
}
Expand All @@ -114,7 +114,7 @@ public function assertOpenApiLogEntryContains(string $needle, string $message =
*/
protected function assertSpecEquals($actual, $expected, string $message = '', bool $normalized = false): void
{
$formattedValue = function ($value) {
$formattedValue = function ($value): string {
if (is_bool($value)) {
return $value ? 'true' : 'false';
}
Expand Down

0 comments on commit 3700114

Please sign in to comment.