From aee3bd14dbce189b912bdbf1034aee70895bfdab Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Thu, 21 Nov 2024 07:52:30 +0000 Subject: [PATCH] Add build-path to php-ext config options for PIE (#12206) * Add build-path to php-ext config options * Use phpstan- prefix for shape definitions --- res/composer-schema.json | 6 ++++++ src/Composer/Package/Package.php | 12 +++++++++--- src/Composer/Package/PackageInterface.php | 5 ++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/res/composer-schema.json b/res/composer-schema.json index 9f76bc4b7..9df390e06 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -317,6 +317,12 @@ "example": false, "default": true }, + "build-path": { + "type": ["string", "null"], + "description": "If specified, this is the subdirectory that will be used to build the extension instead of the root of the project.", + "example": "my-extension-source", + "default": null + }, "configure-options": { "type": "array", "description": "These configure options make up the flags that can be passed to ./configure when installing the extension.", diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index ad17538d6..faa2a07a0 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -23,6 +23,7 @@ use Composer\Util\ComposerMirror; * * @phpstan-import-type AutoloadRules from PackageInterface * @phpstan-import-type DevAutoloadRules from PackageInterface + * @phpstan-import-type PhpExtConfig from PackageInterface */ class Package extends BasePackage { @@ -98,7 +99,10 @@ class Package extends BasePackage protected $isDefaultBranch = false; /** @var mixed[] */ protected $transportOptions = []; - /** @var array{priority?: int, configure-options?: list}|null */ + /** + * @var array|null + * @phpstan-var PhpExtConfig|null + */ protected $phpExt = null; /** @@ -593,9 +597,11 @@ class Package extends BasePackage } /** - * Sets the list of paths added to PHP's include path. + * Sets the settings for php extension packages * - * @param array{extension-name?: string, priority?: int, support-zts?: bool, support-nts?: bool, configure-options?: list}|null $phpExt List of directories. + * @param array|null $phpExt + * + * @phpstan-param PhpExtConfig|null $phpExt */ public function setPhpExt(?array $phpExt): void { diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index 6e723d5bb..dec040334 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -23,6 +23,7 @@ use Composer\Repository\RepositoryInterface; * * @phpstan-type AutoloadRules array{psr-0?: array, psr-4?: array, classmap?: list, files?: list, exclude-from-classmap?: list} * @phpstan-type DevAutoloadRules array{psr-0?: array, psr-4?: array, classmap?: list, files?: list} + * @phpstan-type PhpExtConfig array{extension-name?: string, priority?: int, support-zts?: bool, support-nts?: bool, build-path?: string|null, configure-options?: list} */ interface PackageInterface { @@ -326,7 +327,9 @@ interface PackageInterface /** * Returns the settings for php extension packages * - * @return array{extension-name?: string, priority?: int, support-zts?: bool, support-nts?: bool, configure-options?: list}|null + * @return array|null + * + * @phpstan-return PhpExtConfig|null */ public function getPhpExt(): ?array;