Skip to content

Commit a5707d1

Browse files
authored
Merge pull request #99 from php-mod/phpstan
init phpstan
2 parents 54a90b1 + 4f846eb commit a5707d1

File tree

8 files changed

+50
-14
lines changed

8 files changed

+50
-14
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
tests export-ignore
1010
vendor export-ignore
1111
actions.phpunit.xml export-ignore
12-
12+
phpstan.phar export-ignore
13+
phpstan.neon export-ignore

.github/workflows/tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ env:
66
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction"
77
CC_TEST_REPORTER_ID: 40d4890deed3bca8888c04ca67b9768edf11d7a089d2960977997791daea31f6
88
jobs:
9+
## PHPSTAN
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Install PHP
17+
uses: shivammathur/[email protected]
18+
with:
19+
php-version: '8.0'
20+
extensions: mbstring, intl
21+
coverage: none
22+
env:
23+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
update: true
25+
26+
- name: Install dependencies
27+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader
28+
29+
- name: PHPStan tests
30+
run: composer phpstan
31+
932
## PHPUNIT
1033
phpunit:
1134
name: PHP ${{ matrix.php }} on ${{ matrix.os }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ composer.lock
99
tests/phpunit_report/*
1010
/.settings/
1111
/.php_cs.cache
12-
.php-cs-fixer.cache
12+
.php-cs-fixer.cache
13+
.tmp

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. This projec
88
+ [#94](https://github.com/php-mod/curl/pull/94) Added method to retrieve all curl options from current object.
99
+ [#93](https://github.com/php-mod/curl/pull/93) Text and Coding Standards update.
1010
+ [#97](https://github.com/php-mod/curl/pull/97) Added Unit Testing for PHP 8.2.
11+
+ [#99](https://github.com/php-mod/curl/pull/99) Added PHPStan testing to GitHub Actions and fixed errors from testing with PHPStan.
1112

1213
## 2.4.0 (29. August 2022)
1314

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"name": "curl/curl",
33
"description": "cURL class for PHP",
4-
"keywords": ["dot", "curl"],
4+
"keywords": [
5+
"dot",
6+
"curl"
7+
],
58
"homepage": "https://github.com/php-mod/curl",
69
"type": "library",
710
"license": "MIT",
@@ -31,5 +34,8 @@
3134
"psr-0": {
3235
"Curl": "src/"
3336
}
37+
},
38+
"scripts": {
39+
"phpstan": "./phpstan.phar -v"
3440
}
35-
}
41+
}

phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 2
3+
paths:
4+
- src
5+
tmpDir: .tmp

phpstan.phar

20.2 MB
Binary file not shown.

src/Curl/Curl.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,32 @@ class Curl
3434
// The HTTP authentication method(s) to use.
3535

3636
/**
37-
* @var string Type AUTH_BASIC
37+
* @var int Type AUTH_BASIC
3838
*/
3939
const AUTH_BASIC = CURLAUTH_BASIC;
4040

4141
/**
42-
* @var string Type AUTH_DIGEST
42+
* @var int Type AUTH_DIGEST
4343
*/
4444
const AUTH_DIGEST = CURLAUTH_DIGEST;
4545

4646
/**
47-
* @var string Type AUTH_GSSNEGOTIATE
47+
* @var int Type AUTH_GSSNEGOTIATE
4848
*/
4949
const AUTH_GSSNEGOTIATE = CURLAUTH_GSSNEGOTIATE;
5050

5151
/**
52-
* @var string Type AUTH_NTLM
52+
* @var int Type AUTH_NTLM
5353
*/
5454
const AUTH_NTLM = CURLAUTH_NTLM;
5555

5656
/**
57-
* @var string Type AUTH_ANY
57+
* @var int Type AUTH_ANY
5858
*/
5959
const AUTH_ANY = CURLAUTH_ANY;
6060

6161
/**
62-
* @var string Type AUTH_ANYSAFE
62+
* @var int Type AUTH_ANYSAFE
6363
*/
6464
const AUTH_ANYSAFE = CURLAUTH_ANYSAFE;
6565

@@ -322,8 +322,8 @@ public function get($url, $data = array())
322322
* A very common scenario to send a purge request is within the use of varnish, therefore
323323
* the optional hostname can be defined.
324324
*
325-
* @param strng $url The url to make the purge request
326-
* @param string $hostname An optional hostname which will be sent as http host header
325+
* @param string $url The url to make the purge request
326+
* @param string $hostName An optional hostname which will be sent as http host header
327327
* @return self
328328
* @since 2.4.0
329329
*/
@@ -573,7 +573,6 @@ public function setOpt($option, $value)
573573
*
574574
* @see http://php.net/curl_getinfo
575575
* @param int $option The curl option constant e.g. `CURLOPT_AUTOREFERER`, `CURLOPT_COOKIESESSION`
576-
* @param mixed The value to check for the given $option
577576
* @return mixed
578577
*/
579578
public function getOpt($option)
@@ -787,7 +786,7 @@ public function getResponse()
787786

788787
/**
789788
* Get curl error code
790-
* @return string
789+
* @return int
791790
*/
792791
public function getErrorCode()
793792
{

0 commit comments

Comments
 (0)