Skip to content

Commit

Permalink
Merge branch '5.x' into upstream-master
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Jan 10, 2024
2 parents a75d26a + 06b71be commit cbba54b
Show file tree
Hide file tree
Showing 104 changed files with 3,780 additions and 812 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
CHUNK_COUNT: "${{ matrix.count }}"
CHUNK_NUMBER: "${{ matrix.chunk }}"
PARALLEL_PROCESSES: 5
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

steps:
- name: Set up PHP
Expand Down
9 changes: 6 additions & 3 deletions bin/tests-github-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
set -eu

function get_seeded_random() {
openssl enc -aes-256-ctr -pass pass:"vimeo/psalm" -nosalt </dev/zero 2>/dev/null
local -r branch_name="$1"
openssl enc -aes-256-ctr -pass pass:"$branch_name" -nosalt </dev/zero 2>/dev/null
}

function run {
local -r chunk_count="$1"
local -r chunk_number="$2"
local -r parallel_processes="$3"
local -r branch_name="$4"

local -r phpunit_cmd='
echo "::group::{}";
Expand All @@ -23,7 +25,7 @@ exit "$exit_code"'

mkdir -p build/parallel/ build/phpunit/logs/

find tests -name '*Test.php' | shuf --random-source=<(get_seeded_random) > build/tests_all
find tests -name '*Test.php' | shuf --random-source=<(get_seeded_random "$branch_name") > build/tests_all
# split incorrectly splits the lines by byte size, which means that the number of tests per file are as evenly distributed as possible
#split --number="l/$chunk_number/$chunk_count" build/tests_all > build/tests_split
local -r lines=$(wc -l <build/tests_all)
Expand All @@ -47,5 +49,6 @@ exit "$exit_code"'
if [ -z "${CHUNK_COUNT:-}" ]; then echo "Did not find env var CHUNK_COUNT."; exit 1; fi
if [ -z "${CHUNK_NUMBER:-}" ]; then echo "Did not find env var CHUNK_NUMBER."; exit 1; fi
if [ -z "${PARALLEL_PROCESSES:-}" ]; then echo "Did not find env var PARALLEL_PROCESSES."; exit 1; fi
if [ -z "${BRANCH_NAME:-}" ]; then echo "Did not find env var BRANCH_NAME."; exit 1; fi

run "$CHUNK_COUNT" "$CHUNK_NUMBER" "$PARALLEL_PROCESSES"
run "$CHUNK_COUNT" "$CHUNK_NUMBER" "$PARALLEL_PROCESSES" "$BRANCH_NAME"
290 changes: 145 additions & 145 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,150 +1,150 @@
{
"name": "vimeo/psalm",
"type": "project",
"description": "A static analysis tool for finding errors in PHP applications",
"keywords": [
"php",
"code",
"inspection",
"static analysis"
],
"license": "MIT",
"authors": [
{
"name": "Matthew Brown"
}
],
"require": {
"php": "~8.1.17 || ~8.2.4 || ~8.3.0",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-tokenizer": "*",
"composer-runtime-api": "^2",
"amphp/amp": "^3",
"amphp/byte-stream": "^2",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^2.0 || ^3.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.2",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.16",
"sebastian/diff": "^4.0 || ^5.0",
"spatie/array-to-xml": "^2.17.0 || ^3.0",
"symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0"
},
"conflict": {
"nikic/php-parser": "4.17.0"
},
"provide": {
"psalm/psalm": "self.version"
},
"require-dev": {
"ext-curl": "*",
"amphp/phpunit-util": "^3",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^6.9",
"dg/bypass-finals": "^1.5",
"mockery/mockery": "^1.5",
"nunomaduro/mock-final-classes": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpdoc-parser": "^1.6",
"phpunit/phpunit": "^9.6",
"psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18",
"slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.6",
"symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"ext-igbinary": "^2.0.5 is required, used to serialize caching data",
"ext-curl": "In order to send data to shepherd"
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"optimize-autoloader": true,
"sort-packages": true,
"platform-check": true
},
"extra": {
"branch-alias": {
"dev-master": "6.x-dev",
"dev-5.x": "5.x-dev",
"dev-4.x": "4.x-dev",
"dev-3.x": "3.x-dev",
"dev-2.x": "2.x-dev",
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psalm\\": "src/Psalm/"
}
},
"autoload-dev": {
"psr-4": {
"Psalm\\Tests\\": "tests/"
}
"name": "vimeo/psalm",
"type": "project",
"description": "A static analysis tool for finding errors in PHP applications",
"keywords": [
"php",
"code",
"inspection",
"static analysis"
],
"license": "MIT",
"authors": [
{
"name": "Matthew Brown"
}
],
"require": {
"php": "~8.1.17 || ~8.2.4 || ~8.3.0",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-tokenizer": "*",
"composer-runtime-api": "^2",
"amphp/amp": "^3",
"amphp/byte-stream": "^2",
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^2.0 || ^3.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.2",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.16",
"sebastian/diff": "^4.0 || ^5.0",
"spatie/array-to-xml": "^2.17.0 || ^3.0",
"symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0"
},
"conflict": {
"nikic/php-parser": "4.17.0"
},
"provide": {
"psalm/psalm": "self.version"
},
"require-dev": {
"ext-curl": "*",
"amphp/phpunit-util": "^3",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^6.9",
"dg/bypass-finals": "^1.5",
"mockery/mockery": "^1.5",
"nunomaduro/mock-final-classes": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpdoc-parser": "^1.6",
"phpunit/phpunit": "^9.6",
"psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18",
"slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.6",
"symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"ext-igbinary": "^2.0.5 is required, used to serialize caching data",
"ext-curl": "In order to send data to shepherd"
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"repositories": [
{
"type": "path",
"url": "examples/plugins/composer-based/echo-checker"
}
"optimize-autoloader": true,
"sort-packages": true,
"platform-check": true
},
"extra": {
"branch-alias": {
"dev-master": "6.x-dev",
"dev-5.x": "5.x-dev",
"dev-4.x": "4.x-dev",
"dev-3.x": "3.x-dev",
"dev-2.x": "2.x-dev",
"dev-1.x": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psalm\\": "src/Psalm/"
}
},
"autoload-dev": {
"psr-4": {
"Psalm\\Tests\\": "tests/"
}
},
"repositories": [
{
"type": "path",
"url": "examples/plugins/composer-based/echo-checker"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"bin": [
"psalm",
"psalm-language-server",
"psalm-plugin",
"psalm-refactor",
"psalter"
],
"scripts": {
"cs": "@php phpcs -ps",
"cs-fix": "@php phpcbf -ps",
"lint": "@php parallel-lint ./src ./tests",
"phpunit": [
"Composer\\Config::disableProcessTimeout",
"@php paratest -f --runner=WrapperRunner"
],
"minimum-stability": "dev",
"prefer-stable": true,
"bin": [
"psalm",
"psalm-language-server",
"psalm-plugin",
"psalm-refactor",
"psalter"
"phpunit-std": [
"Composer\\Config::disableProcessTimeout",
"@php phpunit"
],
"scripts": {
"cs": "phpcs -ps",
"cs-fix": "phpcbf -ps",
"lint": "parallel-lint ./src ./tests",
"phpunit": [
"Composer\\Config::disableProcessTimeout",
"paratest -f --runner=WrapperRunner"
],
"phpunit-std": [
"Composer\\Config::disableProcessTimeout",
"phpunit"
],
"verify-callmap": "@php phpunit tests/Internal/Codebase/InternalCallMapHandlerTest.php",
"psalm": "@php ./psalm",
"psalm-set-baseline": "@php ./psalm --set-baseline=psalm-baseline.xml",
"tests": [
"@lint",
"@cs",
"@psalm",
"@phpunit"
]
},
"scripts-descriptions": {
"cs": "Checks that the code conforms to the coding standard.",
"cs-fix": "Automatically correct coding standard violations.",
"lint": "Lint php files.",
"phpunit": "Runs unit tests in parallel.",
"phpunit-std": "Runs unit tests.",
"psalm": "Runs static analysis.",
"tests": "Runs all available tests."
},
"support": {
"docs": "https://psalm.dev/docs",
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm"
}
"verify-callmap": "@php phpunit tests/Internal/Codebase/InternalCallMapHandlerTest.php",
"psalm": "@php ./psalm",
"psalm-set-baseline": "@php ./psalm --set-baseline=psalm-baseline.xml",
"tests": [
"@lint",
"@cs",
"@psalm",
"@phpunit"
]
},
"scripts-descriptions": {
"cs": "Checks that the code conforms to the coding standard.",
"cs-fix": "Automatically correct coding standard violations.",
"lint": "Lint php files.",
"phpunit": "Runs unit tests in parallel.",
"phpunit-std": "Runs unit tests.",
"psalm": "Runs static analysis.",
"tests": "Runs all available tests."
},
"support": {
"docs": "https://psalm.dev/docs",
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm"
}
}
1 change: 1 addition & 0 deletions config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
<xs:element name="RedundantCastGivenDocblockType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantCondition" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantConditionGivenDocblockType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantFlag" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantFunctionCallGivenDocblockType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="RedundantIdentityWithTrue" type="IssueHandlerType" minOccurs="0" />
Expand Down
18 changes: 9 additions & 9 deletions dictionaries/CallMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@
'decbin' => ['string', 'num'=>'int'],
'dechex' => ['string', 'num'=>'int'],
'decoct' => ['string', 'num'=>'int'],
'define' => ['bool', 'constant_name'=>'string', 'value'=>'mixed', 'case_insensitive='=>'bool'],
'define' => ['bool', 'constant_name'=>'string', 'value'=>'array|scalar|null', 'case_insensitive='=>'false'],
'define_syslog_variables' => ['void'],
'defined' => ['bool', 'constant_name'=>'string'],
'deflate_add' => ['string|false', 'context'=>'DeflateContext', 'data'=>'string', 'flush_mode='=>'int'],
Expand Down Expand Up @@ -2847,11 +2847,11 @@
'FilesystemIterator::setInfoClass' => ['void', 'class='=>'class-string'],
'FilesystemIterator::valid' => ['bool'],
'filetype' => ['string|false', 'filename'=>'string'],
'filter_has_var' => ['bool', 'input_type'=>'int', 'var_name'=>'string'],
'filter_has_var' => ['bool', 'input_type'=>'0|1|2|4|5', 'var_name'=>'string'],
'filter_id' => ['int|false', 'name'=>'string'],
'filter_input' => ['mixed|false', 'type'=>'int', 'var_name'=>'string', 'filter='=>'int', 'options='=>'array|int'],
'filter_input_array' => ['array|false|null', 'type'=>'int', 'options='=>'int|array', 'add_empty='=>'bool'],
'filter_list' => ['array'],
'filter_input' => ['mixed|false|null', 'type'=>'0|1|2|4|5', 'var_name'=>'string', 'filter='=>'int', 'options='=>'array|int'],
'filter_input_array' => ['array|false|null', 'type'=>'0|1|2|4|5', 'options='=>'int|array', 'add_empty='=>'bool'],
'filter_list' => ['non-empty-list<non-falsy-string>'],
'filter_var' => ['mixed|false', 'value'=>'mixed', 'filter='=>'int', 'options='=>'array|int'],
'filter_var_array' => ['array|false|null', 'array'=>'array', 'options='=>'array|int', 'add_empty='=>'bool'],
'FilterIterator::__construct' => ['void', 'iterator'=>'Iterator'],
Expand Down Expand Up @@ -11141,8 +11141,8 @@
'SessionIdInterface::create_sid' => ['string'],
'SessionUpdateTimestampHandler::updateTimestamp' => ['bool', 'id'=>'string', 'data'=>'string'],
'SessionUpdateTimestampHandler::validateId' => ['char', 'id'=>'string'],
'SessionUpdateTimestampHandlerInterface::updateTimestamp' => ['bool', 'key'=>'string', 'value'=>'string'],
'SessionUpdateTimestampHandlerInterface::validateId' => ['bool', 'key'=>'string'],
'SessionUpdateTimestampHandlerInterface::updateTimestamp' => ['bool', 'id'=>'string', 'data'=>'string'],
'SessionUpdateTimestampHandlerInterface::validateId' => ['bool', 'id'=>'string'],
'set_error_handler' => ['null|callable(int,string,string=,int=,array=):bool', 'callback'=>'null|callable(int,string,string=,int=,array=):bool', 'error_levels='=>'int'],
'set_exception_handler' => ['null|callable(Throwable):void', 'callback'=>'null|callable(Throwable):void'],
'set_file_buffer' => ['int', 'stream'=>'resource', 'size'=>'int'],
Expand Down Expand Up @@ -12923,8 +12923,8 @@
'strrpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int'],
'strspn' => ['int', 'string'=>'string', 'characters'=>'string', 'offset='=>'int', 'length='=>'?int'],
'strstr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'before_needle='=>'bool'],
'strtok' => ['string|false', 'string'=>'string', 'token'=>'string'],
'strtok\'1' => ['string|false', 'string'=>'string'],
'strtok' => ['non-empty-string|false', 'string'=>'string', 'token'=>'string'],
'strtok\'1' => ['non-empty-string|false', 'string'=>'string'],
'strtolower' => ['lowercase-string', 'string'=>'string'],
'strtotime' => ['int|false', 'datetime'=>'string', 'baseTimestamp='=>'?int'],
'strtoupper' => ['string', 'string'=>'string'],
Expand Down
Loading

0 comments on commit cbba54b

Please sign in to comment.