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 * @link https://www.php.net/manual/en/weakreference.create.php
* @param object $referent The object to be weakly referenced. * @param object $referent The object to be weakly referenced.
* @return WeakReference the freshly instantiated object. * @return WeakReference the freshly instantiated object.
* @since 7.4.0 * @since 7.4
*/ */
public static function create(object $referent): WeakReference {} public static function create(object $referent): WeakReference {}
@ -656,7 +656,7 @@ class WeakReference {
* destroyed, NULL is returned. * destroyed, NULL is returned.
* @link https://www.php.net/manual/en/weakreference.get.php * @link https://www.php.net/manual/en/weakreference.get.php
* @return object|null * @return object|null
* @since 7.4.0 * @since 7.4
*/ */
public function get(): ?object {} 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>, * <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. * which means that values starting with @ can be safely passed as fields.
* @link https://www.php.net/manual/en/function.curl-setopt.php * @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. * @deprecated 7.0 Use <b>CURLFile</b> for uploads instead.
*/ */
define ('CURLOPT_SAFE_UPLOAD', -1); define ('CURLOPT_SAFE_UPLOAD', -1);

View File

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

View File

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