diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml
index 9962f0e933f..f9797ca3af0 100644
--- a/.psalm/baseline.xml
+++ b/.psalm/baseline.xml
@@ -421,9 +421,6 @@
-
- methodName()]]>
-
getCode()]]>
@@ -460,12 +457,6 @@
assert($metadata instanceof RequiresSetting)
-
-
- $className
- $className
-
-
$metadata
@@ -512,10 +503,26 @@
$className
$className
$className
+ $className
+ $className
+ $className
+ $function
+ $function
+ $methodName
$pieces[0]
$pieces[0]
+ $pieces[1]
+ $pieces[1]
+ $value
+ $value
+ $value
+ $value
+ $value
+ $value
+
trim($tmp[0])
+ trim($tmp[1])
diff --git a/src/Metadata/After.php b/src/Metadata/After.php
index f9e497e3b27..8790059049b 100644
--- a/src/Metadata/After.php
+++ b/src/Metadata/After.php
@@ -16,6 +16,9 @@
*/
final class After extends Metadata
{
+ /**
+ * @psalm-assert-if-true After $this
+ */
public function isAfter(): bool
{
return true;
diff --git a/src/Metadata/AfterClass.php b/src/Metadata/AfterClass.php
index 505a7a895a4..16bb5cc0a4a 100644
--- a/src/Metadata/AfterClass.php
+++ b/src/Metadata/AfterClass.php
@@ -16,6 +16,9 @@
*/
final class AfterClass extends Metadata
{
+ /**
+ * @psalm-assert-if-true AfterClass $this
+ */
public function isAfterClass(): bool
{
return true;
diff --git a/src/Metadata/BackupGlobals.php b/src/Metadata/BackupGlobals.php
index 3d41b2b3e47..b6c485c8815 100644
--- a/src/Metadata/BackupGlobals.php
+++ b/src/Metadata/BackupGlobals.php
@@ -18,6 +18,9 @@ final class BackupGlobals extends Metadata
{
private readonly bool $enabled;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, bool $enabled)
{
parent::__construct($level);
@@ -25,6 +28,9 @@ protected function __construct(int $level, bool $enabled)
$this->enabled = $enabled;
}
+ /**
+ * @psalm-assert-if-true BackupGlobals $this
+ */
public function isBackupGlobals(): bool
{
return true;
diff --git a/src/Metadata/BackupStaticProperties.php b/src/Metadata/BackupStaticProperties.php
index a75da06b042..30cb9c4d6a8 100644
--- a/src/Metadata/BackupStaticProperties.php
+++ b/src/Metadata/BackupStaticProperties.php
@@ -18,6 +18,9 @@ final class BackupStaticProperties extends Metadata
{
private readonly bool $enabled;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, bool $enabled)
{
parent::__construct($level);
@@ -25,6 +28,9 @@ protected function __construct(int $level, bool $enabled)
$this->enabled = $enabled;
}
+ /**
+ * @psalm-assert-if-true BackupStaticProperties $this
+ */
public function isBackupStaticProperties(): bool
{
return true;
diff --git a/src/Metadata/Before.php b/src/Metadata/Before.php
index 41c42bf0250..08a72b47f83 100644
--- a/src/Metadata/Before.php
+++ b/src/Metadata/Before.php
@@ -16,6 +16,9 @@
*/
final class Before extends Metadata
{
+ /**
+ * @psalm-assert-if-true Before $this
+ */
public function isBefore(): bool
{
return true;
diff --git a/src/Metadata/BeforeClass.php b/src/Metadata/BeforeClass.php
index b1c045fb872..9ae35e51452 100644
--- a/src/Metadata/BeforeClass.php
+++ b/src/Metadata/BeforeClass.php
@@ -16,6 +16,9 @@
*/
final class BeforeClass extends Metadata
{
+ /**
+ * @psalm-assert-if-true BeforeClass $this
+ */
public function isBeforeClass(): bool
{
return true;
diff --git a/src/Metadata/Covers.php b/src/Metadata/Covers.php
index 7eacf4a889d..b4c72345333 100644
--- a/src/Metadata/Covers.php
+++ b/src/Metadata/Covers.php
@@ -16,8 +16,15 @@
*/
final class Covers extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $target;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $target
+ */
protected function __construct(int $level, string $target)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $target)
$this->target = $target;
}
+ /**
+ * @psalm-assert-if-true Covers $this
+ */
public function isCovers(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function target(): string
{
return $this->target;
diff --git a/src/Metadata/CoversClass.php b/src/Metadata/CoversClass.php
index c669c5c4d0d..22889adf404 100644
--- a/src/Metadata/CoversClass.php
+++ b/src/Metadata/CoversClass.php
@@ -22,6 +22,7 @@ final class CoversClass extends Metadata
private readonly string $className;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className)
@@ -31,6 +32,9 @@ protected function __construct(int $level, string $className)
$this->className = $className;
}
+ /**
+ * @psalm-assert-if-true CoversClass $this
+ */
public function isCoversClass(): bool
{
return true;
diff --git a/src/Metadata/CoversDefaultClass.php b/src/Metadata/CoversDefaultClass.php
index 4592744d091..3f7b57c4423 100644
--- a/src/Metadata/CoversDefaultClass.php
+++ b/src/Metadata/CoversDefaultClass.php
@@ -22,6 +22,7 @@ final class CoversDefaultClass extends Metadata
private readonly string $className;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className)
@@ -31,6 +32,9 @@ protected function __construct(int $level, string $className)
$this->className = $className;
}
+ /**
+ * @psalm-assert-if-true CoversDefaultClass $this
+ */
public function isCoversDefaultClass(): bool
{
return true;
diff --git a/src/Metadata/CoversFunction.php b/src/Metadata/CoversFunction.php
index a57945fcf9f..ee9f858ea43 100644
--- a/src/Metadata/CoversFunction.php
+++ b/src/Metadata/CoversFunction.php
@@ -16,8 +16,15 @@
*/
final class CoversFunction extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $functionName;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $functionName
+ */
protected function __construct(int $level, string $functionName)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $functionName)
$this->functionName = $functionName;
}
+ /**
+ * @psalm-assert-if-true CoversFunction $this
+ */
public function isCoversFunction(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function functionName(): string
{
return $this->functionName;
diff --git a/src/Metadata/CoversNothing.php b/src/Metadata/CoversNothing.php
index 863fe4d12ce..4703964e5d0 100644
--- a/src/Metadata/CoversNothing.php
+++ b/src/Metadata/CoversNothing.php
@@ -16,6 +16,9 @@
*/
final class CoversNothing extends Metadata
{
+ /**
+ * @psalm-assert-if-true CoversNothing $this
+ */
public function isCoversNothing(): bool
{
return true;
diff --git a/src/Metadata/DataProvider.php b/src/Metadata/DataProvider.php
index cef1d00747d..d1a0bfd592a 100644
--- a/src/Metadata/DataProvider.php
+++ b/src/Metadata/DataProvider.php
@@ -20,10 +20,16 @@ final class DataProvider extends Metadata
* @psalm-var class-string
*/
private readonly string $className;
+
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $methodName;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
protected function __construct(int $level, string $className, string $methodName)
{
@@ -33,6 +39,9 @@ protected function __construct(int $level, string $className, string $methodName
$this->methodName = $methodName;
}
+ /**
+ * @psalm-assert-if-true DataProvider $this
+ */
public function isDataProvider(): bool
{
return true;
@@ -46,6 +55,9 @@ public function className(): string
return $this->className;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function methodName(): string
{
return $this->methodName;
diff --git a/src/Metadata/DependsOnClass.php b/src/Metadata/DependsOnClass.php
index 7fa190b5e69..c146afd9594 100644
--- a/src/Metadata/DependsOnClass.php
+++ b/src/Metadata/DependsOnClass.php
@@ -24,6 +24,7 @@ final class DependsOnClass extends Metadata
private readonly bool $shallowClone;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className, bool $deepClone, bool $shallowClone)
@@ -35,6 +36,9 @@ protected function __construct(int $level, string $className, bool $deepClone, b
$this->shallowClone = $shallowClone;
}
+ /**
+ * @psalm-assert-if-true DependsOnClass $this
+ */
public function isDependsOnClass(): bool
{
return true;
diff --git a/src/Metadata/DependsOnMethod.php b/src/Metadata/DependsOnMethod.php
index 4f76846e947..1db27c7bfd0 100644
--- a/src/Metadata/DependsOnMethod.php
+++ b/src/Metadata/DependsOnMethod.php
@@ -20,12 +20,18 @@ final class DependsOnMethod extends Metadata
* @psalm-var class-string
*/
private readonly string $className;
+
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $methodName;
private readonly bool $deepClone;
private readonly bool $shallowClone;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
protected function __construct(int $level, string $className, string $methodName, bool $deepClone, bool $shallowClone)
{
@@ -37,6 +43,9 @@ protected function __construct(int $level, string $className, string $methodName
$this->shallowClone = $shallowClone;
}
+ /**
+ * @psalm-assert-if-true DependsOnMethod $this
+ */
public function isDependsOnMethod(): bool
{
return true;
@@ -50,6 +59,9 @@ public function className(): string
return $this->className;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function methodName(): string
{
return $this->methodName;
diff --git a/src/Metadata/DoesNotPerformAssertions.php b/src/Metadata/DoesNotPerformAssertions.php
index 9ae0bfd6f83..0e1ac0e7451 100644
--- a/src/Metadata/DoesNotPerformAssertions.php
+++ b/src/Metadata/DoesNotPerformAssertions.php
@@ -16,6 +16,9 @@
*/
final class DoesNotPerformAssertions extends Metadata
{
+ /**
+ * @psalm-assert-if-true DoesNotPerformAssertions $this
+ */
public function isDoesNotPerformAssertions(): bool
{
return true;
diff --git a/src/Metadata/ExcludeGlobalVariableFromBackup.php b/src/Metadata/ExcludeGlobalVariableFromBackup.php
index 71115868710..a096d676b2d 100644
--- a/src/Metadata/ExcludeGlobalVariableFromBackup.php
+++ b/src/Metadata/ExcludeGlobalVariableFromBackup.php
@@ -16,8 +16,15 @@
*/
final class ExcludeGlobalVariableFromBackup extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $globalVariableName;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $globalVariableName
+ */
protected function __construct(int $level, string $globalVariableName)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $globalVariableName)
$this->globalVariableName = $globalVariableName;
}
+ /**
+ * @psalm-assert-if-true ExcludeGlobalVariableFromBackup $this
+ */
public function isExcludeGlobalVariableFromBackup(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function globalVariableName(): string
{
return $this->globalVariableName;
diff --git a/src/Metadata/ExcludeStaticPropertyFromBackup.php b/src/Metadata/ExcludeStaticPropertyFromBackup.php
index 50ac2fbd5b6..53a3c523aeb 100644
--- a/src/Metadata/ExcludeStaticPropertyFromBackup.php
+++ b/src/Metadata/ExcludeStaticPropertyFromBackup.php
@@ -20,10 +20,16 @@ final class ExcludeStaticPropertyFromBackup extends Metadata
* @psalm-var class-string
*/
private readonly string $className;
+
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $propertyName;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $propertyName
*/
protected function __construct(int $level, string $className, string $propertyName)
{
@@ -33,6 +39,9 @@ protected function __construct(int $level, string $className, string $propertyNa
$this->propertyName = $propertyName;
}
+ /**
+ * @psalm-assert-if-true ExcludeStaticPropertyFromBackup $this
+ */
public function isExcludeStaticPropertyFromBackup(): bool
{
return true;
@@ -46,6 +55,9 @@ public function className(): string
return $this->className;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function propertyName(): string
{
return $this->propertyName;
diff --git a/src/Metadata/Group.php b/src/Metadata/Group.php
index 1be2aa5b796..e609d2ed6ef 100644
--- a/src/Metadata/Group.php
+++ b/src/Metadata/Group.php
@@ -16,8 +16,15 @@
*/
final class Group extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $groupName;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $groupName
+ */
protected function __construct(int $level, string $groupName)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $groupName)
$this->groupName = $groupName;
}
+ /**
+ * @psalm-assert-if-true Group $this
+ */
public function isGroup(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function groupName(): string
{
return $this->groupName;
diff --git a/src/Metadata/IgnoreClassForCodeCoverage.php b/src/Metadata/IgnoreClassForCodeCoverage.php
index 4f8ca39ea01..df5b6475f2a 100644
--- a/src/Metadata/IgnoreClassForCodeCoverage.php
+++ b/src/Metadata/IgnoreClassForCodeCoverage.php
@@ -22,6 +22,7 @@ final class IgnoreClassForCodeCoverage extends Metadata
private readonly string $className;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className)
@@ -31,6 +32,9 @@ protected function __construct(int $level, string $className)
$this->className = $className;
}
+ /**
+ * @psalm-assert-if-true IgnoreClassForCodeCoverage $this
+ */
public function isIgnoreClassForCodeCoverage(): bool
{
return true;
diff --git a/src/Metadata/IgnoreFunctionForCodeCoverage.php b/src/Metadata/IgnoreFunctionForCodeCoverage.php
index 8299f957ceb..3443fc4f082 100644
--- a/src/Metadata/IgnoreFunctionForCodeCoverage.php
+++ b/src/Metadata/IgnoreFunctionForCodeCoverage.php
@@ -22,6 +22,7 @@ final class IgnoreFunctionForCodeCoverage extends Metadata
private readonly string $functionName;
/**
+ * @psalm-param 0|1 $level
* @psalm-param non-empty-string $functionName
*/
protected function __construct(int $level, string $functionName)
@@ -31,11 +32,17 @@ protected function __construct(int $level, string $functionName)
$this->functionName = $functionName;
}
+ /**
+ * @psalm-assert-if-true IgnoreFunctionForCodeCoverage $this
+ */
public function isIgnoreFunctionForCodeCoverage(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function functionName(): string
{
return $this->functionName;
diff --git a/src/Metadata/IgnoreMethodForCodeCoverage.php b/src/Metadata/IgnoreMethodForCodeCoverage.php
index 51e37475e45..3243b45c37f 100644
--- a/src/Metadata/IgnoreMethodForCodeCoverage.php
+++ b/src/Metadata/IgnoreMethodForCodeCoverage.php
@@ -27,6 +27,7 @@ final class IgnoreMethodForCodeCoverage extends Metadata
private readonly string $methodName;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
* @psalm-param non-empty-string $methodName
*/
@@ -38,6 +39,9 @@ protected function __construct(int $level, string $className, string $methodName
$this->methodName = $methodName;
}
+ /**
+ * @psalm-assert-if-true IgnoreMethodForCodeCoverage $this
+ */
public function isIgnoreMethodForCodeCoverage(): bool
{
return true;
diff --git a/src/Metadata/Metadata.php b/src/Metadata/Metadata.php
index 05714aa3c25..5821cf61d17 100644
--- a/src/Metadata/Metadata.php
+++ b/src/Metadata/Metadata.php
@@ -20,6 +20,10 @@ abstract class Metadata
{
private const CLASS_LEVEL = 0;
private const METHOD_LEVEL = 1;
+
+ /**
+ * @psalm-var 0|1
+ */
private readonly int $level;
public static function after(): After
@@ -70,16 +74,25 @@ public static function coversClass(string $className): CoversClass
return new CoversClass(self::CLASS_LEVEL, $className);
}
+ /**
+ * @psalm-param non-empty-string $functionName
+ */
public static function coversFunction(string $functionName): CoversFunction
{
return new CoversFunction(self::CLASS_LEVEL, $functionName);
}
+ /**
+ * @psalm-param non-empty-string $target
+ */
public static function coversOnClass(string $target): Covers
{
return new Covers(self::CLASS_LEVEL, $target);
}
+ /**
+ * @psalm-param non-empty-string $target
+ */
public static function coversOnMethod(string $target): Covers
{
return new Covers(self::METHOD_LEVEL, $target);
@@ -105,17 +118,25 @@ public static function coversNothingOnMethod(): CoversNothing
/**
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
public static function dataProvider(string $className, string $methodName): DataProvider
{
return new DataProvider(self::METHOD_LEVEL, $className, $methodName);
}
+ /**
+ * @psalm-param class-string $className
+ */
public static function dependsOnClass(string $className, bool $deepClone, bool $shallowClone): DependsOnClass
{
return new DependsOnClass(self::METHOD_LEVEL, $className, $deepClone, $shallowClone);
}
+ /**
+ * @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
+ */
public static function dependsOnMethod(string $className, string $methodName, bool $deepClone, bool $shallowClone): DependsOnMethod
{
return new DependsOnMethod(self::METHOD_LEVEL, $className, $methodName, $deepClone, $shallowClone);
@@ -131,11 +152,17 @@ public static function doesNotPerformAssertionsOnMethod(): DoesNotPerformAsserti
return new DoesNotPerformAssertions(self::METHOD_LEVEL);
}
+ /**
+ * @psalm-param non-empty-string $globalVariableName
+ */
public static function excludeGlobalVariableFromBackupOnClass(string $globalVariableName): ExcludeGlobalVariableFromBackup
{
return new ExcludeGlobalVariableFromBackup(self::CLASS_LEVEL, $globalVariableName);
}
+ /**
+ * @psalm-param non-empty-string $globalVariableName
+ */
public static function excludeGlobalVariableFromBackupOnMethod(string $globalVariableName): ExcludeGlobalVariableFromBackup
{
return new ExcludeGlobalVariableFromBackup(self::METHOD_LEVEL, $globalVariableName);
@@ -143,6 +170,7 @@ public static function excludeGlobalVariableFromBackupOnMethod(string $globalVar
/**
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $propertyName
*/
public static function excludeStaticPropertyFromBackupOnClass(string $className, string $propertyName): ExcludeStaticPropertyFromBackup
{
@@ -151,17 +179,24 @@ public static function excludeStaticPropertyFromBackupOnClass(string $className,
/**
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $propertyName
*/
public static function excludeStaticPropertyFromBackupOnMethod(string $className, string $propertyName): ExcludeStaticPropertyFromBackup
{
return new ExcludeStaticPropertyFromBackup(self::METHOD_LEVEL, $className, $propertyName);
}
+ /**
+ * @psalm-param non-empty-string $groupName
+ */
public static function groupOnClass(string $groupName): Group
{
return new Group(self::CLASS_LEVEL, $groupName);
}
+ /**
+ * @psalm-param non-empty-string $groupName
+ */
public static function groupOnMethod(string $groupName): Group
{
return new Group(self::METHOD_LEVEL, $groupName);
@@ -212,11 +247,17 @@ public static function preserveGlobalStateOnMethod(bool $enabled): PreserveGloba
return new PreserveGlobalState(self::METHOD_LEVEL, $enabled);
}
+ /**
+ * @psalm-param non-empty-string $functionName
+ */
public static function requiresFunctionOnClass(string $functionName): RequiresFunction
{
return new RequiresFunction(self::CLASS_LEVEL, $functionName);
}
+ /**
+ * @psalm-param non-empty-string $functionName
+ */
public static function requiresFunctionOnMethod(string $functionName): RequiresFunction
{
return new RequiresFunction(self::METHOD_LEVEL, $functionName);
@@ -224,6 +265,7 @@ public static function requiresFunctionOnMethod(string $functionName): RequiresF
/**
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
public static function requiresMethodOnClass(string $className, string $methodName): RequiresMethod
{
@@ -232,27 +274,40 @@ public static function requiresMethodOnClass(string $className, string $methodNa
/**
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
public static function requiresMethodOnMethod(string $className, string $methodName): RequiresMethod
{
return new RequiresMethod(self::METHOD_LEVEL, $className, $methodName);
}
+ /**
+ * @psalm-param non-empty-string $operatingSystem
+ */
public static function requiresOperatingSystemOnClass(string $operatingSystem): RequiresOperatingSystem
{
return new RequiresOperatingSystem(self::CLASS_LEVEL, $operatingSystem);
}
+ /**
+ * @psalm-param non-empty-string $operatingSystem
+ */
public static function requiresOperatingSystemOnMethod(string $operatingSystem): RequiresOperatingSystem
{
return new RequiresOperatingSystem(self::METHOD_LEVEL, $operatingSystem);
}
+ /**
+ * @psalm-param non-empty-string $operatingSystemFamily
+ */
public static function requiresOperatingSystemFamilyOnClass(string $operatingSystemFamily): RequiresOperatingSystemFamily
{
return new RequiresOperatingSystemFamily(self::CLASS_LEVEL, $operatingSystemFamily);
}
+ /**
+ * @psalm-param non-empty-string $operatingSystemFamily
+ */
public static function requiresOperatingSystemFamilyOnMethod(string $operatingSystemFamily): RequiresOperatingSystemFamily
{
return new RequiresOperatingSystemFamily(self::METHOD_LEVEL, $operatingSystemFamily);
@@ -268,11 +323,17 @@ public static function requiresPhpOnMethod(Requirement $versionRequirement): Req
return new RequiresPhp(self::METHOD_LEVEL, $versionRequirement);
}
+ /**
+ * @psalm-param non-empty-string $extension
+ */
public static function requiresPhpExtensionOnClass(string $extension, ?Requirement $versionRequirement): RequiresPhpExtension
{
return new RequiresPhpExtension(self::CLASS_LEVEL, $extension, $versionRequirement);
}
+ /**
+ * @psalm-param non-empty-string $extension
+ */
public static function requiresPhpExtensionOnMethod(string $extension, ?Requirement $versionRequirement): RequiresPhpExtension
{
return new RequiresPhpExtension(self::METHOD_LEVEL, $extension, $versionRequirement);
@@ -288,11 +349,19 @@ public static function requiresPhpunitOnMethod(Requirement $versionRequirement):
return new RequiresPhpunit(self::METHOD_LEVEL, $versionRequirement);
}
+ /**
+ * @psalm-param non-empty-string $setting
+ * @psalm-param non-empty-string $value
+ */
public static function requiresSettingOnClass(string $setting, string $value): RequiresSetting
{
return new RequiresSetting(self::CLASS_LEVEL, $setting, $value);
}
+ /**
+ * @psalm-param non-empty-string $setting
+ * @psalm-param non-empty-string $value
+ */
public static function requiresSettingOnMethod(string $setting, string $value): RequiresSetting
{
return new RequiresSetting(self::METHOD_LEVEL, $setting, $value);
@@ -318,11 +387,17 @@ public static function test(): Test
return new Test(self::METHOD_LEVEL);
}
+ /**
+ * @psalm-param non-empty-string $text
+ */
public static function testDoxOnClass(string $text): TestDox
{
return new TestDox(self::CLASS_LEVEL, $text);
}
+ /**
+ * @psalm-param non-empty-string $text
+ */
public static function testDoxOnMethod(string $text): TestDox
{
return new TestDox(self::METHOD_LEVEL, $text);
@@ -341,16 +416,25 @@ public static function usesClass(string $className): UsesClass
return new UsesClass(self::CLASS_LEVEL, $className);
}
+ /**
+ * @psalm-param non-empty-string $functionName
+ */
public static function usesFunction(string $functionName): UsesFunction
{
return new UsesFunction(self::CLASS_LEVEL, $functionName);
}
+ /**
+ * @psalm-param non-empty-string $target
+ */
public static function usesOnClass(string $target): Uses
{
return new Uses(self::CLASS_LEVEL, $target);
}
+ /**
+ * @psalm-param non-empty-string $target
+ */
public static function usesOnMethod(string $target): Uses
{
return new Uses(self::METHOD_LEVEL, $target);
@@ -369,6 +453,9 @@ public static function withoutErrorHandler(): WithoutErrorHandler
return new WithoutErrorHandler(self::METHOD_LEVEL);
}
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level)
{
$this->level = $level;
@@ -504,11 +591,17 @@ public function isDoesNotPerformAssertions(): bool
return false;
}
+ /**
+ * @psalm-assert-if-true ExcludeGlobalVariableFromBackup $this
+ */
public function isExcludeGlobalVariableFromBackup(): bool
{
return false;
}
+ /**
+ * @psalm-assert-if-true ExcludeStaticPropertyFromBackup $this
+ */
public function isExcludeStaticPropertyFromBackup(): bool
{
return false;
diff --git a/src/Metadata/PostCondition.php b/src/Metadata/PostCondition.php
index e14bc05d9f8..1e30f550fb1 100644
--- a/src/Metadata/PostCondition.php
+++ b/src/Metadata/PostCondition.php
@@ -16,6 +16,9 @@
*/
final class PostCondition extends Metadata
{
+ /**
+ * @psalm-assert-if-true PostCondition $this
+ */
public function isPostCondition(): bool
{
return true;
diff --git a/src/Metadata/PreCondition.php b/src/Metadata/PreCondition.php
index c6f3deea063..4691f113d16 100644
--- a/src/Metadata/PreCondition.php
+++ b/src/Metadata/PreCondition.php
@@ -16,6 +16,9 @@
*/
final class PreCondition extends Metadata
{
+ /**
+ * @psalm-assert-if-true PreCondition $this
+ */
public function isPreCondition(): bool
{
return true;
diff --git a/src/Metadata/PreserveGlobalState.php b/src/Metadata/PreserveGlobalState.php
index 83cea03a616..521af6d63c9 100644
--- a/src/Metadata/PreserveGlobalState.php
+++ b/src/Metadata/PreserveGlobalState.php
@@ -18,6 +18,9 @@ final class PreserveGlobalState extends Metadata
{
private readonly bool $enabled;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, bool $enabled)
{
parent::__construct($level);
@@ -25,6 +28,9 @@ protected function __construct(int $level, bool $enabled)
$this->enabled = $enabled;
}
+ /**
+ * @psalm-assert-if-true PreserveGlobalState $this
+ */
public function isPreserveGlobalState(): bool
{
return true;
diff --git a/src/Metadata/RequiresFunction.php b/src/Metadata/RequiresFunction.php
index 97d3fe28153..638d35c0711 100644
--- a/src/Metadata/RequiresFunction.php
+++ b/src/Metadata/RequiresFunction.php
@@ -16,8 +16,15 @@
*/
final class RequiresFunction extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $functionName;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $functionName
+ */
protected function __construct(int $level, string $functionName)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $functionName)
$this->functionName = $functionName;
}
+ /**
+ * @psalm-assert-if-true RequiresFunction $this
+ */
public function isRequiresFunction(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function functionName(): string
{
return $this->functionName;
diff --git a/src/Metadata/RequiresMethod.php b/src/Metadata/RequiresMethod.php
index 9f4539931ef..45d611ffa88 100644
--- a/src/Metadata/RequiresMethod.php
+++ b/src/Metadata/RequiresMethod.php
@@ -20,10 +20,16 @@ final class RequiresMethod extends Metadata
* @psalm-var class-string
*/
private readonly string $className;
+
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $methodName;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
+ * @psalm-param non-empty-string $methodName
*/
protected function __construct(int $level, string $className, string $methodName)
{
@@ -33,6 +39,9 @@ protected function __construct(int $level, string $className, string $methodName
$this->methodName = $methodName;
}
+ /**
+ * @psalm-assert-if-true RequiresMethod $this
+ */
public function isRequiresMethod(): bool
{
return true;
@@ -46,6 +55,9 @@ public function className(): string
return $this->className;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function methodName(): string
{
return $this->methodName;
diff --git a/src/Metadata/RequiresOperatingSystem.php b/src/Metadata/RequiresOperatingSystem.php
index 94ebe1fcb43..a2b0de4f473 100644
--- a/src/Metadata/RequiresOperatingSystem.php
+++ b/src/Metadata/RequiresOperatingSystem.php
@@ -16,8 +16,15 @@
*/
final class RequiresOperatingSystem extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $operatingSystem;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $operatingSystem
+ */
public function __construct(int $level, string $operatingSystem)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ public function __construct(int $level, string $operatingSystem)
$this->operatingSystem = $operatingSystem;
}
+ /**
+ * @psalm-assert-if-true RequiresOperatingSystem $this
+ */
public function isRequiresOperatingSystem(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function operatingSystem(): string
{
return $this->operatingSystem;
diff --git a/src/Metadata/RequiresOperatingSystemFamily.php b/src/Metadata/RequiresOperatingSystemFamily.php
index 7179512ba1c..8418274800b 100644
--- a/src/Metadata/RequiresOperatingSystemFamily.php
+++ b/src/Metadata/RequiresOperatingSystemFamily.php
@@ -16,8 +16,15 @@
*/
final class RequiresOperatingSystemFamily extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $operatingSystemFamily;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $operatingSystemFamily
+ */
protected function __construct(int $level, string $operatingSystemFamily)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $operatingSystemFamily)
$this->operatingSystemFamily = $operatingSystemFamily;
}
+ /**
+ * @psalm-assert-if-true RequiresOperatingSystemFamily $this
+ */
public function isRequiresOperatingSystemFamily(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function operatingSystemFamily(): string
{
return $this->operatingSystemFamily;
diff --git a/src/Metadata/RequiresPhp.php b/src/Metadata/RequiresPhp.php
index 038deb7f4d5..e73bfb40294 100644
--- a/src/Metadata/RequiresPhp.php
+++ b/src/Metadata/RequiresPhp.php
@@ -20,6 +20,9 @@ final class RequiresPhp extends Metadata
{
private readonly Requirement $versionRequirement;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, Requirement $versionRequirement)
{
parent::__construct($level);
@@ -27,6 +30,9 @@ protected function __construct(int $level, Requirement $versionRequirement)
$this->versionRequirement = $versionRequirement;
}
+ /**
+ * @psalm-assert-if-true RequiresPhp $this
+ */
public function isRequiresPhp(): bool
{
return true;
diff --git a/src/Metadata/RequiresPhpExtension.php b/src/Metadata/RequiresPhpExtension.php
index 6447a145766..053b89665c5 100644
--- a/src/Metadata/RequiresPhpExtension.php
+++ b/src/Metadata/RequiresPhpExtension.php
@@ -18,9 +18,16 @@
*/
final class RequiresPhpExtension extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $extension;
private readonly ?Requirement $versionRequirement;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $extension
+ */
protected function __construct(int $level, string $extension, ?Requirement $versionRequirement)
{
parent::__construct($level);
@@ -29,11 +36,17 @@ protected function __construct(int $level, string $extension, ?Requirement $vers
$this->versionRequirement = $versionRequirement;
}
+ /**
+ * @psalm-assert-if-true RequiresPhpExtension $this
+ */
public function isRequiresPhpExtension(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function extension(): string
{
return $this->extension;
diff --git a/src/Metadata/RequiresPhpunit.php b/src/Metadata/RequiresPhpunit.php
index 1c2611f9883..250190e58de 100644
--- a/src/Metadata/RequiresPhpunit.php
+++ b/src/Metadata/RequiresPhpunit.php
@@ -20,6 +20,9 @@ final class RequiresPhpunit extends Metadata
{
private readonly Requirement $versionRequirement;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, Requirement $versionRequirement)
{
parent::__construct($level);
@@ -27,6 +30,9 @@ protected function __construct(int $level, Requirement $versionRequirement)
$this->versionRequirement = $versionRequirement;
}
+ /**
+ * @psalm-assert-if-true RequiresPhpunit $this
+ */
public function isRequiresPhpunit(): bool
{
return true;
diff --git a/src/Metadata/RequiresSetting.php b/src/Metadata/RequiresSetting.php
index 4c0e6a20f1c..03f710d713a 100644
--- a/src/Metadata/RequiresSetting.php
+++ b/src/Metadata/RequiresSetting.php
@@ -16,9 +16,21 @@
*/
final class RequiresSetting extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $setting;
+
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $value;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $setting
+ * @psalm-param non-empty-string $value
+ */
protected function __construct(int $level, string $setting, string $value)
{
parent::__construct($level);
@@ -27,16 +39,25 @@ protected function __construct(int $level, string $setting, string $value)
$this->value = $value;
}
+ /**
+ * @psalm-assert-if-true RequiresSetting $this
+ */
public function isRequiresSetting(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function setting(): string
{
return $this->setting;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function value(): string
{
return $this->value;
diff --git a/src/Metadata/RunClassInSeparateProcess.php b/src/Metadata/RunClassInSeparateProcess.php
index 10acd71a25e..eb0b7742f60 100644
--- a/src/Metadata/RunClassInSeparateProcess.php
+++ b/src/Metadata/RunClassInSeparateProcess.php
@@ -16,6 +16,9 @@
*/
final class RunClassInSeparateProcess extends Metadata
{
+ /**
+ * @psalm-assert-if-true RunClassInSeparateProcess $this
+ */
public function isRunClassInSeparateProcess(): bool
{
return true;
diff --git a/src/Metadata/RunInSeparateProcess.php b/src/Metadata/RunInSeparateProcess.php
index 18c63348a98..62d552aece6 100644
--- a/src/Metadata/RunInSeparateProcess.php
+++ b/src/Metadata/RunInSeparateProcess.php
@@ -16,6 +16,9 @@
*/
final class RunInSeparateProcess extends Metadata
{
+ /**
+ * @psalm-assert-if-true RunInSeparateProcess $this
+ */
public function isRunInSeparateProcess(): bool
{
return true;
diff --git a/src/Metadata/RunTestsInSeparateProcesses.php b/src/Metadata/RunTestsInSeparateProcesses.php
index f43d9dd877a..ea0807a5f2a 100644
--- a/src/Metadata/RunTestsInSeparateProcesses.php
+++ b/src/Metadata/RunTestsInSeparateProcesses.php
@@ -16,6 +16,9 @@
*/
final class RunTestsInSeparateProcesses extends Metadata
{
+ /**
+ * @psalm-assert-if-true RunTestsInSeparateProcesses $this
+ */
public function isRunTestsInSeparateProcesses(): bool
{
return true;
diff --git a/src/Metadata/Test.php b/src/Metadata/Test.php
index 60e2acee6bd..6d2aeecdd3f 100644
--- a/src/Metadata/Test.php
+++ b/src/Metadata/Test.php
@@ -16,6 +16,9 @@
*/
final class Test extends Metadata
{
+ /**
+ * @psalm-assert-if-true Test $this
+ */
public function isTest(): bool
{
return true;
diff --git a/src/Metadata/TestDox.php b/src/Metadata/TestDox.php
index 50c5ecc7444..d78d86cf5f1 100644
--- a/src/Metadata/TestDox.php
+++ b/src/Metadata/TestDox.php
@@ -16,8 +16,15 @@
*/
final class TestDox extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $text;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $text
+ */
protected function __construct(int $level, string $text)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $text)
$this->text = $text;
}
+ /**
+ * @psalm-assert-if-true TestDox $this
+ */
public function isTestDox(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function text(): string
{
return $this->text;
diff --git a/src/Metadata/TestWith.php b/src/Metadata/TestWith.php
index 2d7a5e75de1..98bef73d53f 100644
--- a/src/Metadata/TestWith.php
+++ b/src/Metadata/TestWith.php
@@ -18,6 +18,9 @@ final class TestWith extends Metadata
{
private readonly array $data;
+ /**
+ * @psalm-param 0|1 $level
+ */
protected function __construct(int $level, array $data)
{
parent::__construct($level);
@@ -25,6 +28,9 @@ protected function __construct(int $level, array $data)
$this->data = $data;
}
+ /**
+ * @psalm-assert-if-true TestWith $this
+ */
public function isTestWith(): bool
{
return true;
diff --git a/src/Metadata/Uses.php b/src/Metadata/Uses.php
index 96c29642df3..d3fa216bb62 100644
--- a/src/Metadata/Uses.php
+++ b/src/Metadata/Uses.php
@@ -16,8 +16,15 @@
*/
final class Uses extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $target;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $target
+ */
protected function __construct(int $level, string $target)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ protected function __construct(int $level, string $target)
$this->target = $target;
}
+ /**
+ * @psalm-assert-if-true Uses $this
+ */
public function isUses(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function target(): string
{
return $this->target;
diff --git a/src/Metadata/UsesClass.php b/src/Metadata/UsesClass.php
index 5bf09fce094..01e7741e6bd 100644
--- a/src/Metadata/UsesClass.php
+++ b/src/Metadata/UsesClass.php
@@ -22,6 +22,7 @@ final class UsesClass extends Metadata
private readonly string $className;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className)
@@ -31,6 +32,9 @@ protected function __construct(int $level, string $className)
$this->className = $className;
}
+ /**
+ * @psalm-assert-if-true UsesClass $this
+ */
public function isUsesClass(): bool
{
return true;
diff --git a/src/Metadata/UsesDefaultClass.php b/src/Metadata/UsesDefaultClass.php
index a6bf867492c..48a82471037 100644
--- a/src/Metadata/UsesDefaultClass.php
+++ b/src/Metadata/UsesDefaultClass.php
@@ -22,6 +22,7 @@ final class UsesDefaultClass extends Metadata
private readonly string $className;
/**
+ * @psalm-param 0|1 $level
* @psalm-param class-string $className
*/
protected function __construct(int $level, string $className)
@@ -31,6 +32,9 @@ protected function __construct(int $level, string $className)
$this->className = $className;
}
+ /**
+ * @psalm-assert-if-true UsesDefaultClass $this
+ */
public function isUsesDefaultClass(): bool
{
return true;
diff --git a/src/Metadata/UsesFunction.php b/src/Metadata/UsesFunction.php
index a55aaddf617..8c46e76bfda 100644
--- a/src/Metadata/UsesFunction.php
+++ b/src/Metadata/UsesFunction.php
@@ -16,8 +16,15 @@
*/
final class UsesFunction extends Metadata
{
+ /**
+ * @psalm-var non-empty-string
+ */
private readonly string $functionName;
+ /**
+ * @psalm-param 0|1 $level
+ * @psalm-param non-empty-string $functionName
+ */
public function __construct(int $level, string $functionName)
{
parent::__construct($level);
@@ -25,11 +32,17 @@ public function __construct(int $level, string $functionName)
$this->functionName = $functionName;
}
+ /**
+ * @psalm-assert-if-true UsesFunction $this
+ */
public function isUsesFunction(): bool
{
return true;
}
+ /**
+ * @psalm-return non-empty-string
+ */
public function functionName(): string
{
return $this->functionName;
diff --git a/src/Metadata/WithoutErrorHandler.php b/src/Metadata/WithoutErrorHandler.php
index 6d5dafb0be9..d10f41e680f 100644
--- a/src/Metadata/WithoutErrorHandler.php
+++ b/src/Metadata/WithoutErrorHandler.php
@@ -16,6 +16,9 @@
*/
final class WithoutErrorHandler extends Metadata
{
+ /**
+ * @psalm-assert-if-true WithoutErrorHandler $this
+ */
public function isWithoutErrorHandler(): bool
{
return true;