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

fix: Update reflection-docblock for broken handling of phpstorm-stubs and deprecated method. #823

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: build

on: [push, pull_request]

env:
FORCE_COLOR: 3

jobs:
test:
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- xdebug: xdebug-3.1.1 # renovate:keep-up-to-date
php: '7.4'
os: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.15.3' # renovate:keep-up-to-date
- name: Install npm dependencies
run: npm ci
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.xdebug }}, ast
tools: composer
- name: Composer Install
run: composer install
- name: phpcs
run: ./vendor/bin/phpcs -n
# - name: phan
# run: ./vendor/bin/phan
- name: phpunit
run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
# release:
# runs-on: ubuntu-18.04
# needs: test
# if: github.repository_owner == 'xdebug' && github.event_name == 'push' && github.ref == 'refs/heads/main'
# steps:
# - uses: actions/checkout@v2
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '14.15.3' # renovate:keep-up-to-date
# - name: Install npm dependencies
# run: npm ci
# - name: Build VS Code extension
# run: npm run build
# - name: Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
# run: npm run semantic-release
60 changes: 0 additions & 60 deletions .travis.yml

This file was deleted.

54 changes: 0 additions & 54 deletions appveyor.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"jetbrains/phpstorm-stubs": "dev-master",
"microsoft/tolerant-php-parser": "0.0.*",
"netresearch/jsonmapper": "^1.0",
"phpdocumentor/reflection-docblock": "^4.0.0",
"phpdocumentor/reflection-docblock": "^5.2.2",
"psr/log": "^1.0",
"sabre/event": "^5.0",
"sabre/uri": "^2.0",
"webmozart/glob": "^4.1",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpunit/phpunit": "^6.3",
"phan/phan": "1.1.4",
"squizlabs/php_codesniffer": "^3.1"
"phpunit/phpunit": "^6.5",
"phan/phan": "^3.2",
"squizlabs/php_codesniffer": "^3.6"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion src/DefinitionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ public function getTypeFromNode($node)
if (
$docBlock !== null
&& !empty($returnTags = $docBlock->getTagsByName('return'))
&& $returnTags[0] instanceof DocBlock\Tags\Return_
&& $returnTags[0]->getType() !== null
) {
// Use @return tag
Expand Down Expand Up @@ -1354,7 +1355,7 @@ private function tryGetDocBlockTagForParameter($docBlock, $variableName)
}
$tags = $docBlock->getTagsByName('param');
foreach ($tags as $tag) {
if ($tag->getVariableName() === \ltrim($variableName, "$")) {
if ($tag instanceof DocBlock\Tags\Param && $tag->getVariableName() === \ltrim($variableName, "$")) {
return $tag;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"containerName": "A"
},
"type__tostring": "bool[]",
"type__tostring": "array<string,bool>",
"type": {},
"declarationLine": "protected $foo;",
"documentation": null,
Expand Down
2 changes: 1 addition & 1 deletion tests/Validation/cases/magicConsts.php.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"containerName": "A"
},
"type__tostring": "bool[]",
"type__tostring": "array<\\__CLASS__,bool>",
"type": {},
"declarationLine": "private static $deprecationsTriggered;",
"documentation": null,
Expand Down