diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
deleted file mode 100644
index 24b5ae0..0000000
--- a/.github/workflows/ci.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-# This is a basic workflow to help you get started with Actions
-
-name: CI
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push or pull request events but only for the master branch
- push:
- branches:
- - master
- - main
- - FRAMEWORK_6_0
- pull_request:
- branches:
- - master
- - main
- - FRAMEWORK_6_0
-
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
- run:
- runs-on: ${{ matrix.operating-system }}
- strategy:
- matrix:
- operating-system: ['ubuntu-20.04']
- php-versions: ['7.4', '8.0', '8.1', 'latest']
- phpunit-versions: ['9.5']
- steps:
- - name: Setup github ssh key
- run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
- - name: Checkout
- uses: actions/checkout@v2
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
- ini-values: post_max_size=512M, max_execution_time=360
- coverage: xdebug
- tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2, phpstan
- - name: Setup Github Token as composer credential
- run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- - name: Install horde/test dependency and other dependencies
- run: |
- ## For unclear reasons, github action fails randomly if we do not install before we require.
- COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer config minimum-stability dev
- COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer install
- - name: Setup problem matchers for PHPUnit
- run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: run phpunit
- run: phpunit --bootstrap test/bootstrap.php
- - name: run phpstan
- run: phpstan analyze src/ --level 6
diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml
new file mode 100644
index 0000000..9e936ba
--- /dev/null
+++ b/.github/workflows/on-pr.yml
@@ -0,0 +1,43 @@
+name: Pull Request Chores
+on:
+ pull_request:
+ branches:
+ - FRAMEWORK_6_0
+ workflow_dispatch:
+
+jobs:
+ CI:
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 8.3
+ extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter, xdebug
+ ini-values: post_max_size=512M, max_execution_time=360
+ coverage: xdebug
+ tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2
+ - name: Setup Github Token as composer credential
+ run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
+ - name: Install dependencies and local tools
+ run: |
+ COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer config minimum-stability dev
+ COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer config prefer-stable true
+ COMPOSER_ROOT_VERSION=dev-FRAMEWORK_6_0 composer install --no-interaction --no-progress
+
+ - name: Run PHPUnit
+ run: vendor/bin/phpunit --testdox
+
+ - name: Run php-cs-fixer
+ run: vendor/bin/php-cs-fixer check -vvv
+
+ - name: Run phpstan (mandatory level)
+ run: vendor/bin/phpstan --no-progress
+
+ - name: Run phpstan (level 9, allowed to fail)
+ run: vendor/bin/phpstan --no-progress --level=9
+ continue-on-error: true
+
diff --git a/.github/workflows/phpdoc.yml b/.github/workflows/phpdoc.yml
deleted file mode 100644
index 67c965d..0000000
--- a/.github/workflows/phpdoc.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# This is a basic workflow to help you get started with Actions
-
-name: PHPDOC
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push or pull request events but only for the master branch
- push:
- branches:
- - FRAMEWORK_6_0
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
- run:
- runs-on: ubuntu-20.04
- steps:
- - name: Setup github ssh key
- run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
- - name: Setup uut dir
- run: |
- export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
- export UUT_DIR=$(pwd)
- export WORK_DIR=~
- export BIN_DIR="${WORK_DIR}/bin"
- mkdir -p $BIN_DIR
- git config --global user.name "PHPDOC CI Job"
- git config --global user.email "ci-job@maintaina.com"
- - name: Checkout
- uses: actions/checkout@v2
- - name: Checkout Doc Dir
- uses: actions/checkout@v2
- with:
- repository: maintaina/phpdoc
- token: ${{secrets.PHPDOC_TOKEN}}
- path: "phpdoc-git"
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: 7.4
- extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
- ini-values: post_max_size=512M, max_execution_time=360
- coverage: xdebug
- tools: composer:v2
- - name: Setup Github Token as composer credential
- run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- - name: phpdocumentor run
- run: |
- export UUT_DIR=$(pwd)
- export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
- export WORK_DIR=/home/runner/
- export BIN_DIR="${WORK_DIR}/bin"
- wget https://phpdoc.org/phpDocumentor.phar
- mkdir "${WORK_DIR}/phpdoc-out"
- mv phpDocumentor.phar $BIN_DIR/phpdocumentor
- chmod +x "${BIN_DIR}/phpdocumentor"
- echo "Creating UUT related dir in docu repo"
- mkdir -p $UUT_DIR/phpdoc-git/${GITHUB_REF##*/}/${REPO}/
- ## TODO: check for and include lib, src, app (if they exist) but not test or script dirs
- $BIN_DIR/phpdocumentor -d $UUT_DIR/src/ -t "${UUT_DIR}/phpdoc-git/${GITHUB_REF##*/}/${REPO}/"
- cd ${UUT_DIR}/phpdoc-git
- git add "${GITHUB_REF##*/}/${REPO}"
- php indexer.php ${GITHUB_REF##*/} $REPO
- git add index.html index.json
- git commit -m "Updated phpdoc for $GITHUB_REPOSITORY (${GITHUB_REF##*/} branch) from ci"
- git push
diff --git a/.github/workflows/update-satis.yml b/.github/workflows/update-satis.yml
deleted file mode 100644
index b3a7422..0000000
--- a/.github/workflows/update-satis.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-# This is a basic workflow to help you get started with Actions
-
-name: Update Satis
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push or pull request events but only for the master branch
- push:
- branches:
- - FRAMEWORK_6_0
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
- run:
- runs-on: ubuntu-20.04
- steps:
- - name: Setup github ssh key
- run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
- - name: Setup uut dir
- run: |
- export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
- export UUT_DIR=$(pwd)
- export WORK_DIR=~
- export BIN_DIR="${WORK_DIR}/bin"
- mkdir -p $BIN_DIR
- git config --global user.name "Update Satis CI Job"
- git config --global user.email "ci-job@maintaina.com"
- - name: Checkout
- uses: actions/checkout@v2
- - name: Checkout satis web dir
- uses: actions/checkout@v2
- with:
- repository: maintaina-com/maintaina-com.github.io
- token: ${{secrets.PHPDOC_TOKEN}}
- path: "maintaina-com.github.io"
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: 7.4
- extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter
- ini-values: post_max_size=512M, max_execution_time=3600
- coverage: xdebug
- tools: composer:v2
- - name: Setup Github Token as composer credential
- run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- - name: Run Satis
- run: |
- export UUT_DIR=$(pwd)
- export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
- export WORK_DIR=/home/runner/
- export BIN_DIR="${WORK_DIR}/bin"
- composer create-project composer/satis:dev-main
- php satis/bin/satis build -vvv maintaina-com.github.io/satis.json maintaina-com.github.io/ horde/horde-installer-plugin
- cd maintaina-com.github.io
- git add include/ index.html p2/ packages.json
- git commit -m "Update for horde/horde-installer-plugin"
- git push
-
-
-
-
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..da47a4a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+.DS_Store
+.buildpath
+.cache
+.project
+.settings
+nbproject/
+*~
+.#*
+*.bak
+*.orig
+*.rej
+*.swp
+*.kdev4
+.kdev4/*
+
+# Ignore ALL config files
+conf.php
+
+# Ignore testing files
+run-tests.log
+/test/*/*/*.diff
+/test/*/*/*.exp
+/test/*/*/*.log
+/test/*/*/*.out
+/test/*/*/*/*.diff
+/test/*/*/*/*.exp
+/test/*/*/*/*.log
+/test/*/*/*/*.out
+
+vendor/
+web/
+var/
+tools/
+.phive/
+.php-cs-fixer.php
+.php-cs-fixer.cache
+.phpunit.cache/
+composer.lock
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..2db37b8
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,21 @@
+in($full);
+ }
+}
+
+
+return (new PhpCsFixer\Config())
+ ->setRules([
+ '@PER-CS' => true,
+ '@PHP82Migration' => true,
+ 'php_unit_test_class_requires_covers' => true,
+ ])
+ ->setFinder($finder)
+;
diff --git a/composer.json b/composer.json
index 32ba2c4..50be300 100644
--- a/composer.json
+++ b/composer.json
@@ -1,24 +1,22 @@
{
"name": "horde/horde-installer-plugin",
+ "description": "Horde.org Framework's composer 2.x plugin",
"type": "composer-plugin",
"license": "MIT",
"autoload": {
"psr-4": {"Horde\\Composer\\": "src/"}
},
- "repositories": [
- {
- "type": "composer",
- "url": "https://horde-satis.maintaina.com/"
- }
- ],
"extra": {
"class": "Horde\\Composer\\HordeInstallerPlugin"
},
"require": {
- "composer-plugin-api": "~2.0"
+ "composer-plugin-api": "~2.0",
+ "php": ">=8.1"
},
"require-dev": {
+ "phpunit/phpunit": "^12",
"composer/composer": "~2.0",
- "horde/test": "^3"
+ "friendsofphp/php-cs-fixer": "^3",
+ "phpstan/phpstan": "^2"
}
}
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..e3d9c03
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,7 @@
+parameters:
+ level: 5
+ errorFormat: github
+ treatPhpDocTypesAsCertain: false
+ paths:
+ - src
+ - test
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 2f3efef..7dabc1a 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,26 +1,26 @@
+ colors="true">
-
+
test
-
+
- src
+ src
-
+
diff --git a/src/ApplicationLinker.php b/src/ApplicationLinker.php
index f68ec59..ebec087 100644
--- a/src/ApplicationLinker.php
+++ b/src/ApplicationLinker.php
@@ -59,7 +59,7 @@ public function run(): void
}
$appVendorDir = $vendorDir . '/' . $app;
[$vendor, $appName] = explode('/', $app);
- $appWebDir = $webDir . '/' . $appName;
+ $appWebDir = $webDir . '/' . $appName;
// abort if the app isn't actually there
if (!is_dir($appVendorDir) || !is_readable($appVendorDir)) {
// TODO: Consume IO object and warn
@@ -75,7 +75,7 @@ public function run(): void
'.gitignore', 'README.rst',
],
'dirs' => [
- 'doc',
+ 'doc',
'test',
'bin',
'script',
@@ -83,7 +83,7 @@ public function run(): void
'static', // static should be ensured to exist in webdir.
'.git',
'.github',
- ]
+ ],
];
if ($this->mode === 'symlink') {
diff --git a/src/ConfigLinker.php b/src/ConfigLinker.php
index 765c67f..7877988 100644
--- a/src/ConfigLinker.php
+++ b/src/ConfigLinker.php
@@ -63,7 +63,7 @@ public function run(): void
$relativeName = $contentInfo->getSubPathname();
$subPath = $targetDir . '/' . $contentInfo->getSubPath();
if (!is_dir($subPath)) {
- mkdir($subPath, 0770, true);
+ mkdir($subPath, 0o770, true);
}
$linkName = $targetDir . '/' . $relativeName;
$sourceName = $appConfigDir . '/' . $relativeName;
diff --git a/src/DirectoryTree.php b/src/DirectoryTree.php
index 954ac21..a413ea0 100644
--- a/src/DirectoryTree.php
+++ b/src/DirectoryTree.php
@@ -13,12 +13,6 @@
class DirectoryTree
{
- private ?string $rootPackageDir = null;
- private ?string $vendorDir = null;
- private ?string $binDir = null;
- private ?string $presetDir = null;
- private ?string $webDir = null;
-
public static function fromComposerJsonPath(string $path): self
{
if (!is_file($path)) {
@@ -33,8 +27,13 @@ public static function fromComposerJsonPath(string $path): self
return $self;
}
- public function __construct(string $rootPackageDir)
- {
+ public function __construct(
+ private string $rootPackageDir,
+ private ?string $vendorDir = null,
+ private ?string $binDir = null,
+ private ?string $presetDir = null,
+ private ?string $webDir = null
+ ) {
$this->withRootPackageDir($rootPackageDir);
}
public function withRootPackageDir(string $dir): self
@@ -43,9 +42,6 @@ public function withRootPackageDir(string $dir): self
if ($dir === '' || $dir[0] !== '/') {
$this->rootPackageDir = getcwd();
}
- if ($dir) {
- $this->rootPackageDir . '/' . $dir;
- }
return $this;
}
@@ -55,9 +51,6 @@ public function withVendorDir(string $dir): self
if ($dir === '' || $dir[0] !== '/') {
$this->vendorDir = getcwd();
}
- if ($dir) {
- $this->vendorDir . '/' . $dir;
- }
return $this;
}
@@ -163,4 +156,4 @@ public function getPresetDir(): string
{
return $this->presetDir ?? $this->getRootPackageDir() . '/presets';
}
-}
\ No newline at end of file
+}
diff --git a/src/HordeInstallerPlugin.php b/src/HordeInstallerPlugin.php
index 945c467..51bda22 100644
--- a/src/HordeInstallerPlugin.php
+++ b/src/HordeInstallerPlugin.php
@@ -42,6 +42,7 @@ public function uninstall(Composer $composer, IOInterface $io): void
public static function getSubscribedEvents(): array
{
$events = [];
+ // @phpstan-ignore-next-line This is for upgrading. An older version without reconfigure might be installed first.
if (method_exists(HordeInstaller::class, 'reconfigure')) {
$events['post-autoload-dump'] = ['reconfigureHandler', 1];
}
diff --git a/src/HordeLocalFileWriter.php b/src/HordeLocalFileWriter.php
index e69e0a5..0e34c99 100644
--- a/src/HordeLocalFileWriter.php
+++ b/src/HordeLocalFileWriter.php
@@ -56,7 +56,7 @@ private function processApp(string $app): void
// special case horde/horde needs to require the composer autoloader
if ($app == 'horde/horde') {
$hordeLocalFileContent .= $this->_legacyWorkaround($this->filesystem->normalizePath($this->vendorDir));
- $hordeLocalFileContent .= "require_once('" . $this->vendorDir ."/autoload.php');";
+ $hordeLocalFileContent .= "require_once('" . $this->vendorDir . "/autoload.php');";
}
$this->filesystem->filePutContentsIfModified($path, $hordeLocalFileContent);
}
diff --git a/src/HordeReconfigureCommand.php b/src/HordeReconfigureCommand.php
index 63fd548..1e08ec1 100644
--- a/src/HordeReconfigureCommand.php
+++ b/src/HordeReconfigureCommand.php
@@ -28,6 +28,7 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
+ // @phpstan-ignore-next-line This is for upgrading. An older version without reconfigure might be installed first.
if (method_exists($this, 'requireComposer')) {
$composer = $this->requireComposer();
} else {
diff --git a/src/HordeReconfigureFlow.php b/src/HordeReconfigureFlow.php
index acfa8b3..cc6b0fe 100644
--- a/src/HordeReconfigureFlow.php
+++ b/src/HordeReconfigureFlow.php
@@ -19,7 +19,6 @@
use Horde\Composer\IOAdapter\SymphonyOutputAdapter;
use RuntimeException;
-
class HordeReconfigureFlow
{
private FlowIoInterface $io;
@@ -103,7 +102,7 @@ public function run(): int
$snippetHandler->handle();
$this->io->writeln('Writing app configs to /var/config dir');
- $registrySnippetFileWriter = new RegistrySnippetFileWriter(
+ $registrySnippetFileWriter = new RegistrySnippetFileWriter(
$filesystem,
$rootPackageDir,
$hordeApps
diff --git a/src/HordeYmlFormat/Authors.php b/src/HordeYmlFormat/Authors.php
index 56b4fd9..5de072d 100644
--- a/src/HordeYmlFormat/Authors.php
+++ b/src/HordeYmlFormat/Authors.php
@@ -4,6 +4,4 @@
namespace Horde\Composer\HordeYmlFormat;
-class Authors
-{
-}
+class Authors {}
diff --git a/src/HordeYmlFormat/Autoload.php b/src/HordeYmlFormat/Autoload.php
index c3add9d..655d501 100644
--- a/src/HordeYmlFormat/Autoload.php
+++ b/src/HordeYmlFormat/Autoload.php
@@ -4,6 +4,4 @@
namespace Horde\Composer\HordeYmlFormat;
-class Autoload
-{
-}
+class Autoload {}
diff --git a/src/HordeYmlFormat/DependencyList.php b/src/HordeYmlFormat/DependencyList.php
index afde1fd..9a7e3b9 100644
--- a/src/HordeYmlFormat/DependencyList.php
+++ b/src/HordeYmlFormat/DependencyList.php
@@ -29,7 +29,7 @@ public function getDependencies(): iterable
*/
public function getPearDependencies(): iterable
{
- return array_filter((array)$this->dependencies, fn ($dep) => $dep instanceof PearDependency);
+ return array_filter((array) $this->dependencies, fn($dep) => $dep instanceof PearDependency);
}
/**
@@ -37,7 +37,7 @@ public function getPearDependencies(): iterable
*/
public function getComposerDependencies(): iterable
{
- return array_filter((array)$this->dependencies, fn ($dep) => $dep instanceof ComposerDependency);
+ return array_filter((array) $this->dependencies, fn($dep) => $dep instanceof ComposerDependency);
}
/**
@@ -45,6 +45,6 @@ public function getComposerDependencies(): iterable
*/
public function getPlatformDependencies(): iterable
{
- return array_filter((array)$this->dependencies, fn ($dep) => $dep instanceof PlatformDependency);
+ return array_filter((array) $this->dependencies, fn($dep) => $dep instanceof PlatformDependency);
}
}
diff --git a/src/HordeYmlFormat/Version.php b/src/HordeYmlFormat/Version.php
index ef5fb5a..0e4593e 100644
--- a/src/HordeYmlFormat/Version.php
+++ b/src/HordeYmlFormat/Version.php
@@ -12,7 +12,7 @@ class Version
private string $release;
private string $api;
- public function __construct(string $release, string $api = null)
+ public function __construct(string $release, ?string $api = null)
{
$this->release = $release;
$this->api = $api ?? $release;
diff --git a/src/IOAdapter/ComposerIoAdapter.php b/src/IOAdapter/ComposerIoAdapter.php
index 747dc55..5c5071c 100644
--- a/src/IOAdapter/ComposerIoAdapter.php
+++ b/src/IOAdapter/ComposerIoAdapter.php
@@ -1,4 +1,5 @@
libs as $lib) {
[$vendor, $name] = explode('/', $lib, 2);
- $libraryPath = $this->vendorDir . '/'. $vendor . '/' . $name;
+ $libraryPath = $this->vendorDir . '/' . $vendor . '/' . $name;
$jsSourcePath = $libraryPath . '/js';
if (!$this->filesystem->isReadable($jsSourcePath)) {
continue;
diff --git a/src/PackageDocRegistrySnippetHandler.php b/src/PackageDocRegistrySnippetHandler.php
index 5647ea6..b60cf1d 100644
--- a/src/PackageDocRegistrySnippetHandler.php
+++ b/src/PackageDocRegistrySnippetHandler.php
@@ -38,7 +38,7 @@ public function __construct(DirectoryTree $tree, Filesystem $filesystem)
/**
* Scan all packages for a registry snippet
- *
+ *
* Copy snippets to the horde base app's registry snippet dir
*
* @return void
@@ -50,7 +50,7 @@ public function handle(): void
$vendorDir = $this->tree->getVendorSpecificDir($vendor);
foreach ($this->tree->getPackagesByVendor($vendor) as $package) {
// TODO: Check for a .yml file to ensure it is a valid package
- $sourceDir = $this->tree->getDependencyDir($vendor, $package) . '/doc/registry.d';
+ $sourceDir = $this->tree->getDependencyDir($vendor, $package) . '/doc/registry.d';
if (!is_dir($sourceDir) || !is_readable($sourceDir)) {
continue;
}
diff --git a/src/RecursiveCopy.php b/src/RecursiveCopy.php
index 7568d53..d40e2e8 100644
--- a/src/RecursiveCopy.php
+++ b/src/RecursiveCopy.php
@@ -12,7 +12,7 @@
/**
* Recursive copy handler
- *
+ *
* This wants to be factored out.
*/
class RecursiveCopy
@@ -25,12 +25,12 @@ class RecursiveCopy
*/
private array $filter = [
'.',
- '..'
+ '..',
];
-
+
/**
* Create a recursive copy operation pending execution
- *
+ *
* @param string $sourceDir Where to copy from
* @param string $targetDir Where to copy to
* @param array $filter Files or dirs to ignore, including subdir content.
@@ -49,14 +49,14 @@ public function copy(): void
{
if (!file_exists($this->targetDir)) {
// TODO: Exception if fails
- mkdir($this->targetDir, 0777, true);
+ mkdir($this->targetDir, 0o777, true);
}
- $this->copyLevel($this->sourceDir, $this->targetDir, $this->filter);
+ $this->copyLevel($this->sourceDir, $this->targetDir, $this->filter);
}
/**
* Internal recursion function for copy()
- *
+ *
* @param string $sourceDir Where to copy from
* @param string $targetDir Where to copy to
* @param array $filter Files or dirs to ignore, including subdir content.
@@ -92,4 +92,4 @@ private function copyLevel(string $sourceDir, string $targetDir, array $filter):
}
}
-}
\ No newline at end of file
+}
diff --git a/src/RegistrySnippetFileWriter.php b/src/RegistrySnippetFileWriter.php
index 44d41f4..5efa382 100644
--- a/src/RegistrySnippetFileWriter.php
+++ b/src/RegistrySnippetFileWriter.php
@@ -70,10 +70,10 @@ public function run(): void
$registryAppSnippet = 'configRegistryDir . '/02-location-' . $appName . '.php';
$registryAppSnippet .=
'$this->applications[\'' . $appName . '\'][\'fileroot\'] = "$deployment_fileroot/' . $appName . '";' . PHP_EOL .
- '$this->applications[\'' . $appName . '\'][\'webroot\'] = $this->applications[\'horde\'][\'webroot\'] . \'/../' . $appName . "';" . PHP_EOL .
+ '$this->applications[\'' . $appName . '\'][\'webroot\'] = $this->applications[\'horde\'][\'webroot\'] . \'/../' . $appName . "';" . PHP_EOL .
'$this->applications[\'' . $appName . '\'][\'themesfs\'] = $this->applications[\'horde\'][\'fileroot\'] . \'/../themes/' . $appName . '/\';' . PHP_EOL .
'$this->applications[\'' . $appName . '\'][\'themesuri\'] = $this->applications[\'horde\'][\'webroot\'] . \'/../themes/' . $appName . '/\';';
}
diff --git a/src/ThemesCatalog.php b/src/ThemesCatalog.php
index c3543fd..e95f475 100644
--- a/src/ThemesCatalog.php
+++ b/src/ThemesCatalog.php
@@ -11,7 +11,7 @@
/**
* Encapsulate handling the themes catalog
- *
+ *
* @internal No Backward Compatibility promise as of now, refactoring overdue
*/
class ThemesCatalog
@@ -86,9 +86,6 @@ public function register(
if (isset($this->catalog[$themeName]) && !is_iterable($this->catalog[$themeName])) {
throw new Exception('Catalog content is not valid');
}
- if (!is_array($this->catalog)) {
- throw new Exception('Catalog content is not valid: No array access');
- }
$this->catalog[$themeName][$app] = [
'provider' => $installDir,
'linkDir' => $entry->getPathname(),
diff --git a/src/ThemesHandler.php b/src/ThemesHandler.php
index 614be75..0d756d2 100644
--- a/src/ThemesHandler.php
+++ b/src/ThemesHandler.php
@@ -7,6 +7,7 @@
use Composer\Util\Filesystem;
use DirectoryIterator;
use Exception;
+
/**
* Themes Handler class
*
@@ -38,12 +39,11 @@ class ThemesHandler
private string $mode = 'symlink';
public function __construct(
- Filesystem $filesystem,
+ Filesystem $filesystem,
string $rootDir,
string $vendorDir,
string $mode = 'symlink'
- )
- {
+ ) {
$this->filesystem = $filesystem;
$this->rootDir = $rootDir;
$this->vendorDir = $vendorDir;
@@ -64,16 +64,15 @@ protected function ensureThemesFolderExists(): void
/**
* Setup themes shipped with an app
- *
+ *
* These may be named "default" or other
- *
+ *
*/
public function setupDefaultTheme(): void
{
$vendorDir = new DirectoryIterator($this->vendorDir);
// Consider all vendors, not just "horde" - on purpose
- foreach ($vendorDir as $vendor)
- {
+ foreach ($vendorDir as $vendor) {
$vendorName = $vendor->getFileName();
if (!$vendor->isDir() || $vendor->isDot() || in_array($vendorName, ['bin', 'composer'])) {
continue;
@@ -100,7 +99,7 @@ public function setupDefaultTheme(): void
continue;
}
$themeName = $theme->getFileName();
- $targetDir = $this->themesDir . '/' . $packageName . '/' . $themeName;
+ $targetDir = $this->themesDir . '/' . $packageName . '/' . $themeName;
$this->filesystem->ensureDirectoryExists(dirname($targetDir));
if ($this->mode === 'symlink') {
$this->filesystem->relativeSymlink($themeSourceDir, $targetDir);
diff --git a/test/bootstrap.php b/test/bootstrap.php
deleted file mode 100644
index 88f2d9b..0000000
--- a/test/bootstrap.php
+++ /dev/null
@@ -1,13 +0,0 @@
-