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

init phpstan #99

Merged
merged 5 commits into from
Dec 12, 2022
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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
tests export-ignore
vendor export-ignore
actions.phpunit.xml export-ignore

phpstan.phar export-ignore
phpstan.neon export-ignore
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction"
CC_TEST_REPORTER_ID: 40d4890deed3bca8888c04ca67b9768edf11d7a089d2960977997791daea31f6
jobs:
## PHPSTAN
phpstan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@2.21.0
with:
php-version: '8.0'
extensions: mbstring, intl
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update: true

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: PHPStan tests
run: composer phpstan

## PHPUNIT
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ composer.lock
tests/phpunit_report/*
/.settings/
/.php_cs.cache
.php-cs-fixer.cache
.php-cs-fixer.cache
.tmp
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. This projec
+ [#94](https://github.com/php-mod/curl/pull/94) Added method to retrieve all curl options from current object.
+ [#93](https://github.com/php-mod/curl/pull/93) Text and Coding Standards update.
+ [#97](https://github.com/php-mod/curl/pull/97) Added Unit Testing for PHP 8.2.
+ [#99](https://github.com/php-mod/curl/pull/99) Added PHPStan testing to GitHub Actions and fixed errors from testing with PHPStan.

## 2.4.0 (29. August 2022)

Expand Down
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "curl/curl",
"description": "cURL class for PHP",
"keywords": ["dot", "curl"],
"keywords": [
"dot",
"curl"
],
"homepage": "https://github.com/php-mod/curl",
"type": "library",
"license": "MIT",
Expand Down Expand Up @@ -31,5 +34,8 @@
"psr-0": {
"Curl": "src/"
}
},
"scripts": {
"phpstan": "./phpstan.phar -v"
}
}
}
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 2
paths:
- src
tmpDir: .tmp
Binary file added phpstan.phar
Binary file not shown.
19 changes: 9 additions & 10 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,32 @@ class Curl
// The HTTP authentication method(s) to use.

/**
* @var string Type AUTH_BASIC
* @var int Type AUTH_BASIC
*/
const AUTH_BASIC = CURLAUTH_BASIC;

/**
* @var string Type AUTH_DIGEST
* @var int Type AUTH_DIGEST
*/
const AUTH_DIGEST = CURLAUTH_DIGEST;

/**
* @var string Type AUTH_GSSNEGOTIATE
* @var int Type AUTH_GSSNEGOTIATE
*/
const AUTH_GSSNEGOTIATE = CURLAUTH_GSSNEGOTIATE;

/**
* @var string Type AUTH_NTLM
* @var int Type AUTH_NTLM
*/
const AUTH_NTLM = CURLAUTH_NTLM;

/**
* @var string Type AUTH_ANY
* @var int Type AUTH_ANY
*/
const AUTH_ANY = CURLAUTH_ANY;

/**
* @var string Type AUTH_ANYSAFE
* @var int Type AUTH_ANYSAFE
*/
const AUTH_ANYSAFE = CURLAUTH_ANYSAFE;

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

/**
* Get curl error code
* @return string
* @return int
*/
public function getErrorCode()
{
Expand Down