Skip to content
Snippets Groups Projects
Commit fc1d825d authored by Tim Plunkett's avatar Tim Plunkett
Browse files

Move to level 5

parent 8fa2d0ce
No related branches found
No related tags found
1 merge request!678Resolve #3501590 "Increase phpstan level"
...@@ -168,7 +168,7 @@ final class RandomDataPlugin extends ProjectBrowserSourceBase { ...@@ -168,7 +168,7 @@ final class RandomDataPlugin extends ProjectBrowserSourceBase {
// Filter by categories. // Filter by categories.
if (!empty($query['categories'])) { if (!empty($query['categories'])) {
$projects = array_filter($projects, fn(Project $project) => array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))); $projects = array_filter($projects, fn(Project $project) => empty(array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))));
} }
// Filter by search text. // Filter by search text.
...@@ -199,14 +199,14 @@ final class RandomDataPlugin extends ProjectBrowserSourceBase { ...@@ -199,14 +199,14 @@ final class RandomDataPlugin extends ProjectBrowserSourceBase {
if ($i !== 0) { if ($i !== 0) {
$project_images[] = [ $project_images[] = [
'file' => [ 'file' => [
'uri' => str_replace(4, 5, $good_image), 'uri' => str_replace('4', '5', $good_image),
'resource' => 'image', 'resource' => 'image',
], ],
'alt' => $machine_name . ' something', 'alt' => $machine_name . ' something',
]; ];
$project_images[] = [ $project_images[] = [
'file' => [ 'file' => [
'uri' => str_replace(4, 6, $good_image), 'uri' => str_replace('4', '6', $good_image),
'resource' => 'image', 'resource' => 'image',
], ],
'alt' => $machine_name . ' another thing', 'alt' => $machine_name . ' another thing',
......
parameters: parameters:
level: 4 level: 5
universalObjectCratesClasses: universalObjectCratesClasses:
- Drupal\Core\Extension\Extension - Drupal\Core\Extension\Extension
reportUnmatchedIgnoredErrors: true reportUnmatchedIgnoredErrors: true
......
...@@ -133,7 +133,7 @@ final class InstallerController extends ControllerBase { ...@@ -133,7 +133,7 @@ final class InstallerController extends ControllerBase {
/** /**
* Provides a JSON response for a given error. * Provides a JSON response for a given error.
* *
* @param \Exception $e * @param \Throwable $e
* The error that occurred. * The error that occurred.
* @param string $phase * @param string $phase
* The phase the error occurred in. * The phase the error occurred in.
...@@ -141,7 +141,7 @@ final class InstallerController extends ControllerBase { ...@@ -141,7 +141,7 @@ final class InstallerController extends ControllerBase {
* @return \Symfony\Component\HttpFoundation\JsonResponse * @return \Symfony\Component\HttpFoundation\JsonResponse
* Provides an error message to be displayed by the Project Browser UI. * Provides an error message to be displayed by the Project Browser UI.
*/ */
private function errorResponse(\Exception $e, string $phase = ''): JsonResponse { private function errorResponse(\Throwable $e, string $phase = ''): JsonResponse {
$exception_type_short = (new \ReflectionClass($e))->getShortName(); $exception_type_short = (new \ReflectionClass($e))->getShortName();
$exception_message = $e->getMessage(); $exception_message = $e->getMessage();
$response_body = ['message' => "$exception_type_short: $exception_message"]; $response_body = ['message' => "$exception_type_short: $exception_message"];
...@@ -215,7 +215,7 @@ final class InstallerController extends ControllerBase { ...@@ -215,7 +215,7 @@ final class InstallerController extends ControllerBase {
// accessed after. This final check ensures a destroy is not attempted // accessed after. This final check ensures a destroy is not attempted
// during apply. // during apply.
if ($this->installer->isApplying()) { if ($this->installer->isApplying()) {
throw new StageException('Another project is being added. Try again in a few minutes.'); throw new StageException($this->installer, 'Another project is being added. Try again in a few minutes.');
} }
// Adding the TRUE parameter to destroy is dangerous, but we provide it // Adding the TRUE parameter to destroy is dangerous, but we provide it
......
...@@ -133,7 +133,7 @@ final class DrupalCore extends ProjectBrowserSourceBase { ...@@ -133,7 +133,7 @@ final class DrupalCore extends ProjectBrowserSourceBase {
// Filter by categories. // Filter by categories.
if (!empty($query['categories'])) { if (!empty($query['categories'])) {
$projects = array_filter($projects, fn(Project $project) => array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))); $projects = array_filter($projects, fn(Project $project) => empty(array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))));
} }
// Filter by search text. // Filter by search text.
......
...@@ -135,7 +135,7 @@ final class Recipes extends ProjectBrowserSourceBase { ...@@ -135,7 +135,7 @@ final class Recipes extends ProjectBrowserSourceBase {
// Filter by categories. // Filter by categories.
if (!empty($query['categories'])) { if (!empty($query['categories'])) {
$projects = array_filter($projects, fn(Project $project) => array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))); $projects = array_filter($projects, fn(Project $project) => empty(array_intersect(array_column($project->categories, 'id'), explode(',', $query['categories']))));
} }
// Filter by search text. // Filter by search text.
......
...@@ -58,7 +58,7 @@ class InstallTest extends BrowserTestBase { ...@@ -58,7 +58,7 @@ class InstallTest extends BrowserTestBase {
// @todo Convert this to pageTextContains(), and only look for `installed`, // @todo Convert this to pageTextContains(), and only look for `installed`,
// once Drupal 10 support is dropped. // once Drupal 10 support is dropped.
$this->assertSession()->pageTextMatches('/Module Project Browser has been (installed|enabled)\./'); $this->assertSession()->pageTextMatches('/Module Project Browser has been (installed|enabled)\./');
$this->assertSession()->statusCodeEquals('200'); $this->assertSession()->statusCodeEquals(200);
$this->reloadServices(); $this->reloadServices();
$this->assertTrue($this->moduleHandler->moduleExists('project_browser')); $this->assertTrue($this->moduleHandler->moduleExists('project_browser'));
$this->assertFalse($this->moduleHandler->moduleExists('package_manager')); $this->assertFalse($this->moduleHandler->moduleExists('package_manager'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment