Skip to content

Check #[RequiresPhpunit(....)] in the same way we check #[RequiresPhp(...)] #302

Description

@staabm

there is a RequiresPhpunit attribute which supports similar version constraints RequiresPhp does, e.g. #[RequiresPhpunit('>= 10.1.0')]

https://docs.phpunit.de/en/10.5/attributes.html#requiresphpunit

we should run the same sanity checks on it. see initial implementation in


example

	#[RequiresPhp('>= 8.3')]
	#[RequiresPhpunit('>= 8.5')]
	public function testFixWithPipe(): void
	{
		$this->fix(__DIR__ . '/data/final-class-rule-pipe.php', __DIR__ . '/data/final-class-rule-pipe.php.fixed');
	}

results in

➜  phpstan-src git:(2.2.x) ✗ /Users/m.staab/dvl/phpunit/phpunit tests/PHPStan/Build/FinalClassRuleTest.php
PHPUnit 13.3-gab1fecc8a by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.7
Configuration: /Users/m.staab/dvl/phpstan-src/phpunit.xml
Random Seed:   1782378584

...                                                                 3 / 3 (100%)

Time: 00:02.046, Memory: 78.50 MB

There were 2 PHPUnit test runner warnings:

1) Incomplete version requirement "8.3" used by PHPStan\Build\FinalClassRuleTest::testFixWithPipe()

2) Incomplete version requirement "8.5" used by PHPStan\Build\FinalClassRuleTest::testFixWithPipe()

OK, but there were issues!
Tests: 3, Assertions: 3, PHPUnit Warnings: 4.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions