Skip to content

No warnings are emitted in custom rule tests #10927

@janedbal

Description

@janedbal

Bug report

Those are swallowed by set_error_handler in FileAnalyser. This causes custom rule bugs never to be discovered even when the testcase causes them.

class MyRule implements \PHPStan\Rules\Rule
{

	public function getNodeType(): string
	{
		return Node::class;
	}

	public function processNode(Node $node, Scope $scope): array
	{
		echo $undefined; // no warning in PHPUnit, no PHPStan error emitted
	}

}

Code snippet that reproduces the problem

No response

Expected output

Warnings to be emitted in tests based on my phpunit settings.

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions