-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from natenolting/master
Psalm
- Loading branch information
Showing
37 changed files
with
744 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ Gemfile.lock | |
*.phar | ||
/phan.log | ||
phpstan.phar | ||
psalm | ||
psalm.log.* | ||
psalm.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Install and run Psalm php static analysis tool | ||
# https://getpsalm.org/docs/ | ||
PSALM_DIR=psalm | ||
mkdir ./$PSALM_DIR || : | ||
cd ./$PSALM_DIR; | ||
if [ ! -f composer.json ]; then composer init --no-interaction; fi; | ||
(composer info -N | grep -q "vimeo/psalm") && : || composer require vimeo/psalm --dev --no-suggest --no-ansi --no-interaction --no-progress --ignore-platform-reqs | ||
cd .. | ||
|
||
# Initialize Psalm if xml file does not exist | ||
if [ ! -f ./psalm.xml ]; then ./$PSALM_DIR/vendor/bin/psalm init; fi; | ||
./$PSALM_DIR/vendor/bin/psalm | ||
|
||
#fin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
totallyTyped="false" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config file://./psalm/vendor/vimeo/psalm/config.xsd" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
|
||
<issueHandlers> | ||
<LessSpecificReturnType errorLevel="info" /> | ||
|
||
<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives --> | ||
|
||
<DeprecatedMethod errorLevel="info" /> | ||
<DeprecatedProperty errorLevel="info" /> | ||
<DeprecatedClass errorLevel="info" /> | ||
<DeprecatedConstant errorLevel="info" /> | ||
<DeprecatedInterface errorLevel="info" /> | ||
<DeprecatedTrait errorLevel="info" /> | ||
|
||
<InternalMethod errorLevel="info" /> | ||
<InternalProperty errorLevel="info" /> | ||
<InternalClass errorLevel="info" /> | ||
|
||
<MissingClosureReturnType errorLevel="info" /> | ||
<MissingReturnType errorLevel="info" /> | ||
<MissingPropertyType errorLevel="info" /> | ||
<InvalidDocblock errorLevel="info" /> | ||
<MisplacedRequiredParam errorLevel="info" /> | ||
|
||
<PropertyNotSetInConstructor errorLevel="info" /> | ||
<MissingConstructor errorLevel="info" /> | ||
<MissingClosureParamType errorLevel="info" /> | ||
<MissingParamType errorLevel="info" /> | ||
|
||
<RedundantCondition errorLevel="info" /> | ||
|
||
<DocblockTypeContradiction errorLevel="info" /> | ||
<RedundantConditionGivenDocblockType errorLevel="info" /> | ||
|
||
<UnresolvableInclude errorLevel="info" /> | ||
|
||
<RawObjectIteration errorLevel="info" /> | ||
|
||
<InvalidStringClass errorLevel="info" /> | ||
</issueHandlers> | ||
</psalm> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* KeyHasUseException | ||
* | ||
* Created 6/9/17 12:46 PM | ||
* Exception handler for in use keys | ||
* | ||
* @author Nate Nolting <naten@paulbunyan.net> | ||
* @package Pbc\Bandolier\Type\Collection\Exception | ||
*/ | ||
|
||
namespace Pbc\Bandolier\Exception\Collection; | ||
|
||
use Pbc\Bandolier\Exception\Exception; | ||
use Pbc\Bandolier\Exception\ExceptionInterface; | ||
|
||
class KeyHasUseException extends Exception implements ExceptionInterface{ | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Bandolier/Exception/Collection/KeyInvalidException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* KeyInvalidException | ||
* | ||
* Created 6/9/17 12:44 PM | ||
* Exception handler for invalid keys from collection | ||
* | ||
* @author Nate Nolting <naten@paulbunyan.net> | ||
* @package Pbc\Bandolier\Type\Collection\Exception | ||
*/ | ||
|
||
namespace Pbc\Bandolier\Exception\Collection; | ||
|
||
use Pbc\Bandolier\Exception\Exception; | ||
use Pbc\Bandolier\Exception\ExceptionInterface; | ||
|
||
class KeyInvalidException extends Exception implements ExceptionInterface { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception; | ||
|
||
abstract class Exception extends \Exception implements ExceptionInterface {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Pbc\Bandolier\Exception; | ||
|
||
interface ExceptionInterface | ||
{ | ||
// Protected methods inherited from Exception class | ||
/** | ||
* Exception message | ||
* @return mixed | ||
*/ | ||
public function getMessage(); | ||
|
||
/** | ||
* User-defined Exception code | ||
* @return mixed | ||
*/ | ||
public function getCode(); | ||
|
||
/** | ||
* Source filename | ||
* | ||
* @return mixed | ||
*/ | ||
public function getFile(); | ||
|
||
/** | ||
* Source line | ||
* | ||
* @return mixed | ||
*/ | ||
public function getLine(); | ||
|
||
/** | ||
* An array of the backtrace() | ||
* | ||
* @return mixed | ||
*/ | ||
public function getTrace(); | ||
|
||
/** | ||
* Formatted string of trace | ||
* | ||
* @return mixed | ||
*/ | ||
public function getTraceAsString(); | ||
|
||
// Overrideable methods inherited from Exception class | ||
|
||
/** | ||
* formatted string for display | ||
* | ||
* @return mixed | ||
*/ | ||
public function __toString(); | ||
|
||
/** | ||
* ExceptionInterface constructor. | ||
* @param string $message | ||
* @param int $code | ||
*/ | ||
public function __construct($message, $code = 0); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Bandolier/Exception/Setup/UnknownPropertyException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Setup; | ||
|
||
use Pbc\Bandolier\Exception\Exception; | ||
use Pbc\Bandolier\Exception\ExceptionInterface; | ||
|
||
class UnknownPropertyException extends Exception implements ExceptionInterface { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Bandolier/Exception/Type/Numbers/OutOfRangeException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Type\Numbers; | ||
|
||
use Pbc\Bandolier\Exception\Exception; | ||
use Pbc\Bandolier\Exception\ExceptionInterface; | ||
|
||
class OutOfRangeException extends Exception implements ExceptionInterface { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Writable; | ||
|
||
class LocationDoesExist extends WritableLocation { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Writable; | ||
|
||
class LocationIsADirectory extends WritableLocation { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Writable; | ||
|
||
class LocationIsWritable extends WritableLocation { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace Pbc\Bandolier\Exception\Writable; | ||
|
||
use Pbc\Bandolier\Exception\Exception; | ||
use Pbc\Bandolier\Exception\ExceptionInterface; | ||
|
||
class WritableLocation extends Exception implements ExceptionInterface { | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @return void | ||
*/ | ||
public function __construct($message = '', $code = 0) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
Oops, something went wrong.