Skip to content

Commit bbd6772

Browse files
Add return types to tests and final|internal|private methods
1 parent 58f16a1 commit bbd6772

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Ldap.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Component\Ldap;
1313

1414
use Symfony\Component\Ldap\Adapter\AdapterInterface;
15+
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
16+
use Symfony\Component\Ldap\Adapter\QueryInterface;
1517
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
1618

1719
/**
@@ -41,23 +43,23 @@ public function bind($dn = null, $password = null)
4143
/**
4244
* {@inheritdoc}
4345
*/
44-
public function query($dn, $query, array $options = [])
46+
public function query($dn, $query, array $options = []): QueryInterface
4547
{
4648
return $this->adapter->createQuery($dn, $query, $options);
4749
}
4850

4951
/**
5052
* {@inheritdoc}
5153
*/
52-
public function getEntryManager()
54+
public function getEntryManager(): EntryManagerInterface
5355
{
5456
return $this->adapter->getEntryManager();
5557
}
5658

5759
/**
5860
* {@inheritdoc}
5961
*/
60-
public function escape($subject, $ignore = '', $flags = 0)
62+
public function escape($subject, $ignore = '', $flags = 0): string
6163
{
6264
return $this->adapter->escape($subject, $ignore, $flags);
6365
}

Tests/LdapTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Component\Ldap\Adapter\AdapterInterface;
1717
use Symfony\Component\Ldap\Adapter\ConnectionInterface;
18+
use Symfony\Component\Ldap\Adapter\QueryInterface;
1819
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
1920
use Symfony\Component\Ldap\Ldap;
2021

@@ -54,6 +55,7 @@ public function testLdapEscape()
5455
->expects($this->once())
5556
->method('escape')
5657
->with('foo', 'bar', 'baz')
58+
->willReturn('');
5759
;
5860
$this->ldap->escape('foo', 'bar', 'baz');
5961
}
@@ -64,6 +66,7 @@ public function testLdapQuery()
6466
->expects($this->once())
6567
->method('createQuery')
6668
->with('foo', 'bar', ['baz'])
69+
->willReturn($this->createMock(QueryInterface::class))
6770
;
6871
$this->ldap->query('foo', 'bar', ['baz']);
6972
}

0 commit comments

Comments
 (0)