From e3f170c09d0424225d8b5a7650134628ecba94e1 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 31 Aug 2021 20:53:34 +0200 Subject: [PATCH 01/11] Update reflection-docblock for broken handling of phpstorm-stubs. --- .travis.yml | 9 ++++----- appveyor.yml | 4 ++-- composer.json | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index da1f1183..03b0fbc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: php php: - - '7.0' - - '7.2' + - '7.4' git: depth: 10 @@ -33,9 +32,9 @@ jobs: before_install: # Fix ruby error https://github.com/Homebrew/brew/issues/3299 - brew update - - brew install php@7.1 - - brew link --force --overwrite php@7.1 - - pecl install xdebug-2.6.0 + - brew install php@7.4 + - brew link --force --overwrite php@7.4 + - pecl install xdebug-2.9.8 - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - ln -s "`pwd`/composer.phar" /usr/local/bin/composer diff --git a/appveyor.yml b/appveyor.yml index 7d0525cf..cfd96385 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ cache: environment: ANSICON: 121x90 (121x90) matrix: - - { PHP_VERSION: '7.1.11', VC_VERSION: '14', XDEBUG_VERSION: '2.5.5' } + - { PHP_VERSION: '7.4.23', VC_VERSION: '15', XDEBUG_VERSION: '2.9.8' } install: # Enable Windows Update service, needed to install vcredist2015 (dependency of php) @@ -30,7 +30,7 @@ install: - ps: | $client = New-Object System.Net.WebClient $phpMinorVersion = $env:PHP_VERSION -replace '\.\d+$' - $xdebugUrl = "https://xdebug.org/files/php_xdebug-$env:XDEBUG_VERSION-$phpMinorVersion-vc14-nts-x86_64.dll" + $xdebugUrl = "https://xdebug.org/files/php_xdebug-$env:XDEBUG_VERSION-$phpMinorVersion-vc15-nts-x86_64.dll" $phpDir = (Get-Item (Get-Command php).Source).Directory.FullName $xdebugPath = Join-Path $phpDir ext\xdebug.dll $client.DownloadFile($xdebugUrl, $xdebugPath) diff --git a/composer.json b/composer.json index f63bf3a1..a51d9476 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "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", From cef2352c13d78ff545c3d2581825ee1d5db58f5f Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Wed, 1 Sep 2021 07:24:32 +0200 Subject: [PATCH 02/11] Changes of test resutls (to be fixed). --- .../cases/arrayValueShouldBeBoolean.php.expected.json | 2 +- tests/Validation/cases/magicConsts.php.expected.json | 2 +- .../cases/multiplePreceedingComments.php.expected.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json index f0cdb24d..84534a47 100644 --- a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json +++ b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json @@ -36,7 +36,7 @@ }, "containerName": "A" }, - "type__tostring": "bool[]", + "type__tostring": "array", "type": {}, "declarationLine": "protected $foo;", "documentation": null, diff --git a/tests/Validation/cases/magicConsts.php.expected.json b/tests/Validation/cases/magicConsts.php.expected.json index 27608e55..a45a72a8 100644 --- a/tests/Validation/cases/magicConsts.php.expected.json +++ b/tests/Validation/cases/magicConsts.php.expected.json @@ -40,7 +40,7 @@ }, "containerName": "A" }, - "type__tostring": "bool[]", + "type__tostring": "array<\\__CLASS__,bool>", "type": {}, "declarationLine": "private static $deprecationsTriggered;", "documentation": null, diff --git a/tests/Validation/cases/multiplePreceedingComments.php.expected.json b/tests/Validation/cases/multiplePreceedingComments.php.expected.json index 2bca2b66..3fb42052 100644 --- a/tests/Validation/cases/multiplePreceedingComments.php.expected.json +++ b/tests/Validation/cases/multiplePreceedingComments.php.expected.json @@ -21,15 +21,15 @@ "documentation": null, "signatureInformation": null }, - "Foo->fn()": { - "fqn": "Foo->fn()", + "Foo->()": { + "fqn": "Foo->()", "extends": [], "isMember": true, "roamed": false, "isStatic": false, "canBeInstantiated": false, "symbolInformation": { - "name": "fn", + "name": "", "kind": 6, "location": { "uri": "./multiplePreceedingComments.php" From 6cf341d717076111caaa121357cef7c0f6e2fe99 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Wed, 1 Sep 2021 09:18:18 +0200 Subject: [PATCH 03/11] Add silence parameter for curl when calling codecov.sh --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cfd96385..e67948cd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,4 +51,4 @@ after_test: Remove-Item -Recurse -Force vendor $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh - bash codecov.sh -f 'coverage/coverage.xml' + bash codecov.sh -f 'coverage/coverage.xml' -U "-s" -A "-s" From ecf0374c7a63f8d46bab07ea8c2f7c343c6e6b6f Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 22:11:45 +0200 Subject: [PATCH 04/11] Catch fatal exceptions. --- src/DefinitionResolver.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DefinitionResolver.php b/src/DefinitionResolver.php index adddf774..d1648d3b 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -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 @@ -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; } } From 46f06094b177f62b8c3c252c353f92973c06f417 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:09:59 +0200 Subject: [PATCH 05/11] Actions. --- .github/workflows/build.yml | 60 +++++++++++++++++++++++++++++++++++++ .travis.yml | 59 ------------------------------------ appveyor.yml | 54 --------------------------------- 3 files changed, 60 insertions(+), 113 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..5b2fd53e --- /dev/null +++ b/.github/workflows/build.yml @@ -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 + uses: php-actions/composer@v6 + - 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_TOKENx: ${{ secrets.GITHUB_TOKEN }} + VSCE_TOKENx: ${{ secrets.VSCE_TOKEN }} + run: npm run semantic-release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 03b0fbc2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: php - -php: - - '7.4' - -git: - depth: 10 - submodules: false - -cache: - directories: - - $HOME/Library/Caches/Homebrew - - $HOME/.composer/cache - - $HOME/.npm - -install: - - composer install --prefer-dist --no-interaction - - pecl install ast-1.0.0 - -script: - - vendor/bin/phpcs -n - - vendor/bin/phan - - vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always - - bash <(curl -s https://codecov.io/bash) - -jobs: - include: - - stage: test - os: osx - osx_image: xcode9.1 - language: generic - before_install: - # Fix ruby error https://github.com/Homebrew/brew/issues/3299 - - brew update - - brew install php@7.4 - - brew link --force --overwrite php@7.4 - - pecl install xdebug-2.9.8 - - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - - php composer-setup.php - - ln -s "`pwd`/composer.phar" /usr/local/bin/composer - - stage: release - php: '7.0' - services: - - docker - install: - - nvm install 8 - - nvm use 8 - - npm install - script: - - ./node_modules/.bin/semantic-release - -stages: - - test - - name: release - if: branch = master AND type = push AND fork = false - -branches: - only: - - master diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e67948cd..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '{build}' - -image: Visual Studio 2017 -platform: - - x64 - -skip_tags: true -skip_branch_with_pr: true -clone_depth: 1 -max_jobs: 3 - -cache: - - '%LOCALAPPDATA%\Composer' - - '%LOCALAPPDATA%\Temp\Chocolatey' - -environment: - ANSICON: 121x90 (121x90) - matrix: - - { PHP_VERSION: '7.4.23', VC_VERSION: '15', XDEBUG_VERSION: '2.9.8' } - -install: - # Enable Windows Update service, needed to install vcredist2015 (dependency of php) - - ps: Set-Service wuauserv -StartupType Manual - - choco config set cacheLocation %LOCALAPPDATA%\Temp\Chocolatey - - choco install -y php --version %PHP_VERSION% - - choco install -y composer - - refreshenv - - composer install --no-interaction --no-progress --prefer-dist - # Install XDebug for code coverage - - ps: | - $client = New-Object System.Net.WebClient - $phpMinorVersion = $env:PHP_VERSION -replace '\.\d+$' - $xdebugUrl = "https://xdebug.org/files/php_xdebug-$env:XDEBUG_VERSION-$phpMinorVersion-vc15-nts-x86_64.dll" - $phpDir = (Get-Item (Get-Command php).Source).Directory.FullName - $xdebugPath = Join-Path $phpDir ext\xdebug.dll - $client.DownloadFile($xdebugUrl, $xdebugPath) - $phpIniPath = Join-Path $phpDir php.ini - Add-Content $phpIniPath @" - zend_extension=$xdebugPath - "@ - -build: off - -test_script: - - vendor\bin\phpunit --coverage-clover=coverage/coverage.xml - -after_test: - - ps: | - # Delete vendor because it causes problems with codecovs report search - # https://github.com/codecov/codecov-bash/issues/96 - Remove-Item -Recurse -Force vendor - $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH - Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh - bash codecov.sh -f 'coverage/coverage.xml' -U "-s" -A "-s" From 6b052c71436d4c0e670b9dc5d50e09001dd1f1e6 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:20:30 +0200 Subject: [PATCH 06/11] Do not use php-actions/composer --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b2fd53e..0332bbc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: extensions: ${{ matrix.xdebug }}, ast tools: composer - name: Composer Install - uses: php-actions/composer@v6 + run: composer install - name: phpcs run: ./vendor/bin/phpcs -n - name: phan From 1e9a09d8478e05042665e29a6b19be1f6c7bf700 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:37:13 +0200 Subject: [PATCH 07/11] Bump composer. --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index a51d9476..2fb582d4 100644 --- a/composer.json +++ b/composer.json @@ -36,9 +36,9 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpunit/phpunit": "^6.3", - "phan/phan": "1.1.4", - "squizlabs/php_codesniffer": "^3.1" + "phpunit/phpunit": "^8.2", + "phan/phan": "^3.2", + "squizlabs/php_codesniffer": "^3.6" }, "autoload": { "psr-4": { From 5c197bb917b2156f229362ecbd1db7b30cba7d11 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:40:34 +0200 Subject: [PATCH 08/11] Disable phan (for now) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0332bbc4..fc4b67e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: run: composer install - name: phpcs run: ./vendor/bin/phpcs -n - - name: phan - run: ./vendor/bin/phan +# - name: phan +# run: ./vendor/bin/phan - name: phpunit run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always - name: Upload coverage to Codecov From 1923435bdfe5a3f59e81858123fe71022de6aa87 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:45:11 +0200 Subject: [PATCH 09/11] Downgrade phpunit to 6.5.* --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2fb582d4..6c41cb91 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpunit/phpunit": "^8.2", + "phpunit/phpunit": "^6.5", "phan/phan": "^3.2", "squizlabs/php_codesniffer": "^3.6" }, From 3b196d031f074396c1243aef81a08a35dd82c0be Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Tue, 19 Oct 2021 23:54:45 +0200 Subject: [PATCH 10/11] Changed back test results. --- .../cases/multiplePreceedingComments.php.expected.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Validation/cases/multiplePreceedingComments.php.expected.json b/tests/Validation/cases/multiplePreceedingComments.php.expected.json index 3fb42052..2bca2b66 100644 --- a/tests/Validation/cases/multiplePreceedingComments.php.expected.json +++ b/tests/Validation/cases/multiplePreceedingComments.php.expected.json @@ -21,15 +21,15 @@ "documentation": null, "signatureInformation": null }, - "Foo->()": { - "fqn": "Foo->()", + "Foo->fn()": { + "fqn": "Foo->fn()", "extends": [], "isMember": true, "roamed": false, "isStatic": false, "canBeInstantiated": false, "symbolInformation": { - "name": "", + "name": "fn", "kind": 6, "location": { "uri": "./multiplePreceedingComments.php" From a7e2f9a8957a9a66ae863a2dd6b24d72f1e25fce Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Wed, 20 Oct 2021 00:14:02 +0200 Subject: [PATCH 11/11] Disable release part of actions. --- .github/workflows/build.yml | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc4b67e2..e469eccd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,22 +39,22 @@ jobs: 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_TOKENx: ${{ secrets.GITHUB_TOKEN }} - VSCE_TOKENx: ${{ secrets.VSCE_TOKEN }} - run: npm run semantic-release +# 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