Skip to content

Commit

Permalink
Merge remote-tracking branch 'hub/master' into fix_intersection_scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jul 28, 2023
2 parents 8364fef + 73ebe22 commit 068bfbf
Show file tree
Hide file tree
Showing 19 changed files with 1,032 additions and 252 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/
# See https://app.circleci.com/pipelines/github/vimeo/psalm
version: 2.1
executors:
php-74:
Expand Down
54 changes: 52 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,51 @@ jobs:

- run: |
git ls-files | grep \\\.php$ | grep -v ^dictionaries/scripts/* | ./vendor/bin/parallel-lint --stdin
code-style:
name: Code Style Analysis
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
coverage: none
env:
fail-fast: true

- uses: actions/checkout@v3

- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: composer update --no-install
env:
COMPOSER_ROOT_VERSION: dev-master

- name: Cache composer cache
uses: actions/cache@v3
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: Code Style Analysis with PHPCS
run: vendor/bin/phpcs -d memory_limit=512M

chunk-matrix:
permissions:
contents: none
Expand All @@ -70,7 +115,7 @@ jobs:
echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT
tests:
name: "Unit Tests - ${{ matrix.chunk }}"
name: "Unit Tests - PHP ${{ matrix.php-version }} ${{ matrix.chunk }}/${{ matrix.count }}"

runs-on: ubuntu-latest
needs:
Expand All @@ -79,6 +124,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
count: ${{ fromJson(needs.chunk-matrix.outputs.count) }}
chunk: ${{ fromJson(needs.chunk-matrix.outputs.chunks) }}

Expand All @@ -91,7 +141,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: "${{ matrix.php-version }}"
ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M
tools: composer:v2
coverage: none
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-dom": "*",
Expand Down
70 changes: 23 additions & 47 deletions dictionaries/CallMap.php

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions dictionaries/CallMap_83_delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,124 @@
'old' => ['array{runs:int,collected:int,threshold:int,roots:int}'],
'new' => ['array{runs:int,collected:int,threshold:int,roots:int,running:bool,protected:bool,full:bool,buffer_size:int}'],
],
'srand' => [
'old' => ['void', 'seed='=>'int', 'mode='=>'int'],
'new' => ['void', 'seed='=>'?int', 'mode='=>'int'],
],
'mt_srand' => [
'old' => ['void', 'seed='=>'int', 'mode='=>'int'],
'new' =>['void', 'seed='=>'?int', 'mode='=>'int'],
],
'posix_getrlimit' => [
'old' => ['array{"soft core": string, "hard core": string, "soft data": string, "hard data": string, "soft stack": integer, "hard stack": string, "soft totalmem": string, "hard totalmem": string, "soft rss": string, "hard rss": string, "soft maxproc": integer, "hard maxproc": integer, "soft memlock": integer, "hard memlock": integer, "soft cpu": string, "hard cpu": string, "soft filesize": string, "hard filesize": string, "soft openfiles": integer, "hard openfiles": integer}|false'],
'new' => ['array{"soft core": string, "hard core": string, "soft data": string, "hard data": string, "soft stack": integer, "hard stack": string, "soft totalmem": string, "hard totalmem": string, "soft rss": string, "hard rss": string, "soft maxproc": integer, "hard maxproc": integer, "soft memlock": integer, "hard memlock": integer, "soft cpu": string, "hard cpu": string, "soft filesize": string, "hard filesize": string, "soft openfiles": integer, "hard openfiles": integer}|false', 'resource=' => '?int'],
],
'natcasesort' => [
'old' => ['bool', '&rw_array'=>'array'],
'new' => ['true', '&rw_array'=>'array'],
],
'natsort' => [
'old' => ['bool', '&rw_array'=>'array'],
'new' => ['true', '&rw_array'=>'array'],
],
'rsort' => [
'old' => ['bool', '&rw_array'=>'array', 'flags='=>'int'],
'new' => ['true', '&rw_array'=>'array', 'flags='=>'int'],
],
'hash_pbkdf2' => [
'old' => ['non-empty-string', 'algo'=>'string', 'password'=>'string', 'salt'=>'string', 'iterations'=>'int', 'length='=>'int', 'binary='=>'bool'],
'new' => ['non-empty-string', 'algo'=>'string', 'password'=>'string', 'salt'=>'string', 'iterations'=>'int', 'length='=>'int', 'binary='=>'bool', 'options=' => 'array'],
],
'imap_setflag_full' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'],
],
'imap_expunge' => [
'old' => ['bool', 'imap'=>'IMAP\Connection'],
'new' => ['true', 'imap'=>'IMAP\Connection'],
],
'imap_gc' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'flags'=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'flags'=>'int'],
],
'imap_undelete' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'message_nums'=>'string', 'flags='=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'message_nums'=>'string', 'flags='=>'int'],
],
'imap_delete' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'message_nums'=>'string', 'flags='=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'message_nums'=>'string', 'flags='=>'int'],
],
'imap_clearflag_full' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'],
],
'imap_close' => [
'old' => ['bool', 'imap'=>'IMAP\Connection', 'flags='=>'int'],
'new' => ['true', 'imap'=>'IMAP\Connection', 'flags='=>'int'],
],
'intlcal_clear' => [
'old' => ['bool', 'calendar'=>'IntlCalendar', 'field='=>'?int'],
'new' => ['true', 'calendar'=>'IntlCalendar', 'field='=>'?int'],
],
'intlcal_set_lenient' => [
'old' => ['bool', 'calendar'=>'IntlCalendar', 'lenient'=>'bool'],
'new' => ['true', 'calendar'=>'IntlCalendar', 'lenient'=>'bool'],
],
'intlcal_set_first_day_of_week' => [
'old' => ['bool', 'calendar'=>'IntlCalendar', 'dayOfWeek'=>'int'],
'new' => ['true', 'calendar'=>'IntlCalendar', 'dayOfWeek'=>'int'],
],
'datefmt_set_timezone' => [
'old' => ['false|null', 'formatter'=>'IntlDateFormatter', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'],
'new' => ['bool', 'formatter'=>'IntlDateFormatter', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'],
],
'IntlRuleBasedBreakIterator::setText' => [
'old' => ['?bool', 'text'=>'string'],
'new' => ['bool', 'text'=>'string'],
],
'IntlCodePointBreakIterator::setText' => [
'old' => ['?bool', 'text'=>'string'],
'new' => ['bool', 'text'=>'string'],
],
'IntlDateFormatter::setTimeZone' => [
'old' => ['null|false', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'],
'new' => ['bool', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'],
],
'IntlChar::enumCharNames' => [
'old' => ['?bool', 'start'=>'string|int', 'end'=>'string|int', 'callback'=>'callable(int,int,int):void', 'type='=>'int'],
'new' => ['bool', 'start'=>'string|int', 'end'=>'string|int', 'callback'=>'callable(int,int,int):void', 'type='=>'int'],
],
'IntlBreakIterator::setText' => [
'old' => ['?bool', 'text'=>'string'],
'new' => ['bool', 'text'=>'string'],
],
],

'removed' => [
'OutOfBoundsException::__clone' => ['void'],
'ArgumentCountError::__clone' => ['void'],
'ArithmeticError::__clone' => ['void'],
'BadFunctionCallException::__clone' => ['void'],
'BadMethodCallException::__clone' => ['void'],
'ClosedGeneratorException::__clone' => ['void'],
'DomainException::__clone' => ['void'],
'ErrorException::__clone' => ['void'],
'IntlException::__clone' => ['void'],
'InvalidArgumentException::__clone' => ['void'],
'JsonException::__clone' => ['void'],
'LengthException::__clone' => ['void'],
'LogicException::__clone' => ['void'],
'OutOfRangeException::__clone' => ['void'],
'OverflowException::__clone' => ['void'],
'ParseError::__clone' => ['void'],
'RangeException::__clone' => ['void'],
'ReflectionNamedType::__clone' => ['void'],
'ReflectionObject::__clone' => ['void'],
'RuntimeException::__clone' => ['void'],
'TypeError::__clone' => ['void'],
'UnderflowException::__clone' => ['void'],
'UnexpectedValueException::__clone' => ['void'],
'IntlCodePointBreakIterator::__construct' => ['void'],
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Psalm\Internal\LanguageServer\Client\Progress;

use LanguageServerProtocol\LogMessage;
use LanguageServerProtocol\MessageType;
use LogicException;
use Psalm\Internal\LanguageServer\ClientHandler;

/** @internal */
final class LegacyProgress implements ProgressInterface
{
private const STATUS_INACTIVE = 'inactive';
private const STATUS_ACTIVE = 'active';
private const STATUS_FINISHED = 'finished';

private string $status = self::STATUS_INACTIVE;

private ClientHandler $handler;
private ?string $title = null;

public function __construct(ClientHandler $handler)
{
$this->handler = $handler;
}

public function begin(string $title, ?string $message = null, ?int $percentage = null): void
{

if ($this->status === self::STATUS_ACTIVE) {
throw new LogicException('Progress has already been started');
}

if ($this->status === self::STATUS_FINISHED) {
throw new LogicException('Progress has already been finished');
}

$this->title = $title;

$this->notify($message);

$this->status = self::STATUS_ACTIVE;
}

public function update(?string $message = null, ?int $percentage = null): void
{
if ($this->status === self::STATUS_FINISHED) {
throw new LogicException('Progress has already been finished');
}

if ($this->status === self::STATUS_INACTIVE) {
throw new LogicException('Progress has not been started yet');
}

$this->notify($message);
}

public function end(?string $message = null): void
{
if ($this->status === self::STATUS_FINISHED) {
throw new LogicException('Progress has already been finished');
}

if ($this->status === self::STATUS_INACTIVE) {
throw new LogicException('Progress has not been started yet');
}

$this->notify($message);

$this->status = self::STATUS_FINISHED;
}

private function notify(?string $message): void
{
$this->handler->notify(
'telemetry/event',
new LogMessage(
MessageType::INFO,
$this->title . (empty($message) ? '' : (': ' . $message)),
),
);
}
}
Loading

0 comments on commit 068bfbf

Please sign in to comment.