Add PHPStan with strict rules
This commit is contained in:
parent
6730748032
commit
a53e3303a0
|
@ -35,6 +35,8 @@
|
||||||
"php": "^8.0"
|
"php": "^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^1.10",
|
||||||
|
"phpstan/phpstan-strict-rules": "^1.5",
|
||||||
"friendsofphp/php-cs-fixer": "^3.0"
|
"friendsofphp/php-cs-fixer": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# Configuration for PHPStan.
|
||||||
|
# @see https://phpstan.org/config-reference
|
||||||
|
#
|
||||||
|
|
||||||
|
includes:
|
||||||
|
- vendor/phpstan/phpstan-strict-rules/rules.neon
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
level: 2
|
||||||
|
strictRules:
|
||||||
|
noVariableVariables: false
|
||||||
|
paths:
|
||||||
|
- src
|
|
@ -31,11 +31,6 @@ use OCC\Basics\Traits\Getter;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \ArrayAccess
|
|
||||||
* @implements \Countable
|
|
||||||
* @implements \Iterator
|
|
||||||
* @implements \Serializable
|
|
||||||
*/
|
*/
|
||||||
class StrictList extends SplDoublyLinkedList
|
class StrictList extends SplDoublyLinkedList
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,11 +29,6 @@ use RuntimeException;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \ArrayAccess
|
|
||||||
* @implements \Countable
|
|
||||||
* @implements \Iterator
|
|
||||||
* @implements \Serializable
|
|
||||||
*/
|
*/
|
||||||
class StrictQueue extends StrictList
|
class StrictQueue extends StrictList
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,11 +29,6 @@ use RuntimeException;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \ArrayAccess
|
|
||||||
* @implements \Countable
|
|
||||||
* @implements \Iterator
|
|
||||||
* @implements \Serializable
|
|
||||||
*/
|
*/
|
||||||
class StrictStack extends StrictList
|
class StrictStack extends StrictList
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ use ErrorException;
|
||||||
*/
|
*/
|
||||||
function throwErrorException(int $severity = E_USER_ERROR, string $message = '', ?string $file = null, ?int $line = null): bool
|
function throwErrorException(int $severity = E_USER_ERROR, string $message = '', ?string $file = null, ?int $line = null): bool
|
||||||
{
|
{
|
||||||
if (error_reporting() & $severity) {
|
if ((error_reporting() & $severity) > 0) {
|
||||||
throw new ErrorException($message, 0, $severity, $file, $line);
|
throw new ErrorException($message, 0, $severity, $file, $line);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \ArrayAccess
|
|
||||||
*/
|
*/
|
||||||
trait ArrayAccess /* implements \ArrayAccess */
|
trait ArrayAccess /* implements \ArrayAccess */
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \Countable
|
|
||||||
*/
|
*/
|
||||||
trait Countable /* implements \Countable */
|
trait Countable /* implements \Countable */
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,8 +27,6 @@ namespace OCC\Basics\InterfaceTraits;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \Iterator
|
|
||||||
*/
|
*/
|
||||||
trait Iterator /* implements \Iterator */
|
trait Iterator /* implements \Iterator */
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,6 @@ use ArrayIterator;
|
||||||
*
|
*
|
||||||
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
* @author Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
|
||||||
* @package opencultureconsulting/basics
|
* @package opencultureconsulting/basics
|
||||||
*
|
|
||||||
* @implements \IteratorAggregate
|
|
||||||
*/
|
*/
|
||||||
trait IteratorAggregate /* implements \IteratorAggregate */
|
trait IteratorAggregate /* implements \IteratorAggregate */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue