-
Notifications
You must be signed in to change notification settings - Fork 145
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 #123 from paragonie/psalm
Integrate with Psalm
- Loading branch information
Showing
15 changed files
with
170 additions
and
48 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 |
---|---|---|
@@ -1,22 +1,32 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
sudo: false | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: "5.3" | ||
env: USE_PSALM=0 | ||
- php: "5.4" | ||
env: USE_PSALM=0 | ||
- php: "5.5" | ||
env: USE_PSALM=0 | ||
- php: "5.6" | ||
env: USE_PSALM=1 | ||
- php: "7.0" | ||
env: USE_PSALM=1 | ||
- php: "7.1" | ||
env: USE_PSALM=1 | ||
- php: "hhvm" | ||
env: USE_PSALM=1 | ||
allow_failures: | ||
- php: hhvm | ||
|
||
sudo: false | ||
- php: "hhvm" | ||
|
||
install: | ||
- composer install | ||
- composer self-update | ||
- composer install | ||
- if [[ $USE_PSALM -eq 1 ]]; then composer require --dev "vimeo/psalm:dev-master"; fi | ||
|
||
script: | ||
- ./phpunit.sh | ||
- vendor/bin/phpunit | ||
- php -dmbstring.func_overload=7 vendor/bin/phpunit | ||
- if [[ $USE_PSALM -eq 1 ]]; then vendor/bin/psalm; fi |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
/** | ||
* This does nothing if the libsodium extension is loaded, so it's harmless. | ||
* | ||
* This file alone is released under CC0 and WTFPL dual licensing. | ||
*/ | ||
namespace Sodium { | ||
if (!extension_loaded('libsodium')) { | ||
|
||
/** | ||
* Generate a string of random bytes | ||
* /dev/urandom | ||
* | ||
* @param int $length | ||
* @return string | ||
*/ | ||
function randombytes_buf( | ||
$length | ||
) | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate a 16-bit integer | ||
* /dev/urandom | ||
* | ||
* @return int | ||
*/ | ||
function randombytes_random16() | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate an unbiased random integer between 0 and a specified value | ||
* /dev/urandom | ||
* | ||
* @param int $upperBoundNonInclusive | ||
* @return int | ||
*/ | ||
function randombytes_uniform( | ||
$upperBoundNonInclusive | ||
) | ||
{ | ||
return 0; | ||
} | ||
} | ||
} | ||
namespace { | ||
class Sodium | ||
{ | ||
|
||
/** | ||
* Generate a string of random bytes | ||
* /dev/urandom | ||
* | ||
* @param int $length | ||
* @return string | ||
*/ | ||
public static function randombytes_buf($length) | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate a 16-bit integer | ||
* /dev/urandom | ||
* | ||
* @return int | ||
*/ | ||
public static function randombytes_random16() | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate an unbiased random integer between 0 and a specified value | ||
* /dev/urandom | ||
* | ||
* @param int $upperBoundNonInclusive | ||
* @return int | ||
*/ | ||
public static function randombytes_uniform($upperBoundNonInclusive = 0) | ||
{ | ||
return 0; | ||
} | ||
} | ||
} |
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