diff --git a/composer.json b/composer.json
index ceb3887b689142ef9f3600f6f86da987f03ee955..17fc0492a24afe55132cd0ab34635717cc89059d 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,7 @@
         "colinodell/psr-testlogger": "^1.2",
         "drupal/automatic_updates": "^3.1.3",
         "drush/drush": "^12.5 || ^13",
-        "mglaman/phpstan-drupal": "<1.3.4, <2.0.2"
+        "mglaman/phpstan-drupal": "^1.3.7 || ^2.0.5"
     },
     "conflict": {
         "drupal/automatic_updates": "<3.0",
diff --git a/phpstan-baseline-phpstan2-only.neon b/phpstan-baseline-phpstan2-only.neon
new file mode 100644
index 0000000000000000000000000000000000000000..55cb7f8c01a33ae494a6e03de4977263563948d5
--- /dev/null
+++ b/phpstan-baseline-phpstan2-only.neon
@@ -0,0 +1,18 @@
+parameters:
+  ignoreErrors:
+    -
+      message: '#^Call to static method Drupal\\Component\\Assertion\\Inspector\:\:assertAllObjects\(\) with array\<Drupal\\project_browser\\ProjectBrowser\\Project\> and ''Drupal\\\\project_browser\\\\ProjectBrowser\\\\Project'' will always evaluate to true\.$#'
+      identifier: staticMethod.alreadyNarrowedType
+      count: 1
+      path: src/Plugin/ProjectBrowserSource/SortHelper.php
+    -
+      message: '#^Call to static method Drupal\\Component\\Assertion\\Inspector\:\:assertAllStrings\(\) with array\<string\> will always evaluate to true\.$#'
+      identifier: staticMethod.alreadyNarrowedType
+      count: 1
+      path: src/Plugin/ProjectBrowserSource/SortHelper.php
+
+    -
+      message: '#^Call to static method Drupal\\Component\\Assertion\\Inspector\:\:assertAllObjects\(\) with list\<Drupal\\project_browser\\ProjectBrowser\\Project\> and ''Drupal\\\\project_browser\\\\ProjectBrowser\\\\Project'' will always evaluate to true\.$#'
+      identifier: staticMethod.alreadyNarrowedType
+      count: 1
+      path: src/ProjectBrowser/ProjectsResultsPage.php
diff --git a/phpstan-drupal-core-bc-layer.neon.php b/phpstan-drupal-core-bc-layer.neon.php
index 60d396acd0a0bff250d4f38b4ef96b078cb4e311..93b26d1b92ed92b9d1a9d4df4368d50c8e8e9dc1 100644
--- a/phpstan-drupal-core-bc-layer.neon.php
+++ b/phpstan-drupal-core-bc-layer.neon.php
@@ -11,9 +11,11 @@ use Composer\InstalledVersions;
 use Composer\Semver\VersionParser;
 use Drupal\Core\Recipe\Recipe;
 
+$is_phpstan2 = InstalledVersions::satisfies(new VersionParser(), 'phpstan/phpstan', '^2');
+
 $includes = [];
 if (method_exists(Recipe::class, 'getExtra')) {
-  if (InstalledVersions::satisfies(new VersionParser(), 'phpstan/phpstan', '^2')) {
+  if ($is_phpstan2) {
     $includes[] = 'phpstan-baseline-getExtras.neon';
   }
 }
@@ -21,6 +23,10 @@ else {
   $includes[] = 'phpstan-baseline-no-getExtras.neon';
 }
 
+if ($is_phpstan2) {
+  $includes[] = 'phpstan-baseline-phpstan2-only.neon';
+}
+
 $config = [];
 $config['includes'] = $includes;
 return $config;
diff --git a/src/Plugin/ProjectBrowserSource/SortHelper.php b/src/Plugin/ProjectBrowserSource/SortHelper.php
index 7d3ffb696c21db0d00d3d1b903947b43527fdae9..c8be0eaec70c2db47b300a5a98f78d1058ac8005 100644
--- a/src/Plugin/ProjectBrowserSource/SortHelper.php
+++ b/src/Plugin/ProjectBrowserSource/SortHelper.php
@@ -48,12 +48,12 @@ final class SortHelper {
       }
       // If the first project is in the configured order but the second isn't,
       // the first one goes before the second one.
-      elseif (is_int($a_position) && $b_position === FALSE) {
+      elseif (is_int($a_position)) {
         return -1;
       }
       // If the first project isn't in the configured order but the second one
       // is, the second one goes before the first one.
-      elseif ($a_position === FALSE && is_int($b_position)) {
+      elseif (is_int($b_position)) {
         return 1;
       }
       // If neither project is in the configured order, leave them as-is.