Skip to content

Commit 34902e1

Browse files
🐛 Fix stub
1 parent d16f099 commit 34902e1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

TwigCS/src/Environment/StubbedEnvironment.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
class StubbedEnvironment extends Environment
2323
{
2424
/**
25-
* @var TwigFilter[]
25+
* @var array<TwigFilter|null>
2626
*/
2727
protected $stubFilters = [];
2828

2929
/**
30-
* @var TwigFunction[]
30+
* @var array<TwigFunction|null>
3131
*/
3232
protected $stubFunctions = [];
3333

3434
/**
35-
* @var TwigTest[]
35+
* @var array<TwigTest|null>
3636
*/
3737
protected $stubTests = [
38-
'divisible' => false, // Allow 'divisible by'
39-
'same' => false, // Allow 'same as'
38+
'divisible' => null, // Allow 'divisible by'
39+
'same' => null, // Allow 'same as'
4040
];
4141

4242
public function __construct()
@@ -57,11 +57,11 @@ public function __construct()
5757
/**
5858
* @param string $name
5959
*
60-
* @return TwigFilter
60+
* @return TwigFilter|null
6161
*/
6262
public function getFilter($name): ?TwigFilter
6363
{
64-
if (!isset($this->stubFilters[$name])) {
64+
if (!array_key_exists($name, $this->stubFilters)) {
6565
$this->stubFilters[$name] = new TwigFilter('stub');
6666
}
6767

@@ -71,11 +71,11 @@ public function getFilter($name): ?TwigFilter
7171
/**
7272
* @param string $name
7373
*
74-
* @return TwigFunction
74+
* @return TwigFunction|null
7575
*/
7676
public function getFunction($name): ?TwigFunction
7777
{
78-
if (!isset($this->stubFunctions[$name])) {
78+
if (!array_key_exists($name, $this->stubFunctions)) {
7979
$this->stubFunctions[$name] = new TwigFunction('stub');
8080
}
8181

@@ -85,11 +85,11 @@ public function getFunction($name): ?TwigFunction
8585
/**
8686
* @param string $name
8787
*
88-
* @return TwigTest
88+
* @return TwigTest|null
8989
*/
9090
public function getTest($name): ?TwigTest
9191
{
92-
if (!isset($this->stubTests[$name])) {
92+
if (!array_key_exists($name, $this->stubTests)) {
9393
$this->stubTests[$name] = new TwigTest('stub');
9494
}
9595

0 commit comments

Comments
 (0)