Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 37 | All time: 10,956 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
{
}
}
Files (10) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file) | ||||
tests (1 file, 2 directories) | ||||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
psalm.xml | Data | Auxiliary data | ||
README.md | Doc. | Read me |
Files (10) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
phpunit (1 file) | ||||
test-classes (1 file) | ||||
autoload.php | 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. |
Install with Composer |
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.