Skip to content

Commit 6513cdb

Browse files
committed
Support single-line @memoize annotation
1 parent 69fccac commit 6513cdb

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Memoize/MemoizeMethodProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function matchMethods(ReflectionMethodCollection $methods): array
1818
return $methods
1919
->filterConcrete()
2020
->filter(function (ReflectionMethod $reflectionMethod) {
21-
return preg_match('{\*\s*\@Memoize\s*$}m', $reflectionMethod->getDocComment()) > 0;
21+
return preg_match('{\*\s+\@Memoize\s}m', $reflectionMethod->getDocComment()) > 0;
2222
})
2323
->filter(function (ReflectionMethod $reflectionMethod) {
2424
return $reflectionMethod->getNumberOfParameters() === 0;

tests/Console/Build/templates/Address.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public abstract function foo();
3131

3232
private $n = 0;
3333

34-
/**
35-
* @Memoize
36-
*/
34+
/** @Memoize */
3735
public function n(): int
3836
{
3937
return $this->n++;

0 commit comments

Comments
 (0)