Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow plugin to continue operating if assert() is non-fatal #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SignpostMarv
Copy link
Contributor

In some environments, assert() can be configured to be non-fatal, which causes the plugin to error out when $param->type is passed to a function that expects Type\Union.

Setting the type via Type::getMixed() (being the equivalent of "unknown" in this particular case) allows the plugin to continue executing, while the assertion still gets logged.

When assertions are fatal, no change in behaviour is expected as the plugin should bail out right away.

@SignpostMarv
Copy link
Contributor Author

incidentally, this looks like it closes #32

@weirdan
Copy link
Member

weirdan commented Jan 12, 2020

I think the issue should be addressed by removing the assert and dealing with the situation that causes failure (and for that we need a reproducer, as was requested in #32 (comment)), rather than trying to work it around. Ideally we should not modify Psalm-inferred types in the plugin, so it's better to clone them if we have to.

@SignpostMarv
Copy link
Contributor Author

SignpostMarv commented Feb 5, 2020

@weirdan found a public project that generates the issue during rebasing, will see if it sticks around after I'm done. nope, it went away; while rebasing, came across a commit that renamed a parameter on the method but the docblock wasn't updated (bad rebase?), so:

  • there was a tag for a non-existent parameter $foo
  • the method had an untyped $_foo

ERROR: InvalidDocblockParamName - tests\unit\LiveMailboxTest.php:370:18 - Incorrect param name $expected_compose_result in docblock for PhpImap\LiveMailboxTest::test_append_nudges_mailbox_count
/**
* @dataProvider AppendProvider
*
* @Depends test_append
*
* @param string $expected_compose_result
* @param bool $pre_compose
*
* @psalm-param MAILBOX_ARGS $mailbox_args
* @psalm-param COMPOSE_ENVELOPE $envelope
* @psalm-param COMPOSE_BODY $body
*/

ERROR: MissingParamType - tests\unit\LiveMailboxTest.php:381:3 - Parameter $_expected_compose_result has no provided type
$_expected_compose_result,

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.

2 participants