folded-php / exception Goto Github PK
View Code? Open in Web Editor NEWVarious kind of exception to throw for your web app.
Home Page: https://packagist.org/packages/folded/exception
License: MIT License
Various kind of exception to throw for your web app.
Home Page: https://packagist.org/packages/folded/exception
License: MIT License
When throwing a MethodNotAllowedException
, it would be useful to be able to specify the URL that is not allowed for debug purposes.
To be able to mention the URL like following:
use Folded\Exceptions\MethodNotAllowedException;
$exception = new MethodNotAllowedException();
$exception->setUrl("/")->setMethodNotAllowed("POST")->setAllowedMethods(["GET"]);
echo $exception->getUrl(); // string(1) "/"
Alternatives solutions
None.
Static analysis helps catching bugs earlier.
pest --coverage && phpstan analyse src
phpstan.neon
configuration fileNone.
None.
When the code loads functions, it should detect the existance of the function under the namespace instead of just the name of the function
The call of function_exists()
use the full qualified namespace.
namespace Folded;
if (!function_exists("Folded\theFunction")) {
// load the function now
}
Functions declared twice enters in collision.
None.
When a user tries to get a session by its key, and this key is not set, I should raise an meaningful error.
To be able to set the key in the error as following:
use Folded\Exceptions\SessionKeyNotFoundException;
$exception = SessionKeyNotFoundException("key foo not found");
$exception->setKey("foo");
echo $exception->getKey(); // "foo"
No exception to raise in this case.
Raising an OutOfRangeException
for now.
There is no templates for bugs and enhancements, which can reduce the chances someone will want to describe his issue or can make difficult to format and clarify an issue without proper templates.
For an enhancements, the following sections (using level 2 title, ##
) should be shown:
The text hints, using italic, should be shown below each of these titles (without the double quotes):
For a bug, the following sections (using level 2 title, ##
) should be shown:
The text hints, using italic, should be show below each of these titles (without the double quotes):
To write by hand the issue layout.
In the context of a router, the user can add a name to a route, and redirect the end user using a route name.
If this name is not found, I would like to raise a meaningful related exception.
To be able to use RouteNotFoundException
as following:
use Folded\Exceptions\RouteNotFoundException;
try {
throw (new RouteNotFoundException("route foo not found"))->setRoute("foo");
} catch (RouteNotFoundException $exception) {
echo "route {$exception->getRoute()} not found";
}
No exception related to route not found usable.
I am using OutOfRangeException
for the moment.
To comply with static analysis, exceptions should implement Throwable.
All the exceptions implement Throwable interface.
None.
None.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.