Skip to content

Commit 204aef2

Browse files
jderussemoufmouf
authored andcommitted
Removing parameters that have been removed from PHP before 7.1
1 parent 0b22dca commit 204aef2

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

generated/datetime.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -370,32 +370,17 @@ function date_sunset(int $timestamp, int $format = SUNFUNCS_RET_STRING, float $l
370370
* most common today, the valid range for year
371371
* is somewhere between 1901 and 2038. However, before PHP 5.1.0 this
372372
* range was limited from 1970 to 2038 on some systems (e.g. Windows).
373-
* @param int $is_dst This parameter can be set to 1 if the time is during daylight savings time (DST),
374-
* 0 if it is not, or -1 (the default) if it is unknown whether the time is within
375-
* daylight savings time or not. If it's unknown, PHP tries to figure it out itself.
376-
* This can cause unexpected (but not incorrect) results.
377-
* Some times are invalid if DST is enabled on the system PHP is running on or
378-
* is_dst is set to 1. If DST is enabled in e.g. 2:00, all times
379-
* between 2:00 and 3:00 are invalid and mktime returns an undefined
380-
* (usually negative) value.
381-
* Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 of the day when DST
382-
* is enabled is evaluated as 23:30 of the previous day.
383-
*
384-
* As of PHP 5.1.0, this parameter became deprecated. As a result, the
385-
* new timezone handling features should be used instead.
386-
*
387-
* This parameter has been removed in PHP 7.0.0.
388373
* @return int mktime returns the Unix timestamp of the arguments
389374
* given.
390375
* If the arguments are invalid, the function returns FALSE (before PHP 5.1
391376
* it returned -1).
392377
* @throws DatetimeException
393378
*
394379
*/
395-
function mktime(int $hour = null, int $minute = null, int $second = null, int $month = null, int $day = null, int $year = null, int $is_dst = -1): int
380+
function mktime(int $hour = null, int $minute = null, int $second = null, int $month = null, int $day = null, int $year = null): int
396381
{
397382
error_clear_last();
398-
$result = \mktime($hour, $minute, $second, $month, $day, $year, $is_dst);
383+
$result = \mktime($hour, $minute, $second, $month, $day, $year);
399384
if ($result === false) {
400385
throw DatetimeException::createFromPhpError();
401386
}

generator/src/Method.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,20 @@ public function getParams(): array
6868
}
6969
$phpStanFunction = $this->getPhpStanData();
7070
$params = [];
71+
$i=1;
7172
foreach ($this->functionObject->methodparam as $param) {
73+
$notes = $this->stripReturnFalseText($this->getStringForXPath("(//docbook:refsect1[@role='parameters']//docbook:varlistentry)[$i]//docbook:note//docbook:para"));
74+
$i++;
75+
76+
if (preg_match('/This parameter has been removed in PHP (\d+\.\d+\.\d+)/', $notes, $matches)) {
77+
$removedVersion = $matches[1];
78+
[$major, $minor, $fix] = explode('.', $removedVersion);
79+
if ($major < 7 || ($major == 7 && $minor == 0)) {
80+
// Ignore parameter if it was removed before PHP 7.1
81+
continue;
82+
}
83+
}
84+
7285
$params[] = new Parameter($param, $phpStanFunction);
7386
}
7487
$this->params = $params;

0 commit comments

Comments
 (0)