dev-master
9999999-devStern lets you built type-safe PHP projects, even if your project's users aren't writing type-safe code
MIT
The Requires
- php ^7
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Stern lets you built type-safe PHP projects, even if your project's users aren't writing type-safe code
Stern lets you built type-safe PHP projects, even if your project's users aren't writing type-safe code., (*2)
Requires PHP 7+, (*3)
Using Stern is simply:, (*4)
SternTrait.whateverName to strictWhateverName. <?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., (*5)
<?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
{
}
}
Stern lets you built type-safe PHP projects, even if your project's users aren't writing type-safe code
MIT