Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php8 multiple signatures #950

Merged
merged 3 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions PDO/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Start of PDO v.1.0.4dev
use JetBrains\PhpStorm\ArrayShape;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Pure;
use JetBrains\PhpStorm\Deprecated;

Expand Down Expand Up @@ -977,6 +978,7 @@ public function setAttribute ($attribute, $value) {}
*/
public function exec ($statement) {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.2.0)<br/>
* Executes an SQL statement, returning a result set as a PDOStatement object
Expand All @@ -1003,6 +1005,30 @@ public function exec ($statement) {}
*/
public function query ($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = array()) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.2.0)<br/>
* Executes an SQL statement, returning a result set as a PDOStatement object
* @link https://php.net/manual/en/pdo.query.php
* @param string $statement <p>
* The SQL statement to prepare and execute.
* </p>
* <p>
* Data inside the query should be properly escaped.
* </p>
* @param int $mode <p>
* The fetch mode must be one of the PDO::FETCH_* constants.
* </p>
* @param mixed $fetch_mode_args <p>
* Arguments of custom class constructor when the <i>mode</i>
* parameter is set to <b>PDO::FETCH_CLASS</b>.
* </p>
* @return PDOStatement|false <b>PDO::query</b> returns a PDOStatement object, or <b>FALSE</b>
* on failure.
* @see PDOStatement::setFetchMode For a full description of the second and following parameters.
*/
public function query ($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, ...$fetch_mode_args) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it makes sense to add property and return types (including union types) directly to signatures for entities marked with #[PhpStormStubsElementAvailable('8.0')] ? Thus we will strict types and improve type inference.


/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.1.0)<br/>
* Returns the ID of the last inserted row or sequence value
Expand Down Expand Up @@ -1546,6 +1572,7 @@ public function columnCount () {}
*/
public function getColumnMeta ($column) {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.2.0)<br/>
* Set the default fetch mode for this statement
Expand All @@ -1561,6 +1588,22 @@ public function getColumnMeta ($column) {}
*/
public function setFetchMode ($mode, $className = null, array $params = array()) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.2.0)<br/>
* Set the default fetch mode for this statement
* @link https://php.net/manual/en/pdostatement.setfetchmode.php
* @param int $mode <p>
* The fetch mode must be one of the PDO::FETCH_* constants.
* </p>
* @param string|object $classNameObject [optional] <p>
* Class name or object
* </p>
* @param mixed ...$params <p> Constructor arguments. </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
public function setFetchMode ($mode, $className = null, ...$params) {}

/**
* (PHP 5 &gt;= 5.1.0, PHP 7, PECL pdo &gt;= 0.2.0)<br/>
* Advances to the next rowset in a multi-rowset statement handle
Expand Down
42 changes: 39 additions & 3 deletions curl/curl.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use JetBrains\PhpStorm\ArrayShape;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Pure;

class CURLFile {
Expand Down Expand Up @@ -75,6 +76,8 @@ public function setPostFilename($postname) {
public function __wakeup() {
}
}

#[PhpStormStubsElementAvailable('8.0')]
/**
* Initialize a cURL session
* @link https://php.net/manual/en/function.curl-init.php
Expand All @@ -83,7 +86,20 @@ public function __wakeup() {
* to its value. You can manually set this using the
* curl_setopt function.
* </p>
* @return resource|false|CurlHandle a cURL handle on success, false on errors.
* @return false|CurlHandle a cURL handle on success, false on errors.
*/
function curl_init ($url = null) {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* Initialize a cURL session
* @link https://php.net/manual/en/function.curl-init.php
* @param string $url [optional] <p>
* If provided, the CURLOPT_URL option will be set
* to its value. You can manually set this using the
* curl_setopt function.
* </p>
* @return resource|false a cURL handle on success, false on errors.
*/
function curl_init ($url = null) {}

Expand Down Expand Up @@ -2152,11 +2168,22 @@ function curl_setopt_array ($handle, array $options) {}
*/
function curl_share_close ($share_handle) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;=5.5.0)<br/>
* Initialize a cURL share handle
* @link https://secure.php.net/manual/en/function.curl-share-init.php
* @return CurlShareHandle Returns resource of type "cURL Share Handle".
* @since 5.5
*/
function curl_share_init () {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;=5.5.0)<br/>
* Initialize a cURL share handle
* @link https://secure.php.net/manual/en/function.curl-share-init.php
* @return resource|CurlShareHandle Returns resource of type "cURL Share Handle".
* @return resource Returns resource of type "cURL Share Handle".
* @since 5.5
*/
function curl_share_init () {}
Expand Down Expand Up @@ -2368,10 +2395,19 @@ function curl_file_create($filename, $mime_type = '', $posted_filename = '') {}
*/
function curl_close ($handle) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* Returns a new cURL multi handle
* @link https://php.net/manual/en/function.curl-multi-init.php
* @return false|CurlMultiHandle a cURL multi handle resource on success, false on failure.
*/
function curl_multi_init () {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* Returns a new cURL multi handle
* @link https://php.net/manual/en/function.curl-multi-init.php
* @return resource|false|CurlMultiHandle a cURL multi handle resource on success, false on failure.
* @return resource|false a cURL multi handle resource on success, false on failure.
*/
function curl_multi_init () {}

Expand Down
51 changes: 48 additions & 3 deletions enchant/enchant.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,28 @@

// Start of enchant v.1.1.0
use JetBrains\PhpStorm\Deprecated;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* create a new broker object capable of requesting
* @link https://php.net/manual/en/function.enchant-broker-init.php
* @return resource|false|EnchantBroker a broker resource on success or <b>FALSE</b>.
* @return false|EnchantBroker a broker resource on success or <b>FALSE</b>.
*/
function enchant_broker_init () {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* create a new broker object capable of requesting
* @link https://php.net/manual/en/function.enchant-broker-init.php
* @return false|resource a broker resource on success or <b>FALSE</b>.
*/
function enchant_broker_init()
{
}

/**
* Free the broker resource and its dictionaries
* @link https://php.net/manual/en/function.enchant-broker-free.php
Expand Down Expand Up @@ -64,6 +77,22 @@ function enchant_broker_get_dict_path ($broker, $dict_type) {}
*/
function enchant_broker_list_dicts ($broker) {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* create a new dictionary using a tag
* @link https://php.net/manual/en/function.enchant-broker-request-dict.php
* @param resource $broker <p>
* Broker resource
* </p>
* @param string $tag <p>
* A tag describing the locale, for example en_US, de_DE
* </p>
* @return resource|false a dictionary resource on success or <b>FALSE</b> on failure.
*/
function enchant_broker_request_dict ($broker, $tag) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* create a new dictionary using a tag
Expand All @@ -74,10 +103,26 @@ function enchant_broker_list_dicts ($broker) {}
* @param string $tag <p>
* A tag describing the locale, for example en_US, de_DE
* </p>
* @return resource|false|EnchantDictionary a dictionary resource on success or <b>FALSE</b> on failure.
* @return EnchantDictionary|false a dictionary resource on success or <b>FALSE</b> on failure.
*/
function enchant_broker_request_dict ($broker, $tag) {}

#[PhpStormStubsElementAvailable('8.0')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* creates a dictionary using a PWL file
* @link https://php.net/manual/en/function.enchant-broker-request-pwl-dict.php
* @param resource $broker <p>
* Broker resource
* </p>
* @param string $filename <p>
* Path to the PWL file.
* </p>
* @return false|EnchantDictionary a dictionary resource on success or <b>FALSE</b> on failure.
*/
function enchant_broker_request_pwl_dict ($broker, $filename) {}

#[PhpStormStubsElementAvailable(to: '7.4')]
/**
* (PHP 5 &gt;= 5.3.0, PECL enchant &gt;= 0.1.0 )<br/>
* creates a dictionary using a PWL file
Expand All @@ -88,7 +133,7 @@ function enchant_broker_request_dict ($broker, $tag) {}
* @param string $filename <p>
* Path to the PWL file.
* </p>
* @return resource|false|EnchantDictionary a dictionary resource on success or <b>FALSE</b> on failure.
* @return resource|false a dictionary resource on success or <b>FALSE</b> on failure.
*/
function enchant_broker_request_pwl_dict ($broker, $filename) {}

Expand Down
Loading