Skip to content

Commit

Permalink
Merge branch 'master' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 27, 2023
2 parents 09413b6 + 3238f4e commit 98373af
Show file tree
Hide file tree
Showing 161 changed files with 5,048 additions and 1,072 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
command: bin/build-phar.sh
- run:
name: Smoke test Phar file
command: build/psalm.phar --version
# Change the root away from the project root to avoid conflicts with the Composer autoloader
command: build/psalm.phar --version --root build
- store_artifacts:
path: build/psalm.phar
- run:
Expand All @@ -63,7 +64,7 @@ jobs:
# The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass
resource_class: large
test-with-real-projects:
executor: php-81
executor: php-82
steps:
- checkout # used here just for the side effect of loading the github public ssh key so we can clone other stuff
- attach_workspace:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected].0
uses: fkirc/[email protected].1
with:
concurrent_skipping: always
cancel_others: true
Expand Down
11 changes: 11 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
- [BC] The only optional boolean parameter of `TKeyedArray::getGenericArrayType` was removed, and was replaced with a string parameter with a different meaning.

- [BC] The `TDependentListKey` type was removed and replaced with an optional property of the `TIntRange` type.
-
- [BC] `TCallableArray` and `TCallableList` removed and replaced with `TCallableKeyedArray`.

- [BC] Class `Psalm\Issue\MixedInferredReturnType` was removed

- [BC] Value of constant `Psalm\Type\TaintKindGroup::ALL_INPUT` changed to reflect new `TaintKind::INPUT_SLEEP` and `TaintKind::INPUT_XPATH` have been added. Accordingly, default values for `$taint` parameters of `Psalm\Codebase::addTaintSource()` and `Psalm\Codebase::addTaintSink()` have been changed as well.

- [BC] Property `Config::$shepherd_host` was replaced with `Config::$shepherd_endpoint`
Expand Down Expand Up @@ -47,6 +50,14 @@

- [BC] `Psalm\CodeLocation\Raw`, `Psalm\CodeLocation\ParseErrorLocation`, `Psalm\CodeLocation\DocblockTypeLocation`, `Psalm\Report\CountReport`, `Psalm\Type\Atomic\TNonEmptyArray` are now all final.

- [BC] `Psalm\Config` is now final.

- [BC] The return type of `Psalm\Plugin\ArgTypeInferer::infer` changed from `Union|false` to `Union|null`

- [BC] The `extra_types` property and `setIntersectionTypes` method of `Psalm\Type\Atomic\TTypeAlias` were removed.

- [BC] Methods `convertSeverity` and `calculateFingerprint` of `Psalm\Report\CodeClimateReport` were removed.

# Upgrading from Psalm 4 to Psalm 5
## Changed

Expand Down
7 changes: 5 additions & 2 deletions bin/test-with-real-projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ psl)
cd endtoend-test-psl
git checkout 2.3.x
composer install
"$PSALM" --monochrome -c config/psalm.xml
"$PSALM" --monochrome -c config/psalm.xml tests/static-analysis
# Avoid conflicts with old psalm when running phar tests
rm -rf vendor/vimeo/psalm
sed 's/ErrorOutputBehavior::Packed, ErrorOutputBehavior::Discard/ErrorOutputBehavior::Discard/g' -i src/Psl/Shell/execute.php
"$PSALM_PHAR" --monochrome -c config/psalm.xml
"$PSALM_PHAR" --monochrome -c config/psalm.xml tests/static-analysis
;;

laravel)
Expand Down
18 changes: 17 additions & 1 deletion bin/tests-github-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ exit "$exit_code"'
mkdir -p build/parallel/ build/phpunit/logs/

find tests -name '*Test.php' | shuf --random-source=<(get_seeded_random) > build/tests_all
split --number="l/$chunk_number/$chunk_count" build/tests_all > build/tests_split
# 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)
local -r chunk_lines=$(( $lines / $chunk_count ))
local -r rest=$(( $lines % $chunk_count ))
local start_line
local end_line
if [[ $chunk_number -le $rest ]]
then
start_line=$(( ($chunk_number - 1) * $chunk_lines + $chunk_number ))
end_line=$(( $chunk_number * $chunk_lines + $chunk_number ))
else
start_line=$(( ($chunk_number - 1) * $chunk_lines + $rest + 1 ))
end_line=$(( $chunk_number * $chunk_lines + $rest ))
fi
awk "NR==$start_line,NR==$end_line" <build/tests_all > build/tests_split

parallel --group -j"$parallel_processes" --rpl {_}\ s/\\//_/g --joblog build/parallel/jobs.log "$phpunit_cmd" < build/tests_split
}

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"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",
"symfony/filesystem": "^5.4 || ^6.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"
Expand All @@ -60,7 +60,7 @@
"psalm/plugin-phpunit": "^0.18",
"slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.6",
"symfony/process": "^4.4 || ^5.0 || ^6.0"
"symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"ext-igbinary": "^2.0.5 is required, used to serialize caching data",
Expand Down
3 changes: 2 additions & 1 deletion config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<xs:attribute name="findUnusedPsalmSuppress" type="xs:boolean" default="false" />
<!-- TODO: Update default to true in Psalm 6 -->
<xs:attribute name="findUnusedBaselineEntry" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedIssueHandlerSuppression" type="xs:boolean" default="true" />
<xs:attribute name="hideExternalErrors" type="xs:boolean" default="false" />
<xs:attribute name="hoistConstants" type="xs:boolean" default="false" />
<xs:attribute name="ignoreInternalFunctionFalseReturn" type="xs:boolean" default="false" />
Expand Down Expand Up @@ -333,7 +334,6 @@
<xs:element name="MixedAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedClone" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedInferredReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedMethodCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyAssignment" type="IssueHandlerType" minOccurs="0" />
Expand Down Expand Up @@ -495,6 +495,7 @@
<xs:element name="UnusedClosureParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedConstructor" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedDocblockParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedIssueHandlerSuppression" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedForeachValue" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedFunctionCall" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedMethod" type="MethodIssueHandlerType" minOccurs="0" />
Expand Down
Loading

0 comments on commit 98373af

Please sign in to comment.