diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-04-03 09:52:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 09:52:25 +0200 |
commit | cac31061c75e5a0f7123022d44ed19becbb8413d (patch) | |
tree | 86095c8d69836ad9b4d9e07f496a77a152a99b5d | |
parent | b5da85df3a83da23d13437d13486ceabc738fc24 (diff) | |
parent | a0e3b3b8299c322dc595118df4359dcd8500ff52 (diff) | |
download | nextcloud-server-cac31061c75e5a0f7123022d44ed19becbb8413d.tar.gz nextcloud-server-cac31061c75e5a0f7123022d44ed19becbb8413d.zip |
Merge pull request #37503 from nextcloud/fix/composer-psalm-threads
Use all available threads for running psalm from composer
-rw-r--r-- | build/psalm-baseline.xml | 2 | ||||
-rw-r--r-- | build/stubs/psr_container.php | 52 | ||||
-rw-r--r-- | composer.json | 4 | ||||
-rw-r--r-- | psalm-ocp.xml | 1 | ||||
-rw-r--r-- | psalm.xml | 1 |
5 files changed, 57 insertions, 3 deletions
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 8661726f017..d90e6a656a1 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1536,7 +1536,7 @@ <file src="core/routes.php"> <InvalidScope occurrences="2"> <code>$this</code> - <code>$this</code> + <code>$this->create('core_ajax_update', '/core/ajax/update.php')</code> </InvalidScope> </file> <file src="core/templates/layout.public.php"> diff --git a/build/stubs/psr_container.php b/build/stubs/psr_container.php new file mode 100644 index 00000000000..a87584c6f3a --- /dev/null +++ b/build/stubs/psr_container.php @@ -0,0 +1,52 @@ +<?php + +declare(strict_types=1); + +namespace Psr\Container; + +use Throwable; + +/** + * Base interface representing a generic exception in a container. + */ +interface ContainerExceptionInterface extends Throwable +{ +} + +/** + * Describes the interface of a container that exposes methods to read its entries. + */ +interface ContainerInterface +{ + /** + * Finds an entry of the container by its identifier and returns it. + * + * @param string $id Identifier of the entry to look for. + * + * @throws NotFoundExceptionInterface No entry was found for **this** identifier. + * @throws ContainerExceptionInterface Error while retrieving the entry. + * + * @return mixed Entry. + */ + public function get(string $id); + + /** + * Returns true if the container can return an entry for the given identifier. + * Returns false otherwise. + * + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. + * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. + * + * @param string $id Identifier of the entry to look for. + * + * @return bool + */ + public function has(string $id): bool; +} + +/** + * No entry was found in the container. + */ +interface NotFoundExceptionInterface extends ContainerExceptionInterface +{ +} diff --git a/composer.json b/composer.json index 4a58833c996..8615b1ca8db 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "cs:fix": "php-cs-fixer fix", "cs:check": "php-cs-fixer fix --dry-run --diff", "lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l", - "psalm": "psalm --threads=1", - "psalm:update-baseline": "psalm --threads=1 --update-baseline" + "psalm": "psalm --threads=$(nproc)", + "psalm:update-baseline": "psalm --threads=$(nproc) --update-baseline" } } diff --git a/psalm-ocp.xml b/psalm-ocp.xml index f117afc550f..76a42131512 100644 --- a/psalm-ocp.xml +++ b/psalm-ocp.xml @@ -20,6 +20,7 @@ <stubs> <file name="build/stubs/gd.php"/> <file name="build/stubs/ldap.php"/> + <file name="build/stubs/psr_container.php"/> </stubs> <extraFiles> <directory name="3rdparty"/> diff --git a/psalm.xml b/psalm.xml index 009c59c7857..7ddce05c549 100644 --- a/psalm.xml +++ b/psalm.xml @@ -77,6 +77,7 @@ <file name="build/stubs/ftp.php"/> <file name="build/stubs/pcntl.php"/> <file name="build/stubs/zip.php"/> + <file name="build/stubs/psr_container.php"/> <file name="3rdparty/sabre/uri/lib/functions.php" /> </stubs> <issueHandlers> |