Skip to content

Commit d3667df

Browse files
Add back NotFoundException for BC (#69)
* Add back NotFoundException for BC * Applied fixes from StyleCI (#70) * Remove error trigger * Change typehints to new exception * Update changelog * Add final notice
1 parent 57eb7e4 commit d3667df

14 files changed

+35
-17
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33

44
## UNRELEASED
55

6+
### Added
7+
8+
- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version
9+
610
### Changed
711

812
- Puli strategy renamed to Puli Beta strategy to prevent incompatibility with a future Puli stable
913

14+
### Deprecated
15+
16+
- For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0
17+
1018

1119
## 0.9.1 - 2016-06-28
1220

spec/ClassDiscoverySpec.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Http\Discovery\ClassDiscovery;
66
use Http\Discovery\Exception\DiscoveryFailedException;
7-
use Http\Discovery\Exception\NotFoundException;
87
use Http\Discovery\Strategy\DiscoveryStrategy;
98
use Puli\Discovery\Binding\ClassBinding;
109
use Puli\GeneratedPuliFactory;

spec/HttpAsyncClientDiscoverySpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Http\Client\HttpAsyncClient;
66
use Http\Discovery\ClassDiscovery;
7-
use Http\Discovery\Exception\NotFoundException;
7+
use Http\Discovery\NotFoundException;
88
use Http\Discovery\Strategy\DiscoveryStrategy;
99
use Prophecy\Argument;
1010
use Puli\GeneratedPuliFactory;

spec/HttpClientDiscoverySpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Http\Client\HttpClient;
66
use Http\Discovery\ClassDiscovery;
7-
use Http\Discovery\Exception\NotFoundException;
7+
use Http\Discovery\NotFoundException;
88
use Http\Discovery\Strategy\DiscoveryStrategy;
99
use Puli\GeneratedPuliFactory;
1010
use Puli\Discovery\Api\Discovery;

spec/MessageFactoryDiscoverySpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace spec\Http\Discovery;
44

55
use Http\Discovery\ClassDiscovery;
6-
use Http\Discovery\Exception\NotFoundException;
6+
use Http\Discovery\NotFoundException;
77
use Http\Discovery\Strategy\DiscoveryStrategy;
88
use Http\Message\MessageFactory;
99
use Puli\GeneratedPuliFactory;

spec/StreamFactoryDiscoverySpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace spec\Http\Discovery;
44

55
use Http\Discovery\ClassDiscovery;
6-
use Http\Discovery\Exception\NotFoundException;
6+
use Http\Discovery\NotFoundException;
77
use Http\Discovery\Strategy\DiscoveryStrategy;
88
use Http\Message\StreamFactory;
99
use Puli\GeneratedPuliFactory;

spec/UriFactoryDiscoverySpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace spec\Http\Discovery;
44

55
use Http\Discovery\ClassDiscovery;
6-
use Http\Discovery\Exception\NotFoundException;
6+
use Http\Discovery\NotFoundException;
77
use Http\Discovery\Strategy\DiscoveryStrategy;
88
use Http\Message\UriFactory;
99
use Puli\GeneratedPuliFactory;

src/Exception/NotFoundException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
/**
66
* Thrown when a discovery does not find any matches.
77
*
8+
* @final do NOT extend this class, not final for BC reasons
9+
*
810
* @author Márk Sági-Kazár <[email protected]>
911
*/
10-
final class NotFoundException extends \RuntimeException
12+
/*final */class NotFoundException extends \RuntimeException
1113
{
1214
}

src/HttpAsyncClientDiscovery.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Http\Client\HttpAsyncClient;
66
use Http\Discovery\Exception\DiscoveryFailedException;
7-
use Http\Discovery\Exception\NotFoundException;
87

98
/**
109
* Finds an HTTP Asynchronous Client.
@@ -18,7 +17,7 @@ final class HttpAsyncClientDiscovery extends ClassDiscovery
1817
*
1918
* @return HttpAsyncClient
2019
*
21-
* @throws NotFoundException
20+
* @throws Exception\NotFoundException
2221
*/
2322
public static function find()
2423
{

src/HttpClientDiscovery.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Http\Client\HttpClient;
66
use Http\Discovery\Exception\DiscoveryFailedException;
7-
use Http\Discovery\Exception\NotFoundException;
87

98
/**
109
* Finds an HTTP Client.
@@ -18,7 +17,7 @@ final class HttpClientDiscovery extends ClassDiscovery
1817
*
1918
* @return HttpClient
2019
*
21-
* @throws NotFoundException
20+
* @throws Exception\NotFoundException
2221
*/
2322
public static function find()
2423
{

src/MessageFactoryDiscovery.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Http\Discovery;
44

55
use Http\Discovery\Exception\DiscoveryFailedException;
6-
use Http\Discovery\Exception\NotFoundException;
76
use Http\Message\MessageFactory;
87

98
/**
@@ -18,7 +17,7 @@ final class MessageFactoryDiscovery extends ClassDiscovery
1817
*
1918
* @return MessageFactory
2019
*
21-
* @throws NotFoundException
20+
* @throws Exception\NotFoundException
2221
*/
2322
public static function find()
2423
{

src/NotFoundException.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Http\Discovery;
4+
5+
/**
6+
* Thrown when a discovery does not find any matches.
7+
*
8+
* @author Márk Sági-Kazár <[email protected]>
9+
*
10+
* @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.
11+
*/
12+
final class NotFoundException extends \Http\Discovery\Exception\NotFoundException
13+
{
14+
}

src/StreamFactoryDiscovery.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Http\Discovery;
44

55
use Http\Discovery\Exception\DiscoveryFailedException;
6-
use Http\Discovery\Exception\NotFoundException;
76
use Http\Message\StreamFactory;
87

98
/**
@@ -18,7 +17,7 @@ final class StreamFactoryDiscovery extends ClassDiscovery
1817
*
1918
* @return StreamFactory
2019
*
21-
* @throws NotFoundException
20+
* @throws Exception\NotFoundException
2221
*/
2322
public static function find()
2423
{

src/UriFactoryDiscovery.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Http\Discovery;
44

55
use Http\Discovery\Exception\DiscoveryFailedException;
6-
use Http\Discovery\Exception\NotFoundException;
76
use Http\Message\UriFactory;
87

98
/**
@@ -18,7 +17,7 @@ final class UriFactoryDiscovery extends ClassDiscovery
1817
*
1918
* @return UriFactory
2019
*
21-
* @throws NotFoundException
20+
* @throws Exception\NotFoundException
2221
*/
2322
public static function find()
2423
{

0 commit comments

Comments
 (0)