fix test for zero patch version

This commit is contained in:
Ivan Fedorov 2020-06-27 22:21:25 +03:00 committed by Ivan Fedorov
parent 95897b6278
commit 0535c570f7
5 changed files with 20 additions and 20 deletions

View File

@ -647,7 +647,7 @@ class WeakReference {
* @link https://www.php.net/manual/en/weakreference.create.php
* @param object $referent The object to be weakly referenced.
* @return WeakReference the freshly instantiated object.
* @since 7.4.0
* @since 7.4
*/
public static function create(object $referent): WeakReference {}
@ -656,7 +656,7 @@ class WeakReference {
* destroyed, NULL is returned.
* @link https://www.php.net/manual/en/weakreference.get.php
* @return object|null
* @since 7.4.0
* @since 7.4
*/
public function get(): ?object {}
}

View File

@ -1734,7 +1734,7 @@ define ('CURLOPT_FTP_SKIP_PASV_IP', 137);
* <b>TRUE</b> to disable support for the @ prefix for uploading files in <b>CURLOPT_POSTFIELDS</b>,
* which means that values starting with @ can be safely passed as fields.
* @link https://www.php.net/manual/en/function.curl-setopt.php
* @since 5.5.0
* @since 5.5
* @deprecated 7.0 Use <b>CURLFile</b> for uploads instead.
*/
define ('CURLOPT_SAFE_UPLOAD', -1);

View File

@ -836,7 +836,7 @@ function sodium_crypto_secretbox(
* @param string $key
* @return string|false
* @throws SodiumException
* @since 7.2.0
* @since 7.2
*/
function sodium_crypto_secretbox_open(
string $ciphertext,

View File

@ -7,6 +7,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Deprecated;
use phpDocumentor\Reflection\DocBlock\Tags\Since;
use RecursiveArrayIterator;
use RecursiveIteratorIterator;
use StubTests\Model\Tags\RemovedTag;
class Utils
{
@ -16,11 +17,11 @@ class Utils
}
/**
* @param Since|Deprecated $tag
* @param Since|Deprecated|RemovedTag $tag
* @return bool
*/
public static function versionIsMajor($tag): bool
public static function tagDoesNotHaveZeroPatchVersion($tag): bool
{
return (bool)preg_match('/[1-9]+\.\d+/',$tag->getVersion());
return (bool)preg_match('/^[1-9]+\.\d+(\.[1-9]+\d*)*$/',$tag->getVersion()); //find version like any but 7.4.0
}
}

View File

@ -173,7 +173,9 @@ class StubsTest extends TestCase
}
foreach ($class->properties as $property) {
$propertyName = $property->name;
if ($property->access === "private") continue;
if ($property->access === "private") {
continue;
}
if (!$property->hasMutedProblem(StubProblemType::STUB_IS_MISSED)) {
static::assertArrayHasKey(
$propertyName,
@ -418,10 +420,9 @@ class StubsTest extends TestCase
if ($sinceTag instanceof Since) {
$version = $sinceTag->getVersion();
if ($version !== null) {
self::assertTrue(Utils::versionIsMajor($sinceTag), "$elementName has 'since' version $version.
'Since' version for PHP Core functionallity should have X.X format due to functionallity usually
isn't added in patch updates. If you believe this is not correct, please submit an issue about your case at
https://youtrack.jetbrains.com/issues/WI");
self::assertTrue(Utils::tagDoesNotHaveZeroPatchVersion($sinceTag), "$elementName has
'since' version $version.'Since' version for PHP Core functionallity for style consistensy
should have X.X format for the case when patch version is '0'.");
}
}
}
@ -429,10 +430,9 @@ class StubsTest extends TestCase
if ($deprecatedTag instanceof Deprecated) {
$version = $deprecatedTag->getVersion();
if ($version !== null) {
self::assertTrue(Utils::versionIsMajor($deprecatedTag), "$elementName has 'deprecated' version $version .
'Deprecated' version for PHP Core functionallity should have X.X format due to functionallity usually
isn't deprecated in patch updates. If you believe this is not correct, please submit an issue about your case at
https://youtrack.jetbrains.com/issues/WI");
self::assertTrue(Utils::tagDoesNotHaveZeroPatchVersion($deprecatedTag), "$elementName has
'deprecated' version $version.'Deprecated' version for PHP Core functionallity for style consistensy
should have X.X format for the case when patch version is '0'.");
}
}
}
@ -440,10 +440,9 @@ class StubsTest extends TestCase
if ($removedTag instanceof RemovedTag) {
$version = $removedTag->getVersion();
if ($version !== null) {
self::assertTrue(Utils::versionIsMajor($removedTag), "$elementName has 'removed' version $version .
'removed' version for PHP Core functionallity should have X.X format due to functionallity usually
isn't removed in patch updates. If you believe this is not correct, please submit an issue about your case at
https://youtrack.jetbrains.com/issues/WI");
self::assertTrue(Utils::tagDoesNotHaveZeroPatchVersion($removedTag), "$elementName has
'removed' version $version.'Removed' version for PHP Core functionallity for style consistensy
should have X.X format for the case when patch version is '0'.");
}
}
}