Upgrading psalm/plugin-phpunit 0.22 to 1
Breaking0.22.2 → 1.3.2Breaking2Platform1New30Changed7Fixed15Other9
BreakingUpgrade verdict
2 breaking changes and a platform requirement change.
In plain terms
- PHPUnit 12 ignores annotations in doc comments, and so does this plugin. Use attributes like #[Test] and #[DataProvider] instead.
- Support for older PHPUnit versions is removed.
- This version needs PHP 8.2 and PHPUnit 11.
Must act 3 items need code or config changes
PHP requirement changed in 1.0.0: >=8.1 → >=8.2.
Adds psalm/psalm-plugin-api ^0.4.6 || ^0.5.
Moves vimeo/psalm ^6 || ^7.2 || dev-master → ^7.8 || dev-master. Your build may pick other versions.
What you must change
Breaking2
Docblock metadata such as @test, @dataProvider and @covers is now reported as IgnoredDocblockMetadata and no longer marks tests or providers.
IgnoredDocblockMetadata#[Test]#[DataProvider]#[CoversClass]Drops code supporting PHPUnit versions before 11.
Platform1
Requires PHP 8.2 and PHPUnit 11.
API changes
Generated by DepDelta from published PHP source. Not mixed with prose notes.
- changed:
final class Plugin implements PluginEntryPointInterface → final class Plugin implements PluginEntryPointInterface, PluginFixableIssuesInterface - changed:
method Plugin.__invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config = …): void → method Plugin.__invoke(RegistrationInterface $psalm, ?\SimpleXMLElement $config = …): void - added:
final class DocblockSpecials - added:
final class PhpUnitVersion - added:
final class Suppressions - added:
method Plugin.getFixableIssues(?\SimpleXMLElement $config = …): array - added:
static method DocblockSpecials.all(Node $node): array - added:
static method DocblockSpecials.malformed(Node $node): array - added:
static method DocblockSpecials.of(Node $node): array - added:
static method PhpUnitVersion.ignoresDocblockMetadata(): bool - added:
static method PhpUnitVersion.stopsCollectingDependencyValuesEarly(): bool - added:
static method Suppressions.of(?CodeLocation $location, array $own, ClassLikeStorage $class_storage, StatementsSource $source): array
- added:
constructor BoundArgument(int $position, ?string $name, Union $type, Union $param_type, bool $is_optional) - added:
constructor DatasetBinding(array $arguments, array $unknown, array $duplicate, array $missing) - added:
final class BoundArgument - added:
final class DatasetBinding - added:
final class TemplateInference - added:
property BoundArgument.is_optional: bool - added:
property BoundArgument.name: ?string - added:
property BoundArgument.param_type: Union - added:
property BoundArgument.position: int - added:
property BoundArgument.type: Union - added:
property DatasetBinding.arguments: array - added:
property DatasetBinding.duplicate: array - added:
property DatasetBinding.missing: array - added:
property DatasetBinding.unknown: array - added:
static method DatasetBinding.bind(TKeyedArray $dataset, array $params, Codebase $codebase, ?MethodStorage $method = …): self - added:
static method TemplateInference.infer(Codebase $codebase, MethodStorage $method, array $pairs): ?TemplateResult - added:
static method TemplateInference.resolve(Codebase $codebase, MethodStorage $method, Union $param_type, Union $argument, ?TemplateResult $inferred = …): Union
- added:
const DataProviderNarrowingHandler.METADATA_KEY - added:
final class AssertSameSuggestionHandler implements AfterMethodCallAnalysisInterface - added:
final class CoversTargetHandler implements AfterClassLikeVisitInterface, AfterClassLikeAnalysisInterface - added:
final class DataProviderClosureHandler implements AfterExpressionAnalysisInterface - added:
final class DataProviderNarrowingHandler implements BeforeStatementAnalysisInterface - added:
final class DocblockMetadataHandler implements AfterClassLikeAnalysisInterface - added:
final class IntersectionMockReturnTypeProvider implements MethodReturnTypeProviderInterface - added:
final class MissingParentCallHandler implements AfterClassLikeAnalysisInterface - added:
final class MockMethodHandler implements AfterExpressionAnalysisInterface - added:
final class ProviderReturnTypeHandler implements AfterFunctionLikeAnalysisInterface - added:
static method AssertSameSuggestionHandler.afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $event): void - added:
static method CoversTargetHandler.afterClassLikeVisit(AfterClassLikeVisitEvent $event) - added:
static method CoversTargetHandler.afterStatementAnalysis(AfterClassLikeAnalysisEvent $event) - added:
static method DataProviderClosureHandler.afterExpressionAnalysis(AfterExpressionAnalysisEvent $event): ?bool - added:
static method DataProviderClosureHandler.returnType(MethodStorage $storage, int $position): ?Union - added:
static method DataProviderNarrowingHandler.beforeStatementAnalysis(BeforeStatementAnalysisEvent $event): ?bool - added:
static method DocblockMetadataHandler.afterStatementAnalysis(AfterClassLikeAnalysisEvent $event) - added:
static method IntersectionMockReturnTypeProvider.getClassLikeNames(): array - added:
static method IntersectionMockReturnTypeProvider.getMethodReturnType(MethodReturnTypeProviderEvent $event): ?Union - added:
static method MissingParentCallHandler.afterStatementAnalysis(AfterClassLikeAnalysisEvent $event) - added:
static method MockMethodHandler.afterExpressionAnalysis(AfterExpressionAnalysisEvent $event): ?bool - added:
static method ProviderReturnTypeHandler.afterStatementAnalysis(AfterFunctionLikeAnalysisEvent $event): ?bool - added:
static method ProviderReturnTypeHandler.hasNativeReturnTypeOnly(MethodStorage $storage): bool - added:
static method ProviderReturnTypeHandler.inferredTypes(MethodStorage $storage): ?array - added:
static method TestCaseHandler.attributeArguments(Attribute $attribute): array - added:
static method TestCaseHandler.classFromExpression(?Expr $expression, Aliases $aliases, ClassLikeStorage $class): ?string - added:
static method TestCaseHandler.expandForMethod(Codebase $codebase, Type\Union $type, string $apparent_method_name, string $static_class): Type\Union - added:
static method TestCaseHandler.hasPhpUnitAttribute(ClassLike|ClassMethod $node, Aliases $aliases): bool - added:
static method TestCaseHandler.hasStringKeys(Type\Atomic\TKeyedArray $dataset_type, bool $required_only = …): bool - added:
static method TestCaseHandler.isPublicMethod(Codebase $codebase, ClassLikeStorage $class, MethodStorage $method, string $name_lc): bool - added:
static method TestCaseHandler.unionizeIterables(Codebase $codebase, Type\Union $iterables): Type\Atomic\TIterable
- added:
const UnspecificBooleanAssertion.ERROR_LEVEL - added:
const UnspecificCountAssertion.ERROR_LEVEL - added:
const UnspecificEqualsAssertion.ERROR_LEVEL - added:
const UnspecificNullAssertion.ERROR_LEVEL - added:
final class IgnoredDocblockMetadata extends PluginIssue - added:
final class InvalidPhpUnitAnnotation extends PluginIssue - added:
final class MissingParentCall extends PluginIssue - added:
final class UnspecificBooleanAssertion extends PluginIssue - added:
final class UnspecificCountAssertion extends PluginIssue - added:
final class UnspecificEqualsAssertion extends PluginIssue - added:
final class UnspecificNullAssertion extends PluginIssue