Skip to content

Add back NotFoundException for BC #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@

## UNRELEASED

### Added

- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version

### Changed

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

### Deprecated

- For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0


## 0.9.1 - 2016-06-28

Expand Down
1 change: 0 additions & 1 deletion spec/ClassDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Puli\Discovery\Binding\ClassBinding;
use Puli\GeneratedPuliFactory;
Expand Down
2 changes: 1 addition & 1 deletion spec/HttpAsyncClientDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Http\Client\HttpAsyncClient;
use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Prophecy\Argument;
use Puli\GeneratedPuliFactory;
Expand Down
2 changes: 1 addition & 1 deletion spec/HttpClientDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Http\Client\HttpClient;
use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Puli\GeneratedPuliFactory;
use Puli\Discovery\Api\Discovery;
Expand Down
2 changes: 1 addition & 1 deletion spec/MessageFactoryDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace spec\Http\Discovery;

use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Http\Message\MessageFactory;
use Puli\GeneratedPuliFactory;
Expand Down
2 changes: 1 addition & 1 deletion spec/StreamFactoryDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace spec\Http\Discovery;

use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Http\Message\StreamFactory;
use Puli\GeneratedPuliFactory;
Expand Down
2 changes: 1 addition & 1 deletion spec/UriFactoryDiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace spec\Http\Discovery;

use Http\Discovery\ClassDiscovery;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\NotFoundException;
use Http\Discovery\Strategy\DiscoveryStrategy;
use Http\Message\UriFactory;
use Puli\GeneratedPuliFactory;
Expand Down
4 changes: 3 additions & 1 deletion src/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
/**
* Thrown when a discovery does not find any matches.
*
* @final do NOT extend this class, not final for BC reasons
*
* @author Márk Sági-Kazár <[email protected]>
*/
final class NotFoundException extends \RuntimeException
/*final */class NotFoundException extends \RuntimeException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add "(do not extend this class, it is only not final for BC reasons)"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what the @final phpdoc is for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what the @final phpdoc is for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, makes sense. maybe add that comment after the @final then?i think explanations always are a good thing.

Copy link
Member Author

@sagikazarmark sagikazarmark Jul 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{
}
3 changes: 1 addition & 2 deletions src/HttpAsyncClientDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Http\Client\HttpAsyncClient;
use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;

/**
* Finds an HTTP Asynchronous Client.
Expand All @@ -18,7 +17,7 @@ final class HttpAsyncClientDiscovery extends ClassDiscovery
*
* @return HttpAsyncClient
*
* @throws NotFoundException
* @throws Exception\NotFoundException
*/
public static function find()
{
Expand Down
3 changes: 1 addition & 2 deletions src/HttpClientDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Http\Client\HttpClient;
use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;

/**
* Finds an HTTP Client.
Expand All @@ -18,7 +17,7 @@ final class HttpClientDiscovery extends ClassDiscovery
*
* @return HttpClient
*
* @throws NotFoundException
* @throws Exception\NotFoundException
*/
public static function find()
{
Expand Down
3 changes: 1 addition & 2 deletions src/MessageFactoryDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Http\Discovery;

use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;
use Http\Message\MessageFactory;

/**
Expand All @@ -18,7 +17,7 @@ final class MessageFactoryDiscovery extends ClassDiscovery
*
* @return MessageFactory
*
* @throws NotFoundException
* @throws Exception\NotFoundException
*/
public static function find()
{
Expand Down
14 changes: 14 additions & 0 deletions src/NotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Http\Discovery;

/**
* Thrown when a discovery does not find any matches.
*
* @author Márk Sági-Kazár <[email protected]>
*
* @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.
*/
final class NotFoundException extends \Http\Discovery\Exception\NotFoundException
{
}
3 changes: 1 addition & 2 deletions src/StreamFactoryDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Http\Discovery;

use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;
use Http\Message\StreamFactory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. should we have the phpdoc say it throws the new exception? people should start relying on the new exception, not the deprecated one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


/**
Expand All @@ -18,7 +17,7 @@ final class StreamFactoryDiscovery extends ClassDiscovery
*
* @return StreamFactory
*
* @throws NotFoundException
* @throws Exception\NotFoundException
*/
public static function find()
{
Expand Down
3 changes: 1 addition & 2 deletions src/UriFactoryDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Http\Discovery;

use Http\Discovery\Exception\DiscoveryFailedException;
use Http\Discovery\Exception\NotFoundException;
use Http\Message\UriFactory;

/**
Expand All @@ -18,7 +17,7 @@ final class UriFactoryDiscovery extends ClassDiscovery
*
* @return UriFactory
*
* @throws NotFoundException
* @throws Exception\NotFoundException
*/
public static function find()
{
Expand Down