mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
chore: update codebase to php8.1 (#3827)
* chore: set minimum php version to 8.1 Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * chore: update codebase to php8.1 Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * Apply fixes from StyleCI * chore: update workflow php version Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: more caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: phpstan caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * Apply fixes from StyleCI * fix: test-caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: test-caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: test-caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: introduce `Flarum\Locale\TranslatorInterface` Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * Apply fixes from StyleCI * chore: remove mixin Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: test-caught errors Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> * fix: one last error Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> --------- Signed-off-by: Sami Mazouz <sychocouldy@gmail.com> Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
@@ -26,7 +26,7 @@ class BeginTransactionAndSetDatabase implements ExtenderInterface
|
||||
$this->setDbOnTestCase = $setDbOnTestCase;
|
||||
}
|
||||
|
||||
public function extend(Container $container, Extension $extension = null)
|
||||
public function extend(Container $container, Extension $extension = null): void
|
||||
{
|
||||
$db = $container->make(ConnectionInterface::class);
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class OverrideExtensionManagerForTests implements ExtenderInterface
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
|
||||
public function extend(Container $container, Extension $extension = null)
|
||||
public function extend(Container $container, Extension $extension = null): void
|
||||
{
|
||||
$container->when(ExtensionManagerIncludeCurrent::class)->needs('$enabledIds')->give($this->extensions);
|
||||
if (count($this->extensions)) {
|
||||
|
@@ -26,7 +26,7 @@ class SetSettingsBeforeBoot implements ExtenderInterface
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
public function extend(Container $container, Extension $extension = null)
|
||||
public function extend(Container $container, Extension $extension = null): void
|
||||
{
|
||||
if (count($this->settings)) {
|
||||
$settings = $container->make(SettingsRepositoryInterface::class);
|
||||
|
@@ -20,6 +20,7 @@ use Illuminate\Contracts\Filesystem\Cloud;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\Flysystem\Adapter\Local;
|
||||
use League\Flysystem\Filesystem as FlysystemFilesystem;
|
||||
|
||||
@@ -49,10 +50,7 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
$this->enabledIds = $enabledIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @{@inheritDoc}
|
||||
*/
|
||||
public function getExtensions()
|
||||
public function getExtensions(): Collection
|
||||
{
|
||||
$extensions = parent::getExtensions();
|
||||
|
||||
@@ -61,12 +59,12 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
if (Arr::get($package, 'type') === 'flarum-extension') {
|
||||
$current = new Extension($this->paths->vendor.'/../', $package);
|
||||
$current->setInstalled(true);
|
||||
$current->setVersion(Arr::get($package, 'version'));
|
||||
$current->calculateDependencies([], []);
|
||||
$current->setVersion(Arr::get($package, 'version', '0.0'));
|
||||
$current->calculateDependencies([]);
|
||||
|
||||
$extensions->put($current->getId(), $current);
|
||||
|
||||
$this->extensions = $extensions->sortBy(function ($extension, $name) {
|
||||
$this->extensions = $extensions->sortBy(function ($extension) {
|
||||
return $extension->composerJsonAttribute('extra.flarum-extension.title');
|
||||
});
|
||||
}
|
||||
@@ -79,7 +77,7 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
* However, since some logic needs this, as soon as we enable extensions
|
||||
* we'll switch booted to on.
|
||||
*/
|
||||
public function isEnabled($extension)
|
||||
public function isEnabled($extension): bool
|
||||
{
|
||||
if (! $this->booted) {
|
||||
return false;
|
||||
@@ -91,7 +89,7 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
/**
|
||||
* In test cases, enabled extensions are determined by the test case, not the database.
|
||||
*/
|
||||
public function getEnabled()
|
||||
public function getEnabled(): array
|
||||
{
|
||||
return $this->enabledIds;
|
||||
}
|
||||
@@ -99,7 +97,7 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
/**
|
||||
* Enabled extensions must be specified by the test case, so this should do nothing.
|
||||
*/
|
||||
protected function setEnabledExtensions(array $enabledExtensions)
|
||||
protected function setEnabledExtensions(array $enabledExtensions): void
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user