Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vimeo/psalm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.6.3
Choose a base ref
...
head repository: vimeo/psalm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.9.2
Choose a head ref

Commits on Mar 15, 2021

  1. makes array_combine return non-empty-array for most cases (#5393)

    * makes array_combine return non-empty-array for most cases
    
    * Add back newline
    
    Co-authored-by: Matthew Brown <github@muglug.com>
    orklah and muglug authored Mar 15, 2021
    Copy the full SHA
    dd4d970 View commit details

Commits on Mar 16, 2021

  1. Copy the full SHA
    817d1cf View commit details
  2. Don't mark promoted properties as unused params (#5404)

    If anything, they should be marked as unused properties.
    
    Fixes #4964
    weirdan authored Mar 16, 2021
    Copy the full SHA
    ae247d0 View commit details
  3. Fix type of DomElement childNodes property (#5403)

    Partially addresses #5291
    theodorejb authored Mar 16, 2021
    Copy the full SHA
    5b9efd5 View commit details
  4. Disable property invariance checks for properties with templates (#5380)

    * Disable property invariance checks for templates
    
    Property invariance checks were already disabled for template
    properties, this also disabled the checks for arrays, lists,
    class-string-maps, and iterables that contain templates.
    
    Partially fixes #5371
    
    * CS fixes
    
    * Fix and simplify hasTemplate.
    
    Add hasTemplate to TypeNode and simplify implementation with getChildNodes.
    
    * Revert hasTemplate change and add containsTemplate.
    
    * Check class-string too.
    AndrolGenhald authored Mar 16, 2021
    Copy the full SHA
    9d840ee View commit details
  5. Copy the full SHA
    1a3ff56 View commit details
  6. Copy the full SHA
    ff5a6cb View commit details
  7. Copy the full SHA
    1149050 View commit details
  8. Copy the full SHA
    2777b62 View commit details
  9. Copy the full SHA
    9d979e3 View commit details
  10. Fix BC break introduced in 4.6.3 (#5410)

    Fixes #5405
    
    Requires new patch release.
    
    This PR reverts changes to the signature of `IssueBuffer::finish()` and
    introduces separate method to be used to capture `$_SERVER`
    weirdan authored Mar 16, 2021
    Copy the full SHA
    97fe86c View commit details

Commits on Mar 17, 2021

  1. Copy the full SHA
    3046468 View commit details
  2. Add better origins for calls

    muglug committed Mar 17, 2021
    Copy the full SHA
    d19088b View commit details

Commits on Mar 18, 2021

  1. Fix directory separators

    muglug committed Mar 18, 2021
    Copy the full SHA
    95287d2 View commit details
  2. Copy the full SHA
    09ee4c1 View commit details
  3. Fix composer major.minor version detection (fixes #5415) (#5416)

    * Fix composer major.minor version detection (fixes #5415)
    
    * Add PHP 8 polyfill dependency.
    
    * Fix version check.
    AndrolGenhald authored Mar 18, 2021
    Copy the full SHA
    45694d3 View commit details
  4. Copy the full SHA
    04f3e29 View commit details
  5. Improve labelling

    muglug committed Mar 18, 2021
    Copy the full SHA
    e919e41 View commit details
  6. Fix dumb bug

    muglug committed Mar 18, 2021
    Copy the full SHA
    a871d0d View commit details
  7. Simplify complex methods

    muglug committed Mar 18, 2021
    Copy the full SHA
    b7a68ed View commit details
  8. Use more accurate return type

    muglug committed Mar 18, 2021
    Copy the full SHA
    42d3bce View commit details

Commits on Mar 20, 2021

  1. Fix object-like array keys when combining string and automatic keys (f…

    …ixes #5427). (#5428)
    
    * Fix object-like array keys (fixes #5427).
    
    * Fix incorrect return types for tests.
    
    * Fix false positive list with literal int key.
    AndrolGenhald authored Mar 20, 2021
    Copy the full SHA
    d459071 View commit details
  2. Copy the full SHA
    b859fba View commit details
  3. Copy the full SHA
    17f23cc View commit details
  4. Support template property invariance (fixes #5371) (#5414)

    * Support property invariance with templates.
    
    * Fix false positive NonInvariantDocblockPropertyType with grandchild.
    
    * Redo templated property invariance check to fix issues.
    
    * Add template covariant test.
    
    * Fix property invariance false positive with template-covariant.
    AndrolGenhald authored Mar 20, 2021
    Copy the full SHA
    843305c View commit details
  5. Added event to prevent tainting. (#5398)

    * Added event to prevent tainting.
    
    * Remove optional codebase parameter.
    
    * Removed falsy check for codebase.
    
    * Use two separate hooks for adding and removing taints
    
    * Add slashes
    
    * Update add/remove taint test name.
    
    * Cleaned up SafeArrayKeyChecker example plugin.
    
    * Added more AddRemoveTaintsEvent calls to codebase.
    
    * Fix type check error with $added_taints param.
    
    * Added AddRemoveTaintsEvent to remaining classes.
    
    * Fix post-merge error.
    
    * Add comma
    
    * Remove $int_offset that never existed
    
    Co-authored-by: Matt Brown <github@muglug.com>
    mortenson and muglug authored Mar 20, 2021
    Copy the full SHA
    4aabb41 View commit details
  6. Copy the full SHA
    0579c11 View commit details
  7. Use appveyor reporter instead of a file upload (#5438)

    * Use appveyor reporter instead of file upload
    
    * Use tagged version of appveyor reporter
    weirdan authored Mar 20, 2021
    Copy the full SHA
    8d78372 View commit details
  8. Copy the full SHA
    e073376 View commit details
  9. Fix DateTimeZone::listIdentifiers() and timezone_identifiers_list() s…

    …ignature (#5443)
    
    Including historic changes, according to php.net docs.
    
    Fixes #5442
    weirdan authored Mar 20, 2021
    Copy the full SHA
    b4fab67 View commit details

Commits on Mar 21, 2021

  1. Copy the full SHA
    d174039 View commit details
  2. Copy the full SHA
    7f8d522 View commit details
  3. Copy the full SHA
    44c6d30 View commit details
  4. Fix extra issue tests

    muglug committed Mar 21, 2021
    Copy the full SHA
    f69cab8 View commit details
  5. Add use statements

    muglug committed Mar 21, 2021
    Copy the full SHA
    b73223f View commit details

Commits on Mar 22, 2021

  1. Don't crash on index types used in a conditional type (#5447)

    Fixes crash reported in #5423
    weirdan authored Mar 22, 2021
    Copy the full SHA
    4eca6ac View commit details
  2. Add proper handling of unpacked arguments with string keys (#5446)

    * Add proper handling of unpacked arguments with string keys
    
    * Fix undefined array key error
    
    * Fix missed named arguments handling
    
    * Fix false-positive on variadic parameter
    
    * Add tests
    yakimun authored Mar 22, 2021
    Copy the full SHA
    fb94db9 View commit details
  3. Copy the full SHA
    9f3f420 View commit details
  4. Resolve build issues

    muglug committed Mar 22, 2021
    Copy the full SHA
    ae1fd44 View commit details
  5. Copy the full SHA
    b02b684 View commit details
  6. Back to 7.4

    muglug committed Mar 22, 2021
    Copy the full SHA
    0789745 View commit details
  7. Improve @no-named-arguments support and variadics. (#5455)

    * Improve @no-named-arguments support and variadics.
    
    Handling of argument unpacking and variadics still needs a pretty big makeover, but this is a good start.
    
    Fixes #5420
    Improves #5453 (iterable works, array still causes issues)
    
    * Remove unneeded imports.
    AndrolGenhald authored Mar 22, 2021
    Copy the full SHA
    de5a031 View commit details

Commits on Mar 23, 2021

  1. Copy the full SHA
    bf578d1 View commit details
  2. Prevent more offset issues

    muglug committed Mar 23, 2021
    Copy the full SHA
    15b0542 View commit details
  3. Fix many uses of offsets

    muglug committed Mar 23, 2021
    Copy the full SHA
    a96645d View commit details
  4. Copy the full SHA
    477ae33 View commit details
  5. Fix linting issues

    muglug committed Mar 23, 2021
    Copy the full SHA
    efa9b13 View commit details

Commits on Mar 24, 2021

  1. Copy the full SHA
    355c4f7 View commit details
  2. Copy the full SHA
    b61ff8c View commit details
  3. Copy the full SHA
    2edf613 View commit details
Showing 632 changed files with 22,866 additions and 9,340 deletions.
65 changes: 3 additions & 62 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,4 @@
build: false
platform:
- x64

clone_folder: c:\projects\php-project-workspace

## Set up environment variables
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1 # This var is connected to PHP install cache
- SET ANSICON=121x90 (121x90)

environment:
SSL_CERT_FILE: "C:\\tools\\php\\cacert.pem"
matrix:
- php_ver_target: 8.0
DEPS: 'high'

cache:
- '%LOCALAPPDATA%\Composer\files'
- '%LOCALAPPDATA%\Composer\vcs'
# Cache chocolatey packages
- C:\ProgramData\chocolatey\bin
- C:\ProgramData\chocolatey\lib
# Cache php install
- c:\tools\php

## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST c:\tools\php (SET PHP=0) # Checks for the PHP install being cached
- ps: appveyor-retry cinst --no-progress --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- appveyor DownloadFile https://curl.haxx.se/ca/cacert.pem -FileName C:\tools\php\cacert.pem
- cd c:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
- IF NOT EXIST php-installed.txt echo curl.cainfo="C:/tools/php/cacert.pem" >> php.ini
- IF NOT EXIST php-installed.txt echo openssl.cafile="C:/tools/php/cacert.pem" >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
- IF %PHP%==1 echo assert.exception=On >> php.ini
- IF %PHP%==1 echo error_reporting=E_ALL >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- IF NOT EXIST composer.phar appveyor-retry appveyor DownloadFile https://getcomposer.org/composer-stable.phar -FileName composer.phar
- cd c:\projects\php-project-workspace
- php -r "phpinfo(INFO_GENERAL);"
- if NOT DEFINED APPVEYOR_REPO_TAG_NAME (set COMPOSER_ROOT_VERSION=dev-master)
- if %DEPS%==low appveyor-retry composer update --no-interaction --no-progress --profile --prefer-lowest --prefer-stable
- if %DEPS%==high appveyor-retry composer update --no-interaction --no-progress --profile

## Run the actual test
test_script:
- cd c:\projects\php-project-workspace
- vendor/bin/paratest --log-junit build/phpunit/phpunit.xml
- php ./psalm --shepherd

on_finish:
- ps: $wc = New-Object 'System.Net.WebClient'
- ps: $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\build\phpunit\phpunit.xml))
branches:
only:
- dear-appveyor-please-dont-build-this-repo
40 changes: 14 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -4,18 +4,21 @@ executors:
php-74:
docker:
- image: thecodingmachine/php:7.4-v4-cli
php-80:
docker:
- image: thecodingmachine/php:8.0-v4-cli
jobs:
install-and-self-analyse:
"Code Style Analysis":
executor: php-74
steps:
- checkout

- run: date "+%F" > /tmp/cachekey; cat composer.json >> /tmp/cachekey

- restore_cache:
keys:
- composer-v4
- restore_cache:
keys:
- psalm-cache-{{ checksum "/tmp/cachekey" }} # speeds up diff run

- run: composer update

- save_cache:
@@ -24,27 +27,15 @@ jobs:
- /home/docker/.composer/cache/files
- /home/docker/.composer/cache/vcs

- run:
name: Static analysis
command: php -dextension=pcntl.so ./psalm --threads=10

- save_cache:
key: psalm-cache-{{ checksum "/tmp/cachekey" }}
paths:
- /tmp/psalm

- persist_to_workspace:
root: /home/docker/project/
paths:
- .
"Code Style Analysis":
executor: php-74
steps:
- attach_workspace:
at: /home/docker/project/

- run:
name: Code Style Analysis with PHPCS
command: vendor/bin/phpcs

phar-build:
executor: php-74
steps:
@@ -69,29 +60,26 @@ jobs:
paths:
- build/psalm.phar
test-with-real-projects:
executor: php-74
executor: php-80
steps:
- checkout # used here just for the side effect of loading the github public ssh key so we can clone other stuff
- attach_workspace:
at: /home/docker/project/
- run:
name: Analyse PHPUnit
command: bin/test-with-real-projects.sh phpunit
- run:
name: Analyse Collections
command: bin/test-with-real-projects.sh collections
- run:
name: Analyse Psl
command: bin/test-with-real-projects.sh psl
- run:
name: Analyse Collections
command: bin/test-with-real-projects.sh collections

# Orchestrate or schedule a set of jobs, see https://circleci.com/docs/2.0/workflows/
workflows:
Welcome:
jobs:
- install-and-self-analyse
- "Code Style Analysis":
requires:
- install-and-self-analyse
- "Code Style Analysis"
- phar-build:
requires:
- "Code Style Analysis"
16 changes: 16 additions & 0 deletions .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,23 @@ on:
- published

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
concurrent_skipping: always
cancel_others: true
do_not_skip: '["release"]'
# list files that may affect or are included into the built phar
paths: '["bin/**", "assets/**", "build/**", "dictionaries/**", "src/**", "stubs/**", "psalm", "psalm-language-server", "psalm-plugin", "psalm-refactor", "psalter", "box.json.dist", "composer.json", "config.xsd", "keys.asc.gpg", "scoper.inc.php"]'

build-phar:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Set up PHP
50 changes: 50 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run unit tests on Windows

on: [push, pull_request]

jobs:
tests:
name: "Unit Tests"

runs-on: windows-latest

strategy:
fail-fast: false

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:v2

- uses: actions/checkout@v2

- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
- name: Cache composer cache
uses: actions/cache@v2
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
${{ steps.composer-cache.outputs.vcs_cache }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Run composer install
run: composer install -o
env:
COMPOSER_ROOT_VERSION: dev-master

- name: Run unit tests
run: vendor/bin/paratest --log-junit build/phpunit/phpunit.xml
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -11,5 +11,4 @@
/vendor-bin/*/vendor/
/tests/fixtures/symlinktest/*

.idea/inspectionProfiles/Project_Default.xml
.idea/workspace.xml
.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
[![Packagist](https://img.shields.io/packagist/dt/vimeo/psalm.svg)](https://packagist.org/packages/vimeo/psalm)
[![Coverage Status](https://coveralls.io/repos/github/vimeo/psalm/badge.svg)](https://coveralls.io/github/vimeo/psalm)
![Psalm coverage](https://shepherd.dev/github/vimeo/psalm/coverage.svg?)

[![Psalm level](https://shepherd.dev/github/vimeo/psalm/level.svg?)](https://psalm.dev/)

Psalm is a static analysis tool for finding errors in PHP applications.

28 changes: 17 additions & 11 deletions bin/test-with-real-projects.sh
Original file line number Diff line number Diff line change
@@ -3,38 +3,44 @@
set -e
set -x

SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
PSALM="$(readlink -f "$SCRIPT_DIR/../psalm")"
PSALM_PHAR="$(readlink -f "$SCRIPT_DIR/../build/psalm.phar")"

cd /tmp/
rm -Rf testing-with-real-projects
mkdir -p testing-with-real-projects
cd testing-with-real-projects

case $1 in
phpunit)
git clone git@github.com:muglug/phpunit.git
cd phpunit
git clone --depth=1 git@github.com:psalm/endtoend-test-phpunit
cd endtoend-test-phpunit
composer install
~/project/build/psalm.phar --config=.psalm/config.xml --monochrome --show-info=false
~/project/build/psalm.phar --config=.psalm/static-analysis.xml --monochrome
"$PSALM_PHAR" --config=.psalm/config.xml --monochrome --show-info=false
"$PSALM_PHAR" --config=.psalm/static-analysis.xml --monochrome
;;

collections)
git clone git@github.com:muglug/collections.git
git clone --depth=1 git@github.com:muglug/collections.git
cd collections
composer install
~/project/psalm --monochrome --show-info=false
"$PSALM" --monochrome --show-info=false
;;

psl)
git clone git@github.com:muglug/psl.git
cd psl
git clone git@github.com:psalm/endtoend-test-psl.git
cd endtoend-test-psl
git checkout 1.6.x
composer install --ignore-platform-reqs
~/project/psalm --monochrome
"$PSALM" --monochrome --config=tools/psalm/psalm.xml
;;

laravel)
git clone git@github.com:muglug/framework.git
git clone --depth=1 git@github.com:muglug/framework.git
cd framework
composer install
~/project/psalm --monochrome
"$PSALM" --monochrome
;;
*)
echo "Usage: test-with-real-projects.sh {phpunit|collections|proxymanager|laravel|psl}"
7 changes: 1 addition & 6 deletions box.json.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"output" : "build/psalm.phar",
"files": [
"src/command_functions.php",
"src/psalm.php",
"src/psalter.php",
"src/psalm-language-server.php",
"src/psalm_plugin.php",
"src/psalm-refactor.php"
"psalm"
],
"files-bin": ["config.xsd"],
"directories-bin" : [
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -25,12 +25,12 @@
"amphp/byte-stream": "^1.5",
"composer/package-versions-deprecated": "^1.8.0",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^1.1",
"composer/xdebug-handler": "^1.1 || ^2.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.0.3",
"felixfbecker/language-server-protocol": "^1.5",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.10.1",
"nikic/php-parser": "^4.12",
"openlss/lib-array2xml": "^1.0",
"sebastian/diff": "^3.0 || ^4.0",
"symfony/console": "^3.4.17 || ^4.1.6 || ^5.0",
@@ -48,10 +48,11 @@
"phpmyadmin/sql-parser": "5.1.0||dev-master",
"phpspec/prophecy": ">=1.9.0",
"phpunit/phpunit": "^9.0",
"psalm/plugin-phpunit": "^0.13",
"slevomat/coding-standard": "^6.3.11",
"psalm/plugin-phpunit": "^0.16",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.3",
"symfony/process": "^4.3 || ^5.0",
"weirdan/phpunit-appveyor-reporter": "^1.0.0",
"weirdan/prophecy-shim": "^1.0 || ^2.0"
},
"suggest": {
Loading