PhpDocVersionFormatCheck
class PhpDocVersionFormatCheck extends AbstractReflectionCheck (View source)
Validates that @since, @deprecated, and @removed phpDoc tags use "major.minor" version format (e.g. 8.0) rather than "major.minor.patch" (e.g. 8.0.1) for style consistency.
Only purely numeric three-or-more-component versions are flagged (e.g. "5.1.2", "7.0.7", "4.4.5.35"). Non-numeric qualifiers like "0.4.1(-1)" from library-specific versioning are not flagged.
Only bundled PHP distribution stubs (StubCategory::CORE + BUNDLED) are checked — EXTERNAL and PECL extension stubs use their own library version numbers (e.g. "1.2.0" for the MongoDB driver, "5.6.1" for gmp) which are intentionally left unchanged. The category filter is applied by the test provider (PhpDocValidatorTest::coreStubsProvider).
For class-like entities (classes, interfaces, enums) the check examines:
- the entity-level phpDoc
- the phpDoc of every declared method
For functions the check examines the function-level phpDoc only.
Known problems are supported at entity level:
- entityType + entityId + 'PhpDocVersionFormatCheck' → skips all version checks for the entity.
Constants
| private VERSION_PATTERN |
Regex that matches @since, @deprecated, or @removed followed by a version
string that has three or more purely numeric dot-separated components. Requires the version to end at whitespace or end-of-string so that library-specific qualifiers like "0.4.1(-1)" are not matched. Capture groups: 1 — tag name (since|deprecated|removed) 2 — major.minor prefix to keep 3 — the rest of the version (patch + any further components) |
Properties
| protected ReflectionProviderInterface | $reflectionProvider | from AbstractReflectionCheck | |
| protected KnownProblemsRegistry | $knownProblemsRegistry | from AbstractReflectionCheck |
Methods
No description
Records a skipped-success result if a known problem covers this entity, and returns true.
No description
Details
__construct(ReflectionProviderInterface|null $reflectionProvider = null, KnownProblemsRegistry|null $knownProblemsRegistry = null, EntityLookupService|null $entityLookup = null)
No description
protected bool
skipWithKnownProblem(CheckResultSet $results, string $entityType, string $entityId, string $checkName, string $phpVersion)
Records a skipped-success result if a known problem covers this entity, and returns true.
Returns false if validation should proceed normally.
bool
supports(string $phpVersion)
No description
CheckResultSet
run(StubDataQueryInterface $stubs, string $entityId, string $phpVersion)
No description