Skip to content

Clarify type of 2nd argument context#74

Merged
Seldaek merged 3 commits into
php-fig:masterfrom
Jeckerson:master
May 3, 2021
Merged

Clarify type of 2nd argument context#74
Seldaek merged 3 commits into
php-fig:masterfrom
Jeckerson:master

Conversation

@Jeckerson

Copy link
Copy Markdown
Contributor

According to psalm, there is an error:

ERROR: MethodSignatureMismatch - ide/5.0.0-alpha.1/Phalcon/DataMapper/Pdo/Profiler/MemoryLogger.zep.php:21:7 - Argument 2 of Psr\Log\AbstractLogger::alert has wrong type 'mixed', expecting 'array<array-key, mixed>' as defined by Psr\Log\LoggerInterface::alert (see https://psalm.dev/042)

This blocks phalcon/cphalcon#15362

@Jean85 Jean85 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but I'm 👎 on this change: you're making the type more generic without any reason.

@Jeckerson

Copy link
Copy Markdown
Contributor Author

Then implementation must be compliant with this "not generic" type.

* @param array $context

@Jean85

Jean85 commented May 3, 2021

Copy link
Copy Markdown
Member

The issue is in the AbstractLogger then. By spec, the $context is an array of mixed, unspecified data: https://www.php-fig.org/psr/psr-3/

So mixed[] is correct.

@Jean85 Jean85 requested a review from Seldaek May 3, 2021 08:33
@Seldaek Seldaek merged commit d49695b into php-fig:master May 3, 2021
@Seldaek

Seldaek commented May 3, 2021

Copy link
Copy Markdown
Collaborator

Thanks, looks good to me like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants