Skip to content

Commit

Permalink
Add custom Psalm stub to get tap helper generics
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 17, 2024
1 parent b79b7a3 commit 9c38f07
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions monorepo/stubs/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* @template T
* @param T $value
* @param callable(?T): mixed $callback
* @return T
*/
function tap($value, $callback = null) {}

class HigherOrderTapProxy
{
/**
* @template T
* @param T $target
*/
public function __construct($target) {}

/**
* @template T
* @param T $target
* @param string $method
* @param array $parameters
* @return T
*/
public function __call($method, $parameters) {}
}
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
<stubs>
<file name="monorepo/stubs/helpers.php" />
<file name="monorepo/stubs/Application.php" />
</stubs>
</psalm>

0 comments on commit 9c38f07

Please sign in to comment.