Skip to content

Commit

Permalink
FIX: regenerated the files without losing support for date
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharhamel committed Jun 9, 2022
1 parent 2c8b08c commit f1f0a70
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
25 changes: 22 additions & 3 deletions generated/datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,21 @@ function date_parse_from_format(string $format, string $datetime): ?array


/**
*
* date_parse parses the given
* datetime string according to the same rules as
* strtotime and
* DateTimeImmutable::__construct. Instead of returning a
* Unix timestamp (with strtotime) or a
* DateTimeImmutable object (with
* DateTimeImmutable::__construct, it returns an
* associative array with the information that it could detect in the given
* datetime string.
*
* If no information about a certain group of elements can be found, these
* array elements will be set to FALSE or are missing. If needed for
* constructing a timestamp or DateTimeImmutable object from
* the same datetime string, more fields can be set to
* a non-FALSE value. See the examples for cases where that happens.
*
* @param string $datetime Date/time in format accepted by
* DateTimeImmutable::__construct.
Expand Down Expand Up @@ -359,10 +373,15 @@ function date_sunset(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, fl

/**
* Returns a string formatted according to the given format string using the
* given integer timestamp or the current time
* if no timestamp is given. In other words, timestamp
* given integer timestamp (Unix timestamp) or the current time
* if no timestamp is given. In other words, timestamp
* is optional and defaults to the value of time.
*
* Unix timestamps do not handle timezones. Use the
* DateTimeImmutable class, and its
* DateTimeInterface::format formatting method to
* format date/time information with a timezone attached.
*
* @param string $format Format accepted by DateTimeInterface::format.
* @param int $timestamp The optional timestamp parameter is an
* int Unix timestamp that defaults to the current
Expand Down
2 changes: 1 addition & 1 deletion generated/openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ function openssl_csr_sign($csr, $ca_certificate, $private_key, int $days, array
* OPENSSL_ZERO_PADDING.
* @param string $iv A non-NULL Initialization Vector.
* @param string $tag The authentication tag in AEAD cipher mode. If it is incorrect, the authentication fails and the function returns FALSE.
* @param string $aad Additional authentication data.
* @param string $aad Additional authenticated data.
* @return string The decrypted string on success.
* @throws OpensslException
*
Expand Down
2 changes: 1 addition & 1 deletion generator/src/DocPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function detectFalsyFunction(): bool
return true;
}
//used for date
if (preg_match('/If a non-numeric value is used for
if (preg_match('/If a non-numeric value is used for
\<parameter\>timestamp\<\/parameter\>, &false; is returned/m', $returnValuesSection)) {
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions generator/tests/PhpStanFunctions/PhpStanTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public function testErrorTypeInteraction(): void
$param = new PhpStanType('int|null');
$this->assertEquals('int', $param->getDocBlockType(Method::NULLSY_TYPE));
$this->assertEquals('int', $param->getSignatureType(Method::NULLSY_TYPE));

$param = new PhpStanType('array|false|null');
$this->assertEquals('array|null', $param->getDocBlockType(Method::FALSY_TYPE));
$this->assertEquals('?array', $param->getSignatureType(Method::FALSY_TYPE));
}

public function testDuplicateType(): void
Expand Down

0 comments on commit f1f0a70

Please sign in to comment.