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

Make LazyAssertion open for extension #285

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

Conversation

DannyvdSluijs
Copy link

No description provided.

@DannyvdSluijs DannyvdSluijs marked this pull request as ready for review August 9, 2019 12:34
/** @var string */
protected static $lazyAssertionClass = LazyAssertion::class;

public static function that($value, $defaultMessage = null, $defaultPropertyPath = null, array $context = [])
Copy link
Contributor

Choose a reason for hiding this comment

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

This line generates an appropriate error when running static analysis.

$ composer assert:sa-tests
> vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests
Fatal error: Declaration of Assert\Tests\Fixtures\ContextAware\Assert::that($value, $defaultMessage = NULL, string $defaultPropertyPath = NULL, array $context = Array) must be compatible with Assert\Assert::that($value, $defaultMessage = NULL, string $defaultPropertyPath = NULL): Assert\AssertionChain in /Users/richardquadling/dev/php/beberlei/tests/Assert/Tests/Fixtures/ContextAware/Assert.php on line 19
PHP Fatal error:  Declaration of Assert\Tests\Fixtures\ContextAware\Assert::that($value, $defaultMessage = NULL, string $defaultPropertyPath = NULL, array $context = Array) must be compatible with Assert\Assert::that($value, $defaultMessage = NULL, string $defaultPropertyPath = NULL): Assert\AssertionChain in /Users/richardquadling/dev/php/beberlei/tests/Assert/Tests/Fixtures/ContextAware/Assert.php on line 19
Script vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests handling the assert:sa-tests event returned with error code 255

use Assert\Tests\Fixtures\ContextAware\LazyAssertion;
use PHPUnit\Framework\TestCase;

class ContextAwareLazyAssertion extends TestCase
Copy link
Contributor

Choose a reason for hiding this comment

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

As this class does not have Test in the name, it is not run by PHPUnit. Renaming it to ContextAwareLazyAssertionTest, reveals the error found by static analysis.

@DannyvdSluijs DannyvdSluijs force-pushed the feature/make-lazy-assertion-open-for-extension branch from 49aef74 to d6d2e8d Compare July 4, 2020 19:45
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