| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 37 | All time: 10,991 This week: 660 | ||||
| Version | License | PHP version | Categories | |||
| stern 1.0 | MIT/X Consortium ... | 5 | Language, PHP 7 |
Stern lets you built type-safe PHP projects, even if your project's users aren't writing type-safe code.
Requires PHP 7+
Using Stern is simply:
<?php
declare(strict_types=1);
namespace YourVendor\YourNamespace;
class YourClassThatUsesStrictTypes
{
+ use \ParagonIE\Stern\SternTrait;
/.../
- public function foo(string $param = ''): bool
+ public function strictFoo(string $param = ''): bool
{
}
}
For better usability (especially with type-aware IDEs like PHPStorm), make sure
you use @method
docblocks.
<?php
declare(strict_types=1);
namespace YourVendor\YourNamespace;
+ /
+ * @method bool foo(string $param = '')
+ */
class YourClassThatUsesStrictTypes
{
+ use \ParagonIE\Stern\SternTrait;
/.../
- public function foo(string $param = ''): bool
+ public function strictFoo(string $param = ''): bool
{
}
}
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Doc. | Read me | |||
| / | tests |
| File | Role | Description | ||
|---|---|---|---|---|
| |
Aux. | Auxiliary script | ||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.