Skip to content

Commit

Permalink
Merge pull request #101 from wunderio/hotfix/99-fix-php_stan-error-wi…
Browse files Browse the repository at this point in the history
…th-DrupalAutoloader

#99 Fix PHP Stan error with DrupalAutoloader.
  • Loading branch information
hkirsman authored May 21, 2024
2 parents 9c84619 + c7a9908 commit 05aeaca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "*",
"mglaman/phpstan-drupal": "^1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0"
"phpstan/phpstan-deprecation-rules": "^1.0",
"webflo/drupal-finder": "^1.3"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 2 additions & 3 deletions src/Drupal/DrupalAutoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Wunderio\GrumPHP\Drupal;

use Drupal\Core\DependencyInjection\ContainerNotInitializedException;
use DrupalFinder\DrupalFinder;
use DrupalFinder\DrupalFinderComposerRuntime;
use Drush\Drush;
use mglaman\PHPStanDrupal\Drupal\Extension;
use mglaman\PHPStanDrupal\Drupal\ExtensionDiscovery;
Expand Down Expand Up @@ -90,8 +90,7 @@ class DrupalAutoloader {
* Path to Drupal root.
*/
public function register(string $drupalRoot): void {
$finder = new DrupalFinder();
$finder->locateRoot($drupalRoot);
$finder = new DrupalFinderComposerRuntime();

$drupalRoot = $finder->getDrupalRoot();
$drupalVendorRoot = $finder->getVendorDir();
Expand Down
8 changes: 8 additions & 0 deletions src/Task/Psalm/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
Wunderio\GrumPHP\Task\Psalm\PsalmTask:
class: Wunderio\GrumPHP\Task\Psalm\PsalmTask
arguments:
- '@process_builder'
- '@formatter.raw_process'
tags:
- {name: grumphp.task, task: psalm}

0 comments on commit 05aeaca

Please sign in to comment.