Add Safe PHP functions

This commit is contained in:
Alex Cabal 2019-03-07 12:11:50 -06:00
parent 04a956886a
commit 58cc098058
260 changed files with 49458 additions and 45 deletions

View file

@ -45,7 +45,7 @@ Youll also need to ensure the following:
# Testing
This repository includes [PHPStan](https://github.com/phpstan/phpstan) to statically analyze the codebase.
This repository includes [PHPStan](https://github.com/phpstan/phpstan) to statically analyze the codebase and [Safe PHP](https://github.com/thecodingmachine/safe) to replace old functions that don't throw exceptions.
To run PHPStan, execute:

View file

@ -1,9 +1,13 @@
{
"require-dev": {
"phpstan/phpstan": "^0.11.2"
"phpstan/phpstan": "^0.11.2",
"thecodingmachine/phpstan-safe-rule": "^0.1.3"
},
"autoload": {
"psr-4": {"": "lib/"},
"files": ["lib/Constants.php", "lib/CoreFunctions.php"]
},
"require": {
"thecodingmachine/safe": "^0.1.14"
}
}

185
composer.lock generated
View file

@ -4,8 +4,141 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "eed5e4de65902f3c2e1429d5b4068d9d",
"packages": [],
"content-hash": "aa70e67832f20ec3789ed9ccd25c3646",
"packages": [
{
"name": "thecodingmachine/safe",
"version": "v0.1.14",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/safe.git",
"reference": "67b654c7effeda8db27c133e5f0cbb638e90d1e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/67b654c7effeda8db27c133e5f0cbb638e90d1e4",
"reference": "67b654c7effeda8db27c133e5f0cbb638e90d1e4",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpstan/phpstan": "^0.10.3",
"squizlabs/php_codesniffer": "^3.2",
"thecodingmachine/phpstan-strict-rules": "^0.10.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
},
"autoload": {
"psr-4": {
"Safe\\": [
"lib/",
"generated/"
]
},
"files": [
"generated/apache.php",
"generated/apc.php",
"generated/apcu.php",
"generated/array.php",
"generated/bzip2.php",
"generated/classobj.php",
"generated/com.php",
"generated/cubrid.php",
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
"generated/fileinfo.php",
"generated/filesystem.php",
"generated/filter.php",
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
"generated/ibase.php",
"generated/ibmDb2.php",
"generated/iconv.php",
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/ingres-ii.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
"generated/libevent.php",
"generated/libxml.php",
"generated/lzf.php",
"generated/mailparse.php",
"generated/mbstring.php",
"generated/misc.php",
"generated/msql.php",
"generated/mssql.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/mysqlndMs.php",
"generated/mysqlndQc.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
"generated/openssl.php",
"generated/outcontrol.php",
"generated/password.php",
"generated/pcntl.php",
"generated/pcre.php",
"generated/pdf.php",
"generated/pgsql.php",
"generated/posix.php",
"generated/ps.php",
"generated/pspell.php",
"generated/readline.php",
"generated/rrd.php",
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/simplexml.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
"generated/ssdeep.php",
"generated/ssh2.php",
"generated/stats.php",
"generated/stream.php",
"generated/strings.php",
"generated/swoole.php",
"generated/uodbc.php",
"generated/uopz.php",
"generated/url.php",
"generated/var.php",
"generated/xdiff.php",
"generated/xml.php",
"generated/xmlrpc.php",
"generated/yaml.php",
"generated/yaz.php",
"generated/zip.php",
"generated/zlib.php",
"lib/special_cases.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"time": "2019-03-07T11:09:21+00:00"
}
],
"packages-dev": [
{
"name": "composer/xdebug-handler",
@ -1093,6 +1226,54 @@
"shim"
],
"time": "2018-09-21T13:07:52+00:00"
},
{
"name": "thecodingmachine/phpstan-safe-rule",
"version": "v0.1.3",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/phpstan-safe-rule.git",
"reference": "00f4845905feb5240ca62fb799e3c51ba85c9230"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/phpstan-safe-rule/zipball/00f4845905feb5240ca62fb799e3c51ba85c9230",
"reference": "00f4845905feb5240ca62fb799e3c51ba85c9230",
"shasum": ""
},
"require": {
"php": "^7.1",
"phpstan/phpstan": "^0.10 | ^0.11",
"thecodingmachine/safe": "^0.1.11"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^7.5.2",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
},
"autoload": {
"psr-4": {
"TheCodingMachine\\Safe\\PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "David Négrier",
"email": "d.negrier@thecodingmachine.com"
}
],
"description": "A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe",
"time": "2019-03-07T13:52:42+00:00"
}
],
"aliases": [],

View file

@ -1,11 +1,15 @@
<?
// Composer auto-loads the lib/ directory in composer.json
require __DIR__ . '/../vendor/autoload.php';
use function Safe\mb_internal_encoding;
use function Safe\mb_http_output;
use function Safe\error_log;
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
date_default_timezone_set('UTC');
// Composer auto-loads the lib/ directory in composer.json
require __DIR__ . '/../vendor/autoload.php';
// Custom error handler to output more details about the specific Apache request that caused an exception.
set_exception_handler(function($ex){
$errorString = "----------------------------------------\n";

View file

@ -2,6 +2,8 @@
// Auto-included by Composer in composer.json
// These functions are broken out of Core.php to satisfy PHPStan
use function Safe\ob_end_clean;
// Convenience alias of var_dump.
function vd($var){
var_dump($var);

View file

@ -1,4 +1,11 @@
<?
use function Safe\preg_replace;
use function Safe\file_get_contents;
use function Safe\preg_match;
use function Safe\glob;
use function Safe\substr;
use function Safe\json_encode;
class Ebook{
public $WwwFilesystemPath;
public $RepoFilesystemPath;

View file

@ -1,4 +1,6 @@
<?
use function Safe\preg_replace;
class Formatter{
public static function RemoveDiacritics(string $text): string{
if(!isset($GLOBALS['transliterator'])){

View file

@ -1,4 +1,8 @@
<?
use function Safe\apcu_fetch;
use function Safe\preg_replace;
use function Safe\usort;
class Library{
public static function GetEbooks(string $sort = null): array{
$ebooks = [];
@ -6,9 +10,10 @@ class Library{
switch($sort){
case SORT_AUTHOR_ALPHA:
// Get all ebooks, sorted by author alpha first.
$ebooks = apcu_fetch('ebooks-alpha', $success);
if(!$success){
try{
$ebooks = apcu_fetch('ebooks-alpha');
}
catch(Safe\Exceptions\ApcuException $ex){
$ebooks = Library::GetEbooks();
usort($ebooks, function($a, $b){
@ -21,9 +26,10 @@ class Library{
case SORT_NEWEST:
// Get all ebooks, sorted by newest first.
$ebooks = apcu_fetch('ebooks-newest', $success);
if(!$success){
try{
$ebooks = apcu_fetch('ebooks-newest');
}
catch(Safe\Exceptions\ApcuException $ex){
$ebooks = Library::GetEbooks();
usort($ebooks, function($a, $b){
@ -46,14 +52,16 @@ class Library{
default:
// Get all ebooks, unsorted.
$ebooks = apcu_fetch('ebooks', $success);
if(!$success){
try{
$ebooks = apcu_fetch('ebooks');
}
catch(Safe\Exceptions\ApcuException $ex){
foreach(explode("\n", trim(shell_exec('find ' . SITE_ROOT . '/www/ebooks/ -name "content.opf"') ?? '')) as $filename){
$ebookWwwFilesystemPath = preg_replace('|/src/.+|ius', '', $filename) ?: '';
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath, $success);
if(!$success){
try{
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebook = new Ebook($ebookWwwFilesystemPath);
apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook);
}
@ -71,17 +79,19 @@ class Library{
public static function GetEbooksByAuthor(string $wwwFilesystemPath): array{
// Do we have the author's ebooks cached?
$ebooks = apcu_fetch('author-' . $wwwFilesystemPath, $success);
if(!$success){
try{
$ebooks = apcu_fetch('author-' . $wwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebooks = [];
foreach(explode("\n", trim(shell_exec('find ' . escapeshellarg($wwwFilesystemPath) . ' -name "content.opf"') ?? '')) as $filename){
try{
$ebookWwwFilesystemPath = preg_replace('|/src/.+|ius', '', $filename) ?? '';
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath, $success);
if(!$success){
try{
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebook = new Ebook($ebookWwwFilesystemPath);
apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook);
}
@ -102,17 +112,19 @@ class Library{
public static function GetEbooksByTag(string $tag): array{
// Do we have the tag's ebooks cached?
$ebooks = apcu_fetch('tag-' . $tag, $success);
if(!$success){
try{
$ebooks = apcu_fetch('tag-' . $tag);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebooks = [];
foreach(explode("\n", trim(shell_exec('find ' . SITE_ROOT . '/www/ebooks/ -name "content.opf"') ?? '')) as $filename){
try{
$ebookWwwFilesystemPath = preg_replace('|/src/.+|ius', '', $filename) ?? '';
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath, $success);
if(!$success){
try{
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebook = new Ebook($ebookWwwFilesystemPath);
apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook);
}
@ -134,17 +146,19 @@ class Library{
public static function GetEbooksByCollection(string $collection): array{
// Do we have the tag's ebooks cached?
$ebooks = apcu_fetch('collection-' . $collection, $success);
if(!$success){
try{
$ebooks = apcu_fetch('collection-' . $collection);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebooks = [];
foreach(explode("\n", trim(shell_exec('find ' . SITE_ROOT . '/www/ebooks/ -name "content.opf"') ?? '')) as $filename){
try{
$ebookWwwFilesystemPath = preg_replace('|/src/.+|ius', '', $filename) ?? '';
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath, $success);
if(!$success){
try{
$ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath);
}
catch(Safe\Exceptions\ApcuException $ex){
$ebook = new Ebook($ebookWwwFilesystemPath);
apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook);
}

View file

@ -1,10 +1,16 @@
<?
use function Safe\fopen;
use function Safe\fwrite;
use function Safe\fclose;
use function Safe\error_log;
class Logger{
public static function WriteGithubWebhookLogEntry(string $requestId, string $text){
try{
$fp = fopen(GITHUB_WEBHOOK_LOG_FILE_PATH, 'a+');
if($fp === false){
self::WriteErrorLogEntry('Could not open log file: ' . GITHUB_WEBHOOK_LOG_FILE_PATH);
}
catch(\Exception $ex){
self::WriteErrorLogEntry('Couldn\'t open log file: ' . GITHUB_WEBHOOK_LOG_FILE_PATH . '. Exception: ' . vds($ex));
return;
}

View file

@ -1,4 +1,7 @@
<?
use function Safe\file_get_contents;
use function Safe\ob_end_clean;
class Template{
protected static $Cache = [];

View file

@ -8,6 +8,93 @@ $baseDir = dirname($vendorDir);
return array(
'a12da592622097d2b593a430e32e13fd' => $vendorDir . '/nette/utils/src/loader.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'3f648889e687f31c52f949ba8a9d0873' => $vendorDir . '/thecodingmachine/safe/generated/apache.php',
'eab5d259bc3aff0bc10e38f403600cce' => $vendorDir . '/thecodingmachine/safe/generated/apc.php',
'eeb4581d958421a4244aaa4167c6a575' => $vendorDir . '/thecodingmachine/safe/generated/apcu.php',
'04cb0b3c1dac5b5ddb23c14e3d66dbe9' => $vendorDir . '/thecodingmachine/safe/generated/array.php',
'450b332a74a9a21e043c5e953485a791' => $vendorDir . '/thecodingmachine/safe/generated/bzip2.php',
'2c6d7e8bd2de9a272a9d4d43b0a4304a' => $vendorDir . '/thecodingmachine/safe/generated/classobj.php',
'0b8231c1ad0865447c988a4c16b4001f' => $vendorDir . '/thecodingmachine/safe/generated/com.php',
'7643a71fe1c3256058c8fee234cb86e5' => $vendorDir . '/thecodingmachine/safe/generated/cubrid.php',
'68e1365710575942efc1d55000032cee' => $vendorDir . '/thecodingmachine/safe/generated/curl.php',
'02fd26bca803106c5b942a7197c3ad8b' => $vendorDir . '/thecodingmachine/safe/generated/datetime.php',
'f4817dcbd956cd221b1c31f6fbd5749c' => $vendorDir . '/thecodingmachine/safe/generated/dir.php',
'51c3f2d10ca61a70dbcea0e38d8e902d' => $vendorDir . '/thecodingmachine/safe/generated/eio.php',
'1d34f34327ca3e81535963016e3be2c3' => $vendorDir . '/thecodingmachine/safe/generated/errorfunc.php',
'4fd0ba2d3717b0424d474bebfdafa2b4' => $vendorDir . '/thecodingmachine/safe/generated/exec.php',
'98f4dae054bc7fb19c13be14935cbdd3' => $vendorDir . '/thecodingmachine/safe/generated/fileinfo.php',
'5530ae063ba88323eaf0a07904efdf85' => $vendorDir . '/thecodingmachine/safe/generated/filesystem.php',
'633f4f134975d70e97bddad83348e91a' => $vendorDir . '/thecodingmachine/safe/generated/filter.php',
'fbd163fc68c5faf73d5ed4002ffd836d' => $vendorDir . '/thecodingmachine/safe/generated/fpm.php',
'21b511999d61411fab0692ff8795bbed' => $vendorDir . '/thecodingmachine/safe/generated/ftp.php',
'85fbd73fc92365cd90526b0ea03cae3a' => $vendorDir . '/thecodingmachine/safe/generated/funchand.php',
'51df9c146e0b7dcbdf358d8abd24dbdc' => $vendorDir . '/thecodingmachine/safe/generated/gmp.php',
'93bb7fe678d7dcfb1322f8e3475a48b0' => $vendorDir . '/thecodingmachine/safe/generated/gnupg.php',
'c171ba99cf316379ff66468392bf4950' => $vendorDir . '/thecodingmachine/safe/generated/hash.php',
'5ab4aad4c28e468209fbfcceb2e5e6a5' => $vendorDir . '/thecodingmachine/safe/generated/ibase.php',
'4d57409c5e8e576b0c64c08d9d731cfb' => $vendorDir . '/thecodingmachine/safe/generated/ibmDb2.php',
'eeb246d5403972a9d62106e4a4883496' => $vendorDir . '/thecodingmachine/safe/generated/iconv.php',
'c28a05f498c01b810a714f7214b7a8da' => $vendorDir . '/thecodingmachine/safe/generated/image.php',
'8063cd92acdf00fd978b5599eb7cc142' => $vendorDir . '/thecodingmachine/safe/generated/imap.php',
'8bd26dbe768e9c9599edad7b198e5446' => $vendorDir . '/thecodingmachine/safe/generated/info.php',
'0c577fe603b029d4b65c84376b15dbd5' => $vendorDir . '/thecodingmachine/safe/generated/ingres-ii.php',
'd4362910bde43c0f956b52527effd7d4' => $vendorDir . '/thecodingmachine/safe/generated/inotify.php',
'696ba49197d9b55f0428a12bb5a818e1' => $vendorDir . '/thecodingmachine/safe/generated/json.php',
'9818aaa99c8647c63f8ef62b7a368160' => $vendorDir . '/thecodingmachine/safe/generated/ldap.php',
'39d49c88877eb176a0be4e407f3cc95f' => $vendorDir . '/thecodingmachine/safe/generated/libevent.php',
'bcf523ff2a195eb08e0fbb668ed784d0' => $vendorDir . '/thecodingmachine/safe/generated/libxml.php',
'68be68a9a8b95bb56cab6109ff03bc88' => $vendorDir . '/thecodingmachine/safe/generated/lzf.php',
'bdca804bb0904ea9f53f328dfc0bb8a5' => $vendorDir . '/thecodingmachine/safe/generated/mailparse.php',
'b0a3fcac3eaf55445796d6af26b89366' => $vendorDir . '/thecodingmachine/safe/generated/mbstring.php',
'98de16b8db03eb0cb4d318b4402215a6' => $vendorDir . '/thecodingmachine/safe/generated/misc.php',
'c112440003b56e243b192c11fa9d836e' => $vendorDir . '/thecodingmachine/safe/generated/msql.php',
'd12306fdf0bdb146582b277385a2ed7b' => $vendorDir . '/thecodingmachine/safe/generated/mssql.php',
'7cefd81607cd21b8b3a15656eb6465f5' => $vendorDir . '/thecodingmachine/safe/generated/mysql.php',
'aaf438b080089c6d0686679cd34aa72e' => $vendorDir . '/thecodingmachine/safe/generated/mysqli.php',
'df0ef890e9afbf95f3924feb1c7a89f3' => $vendorDir . '/thecodingmachine/safe/generated/mysqlndMs.php',
'db595fee5972867e45c5327010d78735' => $vendorDir . '/thecodingmachine/safe/generated/mysqlndQc.php',
'cbac956836b72483dcff1ac39d5c0a0f' => $vendorDir . '/thecodingmachine/safe/generated/network.php',
'6c8f89dfbdc117d7871f572269363f25' => $vendorDir . '/thecodingmachine/safe/generated/oci8.php',
'169a669966a45c06bf55ed029122729b' => $vendorDir . '/thecodingmachine/safe/generated/opcache.php',
'def61bf4fecd4d4bca7354919cd69302' => $vendorDir . '/thecodingmachine/safe/generated/openssl.php',
'26bb010649a6d32d4120181458aa6ef2' => $vendorDir . '/thecodingmachine/safe/generated/outcontrol.php',
'1212c201fe43c7492a085b2c71505e0f' => $vendorDir . '/thecodingmachine/safe/generated/password.php',
'002ebcb842e2c0d5b7f67fe64cc93158' => $vendorDir . '/thecodingmachine/safe/generated/pcntl.php',
'86df38612982dade72c7085ce7eca81f' => $vendorDir . '/thecodingmachine/safe/generated/pcre.php',
'1cacc3e65f82a473fbd5507c7ce4385d' => $vendorDir . '/thecodingmachine/safe/generated/pdf.php',
'1fc22f445c69ea8706e82fce301c0831' => $vendorDir . '/thecodingmachine/safe/generated/pgsql.php',
'c70b42561584f7144bff38cd63c4eef3' => $vendorDir . '/thecodingmachine/safe/generated/posix.php',
'9923214639c32ca5173db03a177d3b63' => $vendorDir . '/thecodingmachine/safe/generated/ps.php',
'7e9c3f8eae2b5bf42205c4f1295cb7a7' => $vendorDir . '/thecodingmachine/safe/generated/pspell.php',
'91aa91f6245c349c2e2e88bd0025f199' => $vendorDir . '/thecodingmachine/safe/generated/readline.php',
'f053a3849e9e8383762b34b91db0320b' => $vendorDir . '/thecodingmachine/safe/generated/rrd.php',
'775b964f72f827a1bf87c65ab5b10800' => $vendorDir . '/thecodingmachine/safe/generated/sem.php',
'816428bd69c29ab5e1ed622af5dca0cd' => $vendorDir . '/thecodingmachine/safe/generated/session.php',
'5093e233bedbefaef0df262bfbab0a5c' => $vendorDir . '/thecodingmachine/safe/generated/shmop.php',
'01352920b0151f17e671266e44b52536' => $vendorDir . '/thecodingmachine/safe/generated/simplexml.php',
'b080617b1d949683c2e37f8f01dc0e15' => $vendorDir . '/thecodingmachine/safe/generated/sockets.php',
'2708aa182ddcfe6ce27c96acaaa40f69' => $vendorDir . '/thecodingmachine/safe/generated/sodium.php',
'f1b96cb260a5baeea9a7285cda82a1ec' => $vendorDir . '/thecodingmachine/safe/generated/solr.php',
'3fd8853757d0fe3557c179efb807afeb' => $vendorDir . '/thecodingmachine/safe/generated/spl.php',
'9312ce96a51c846913fcda5f186d58dd' => $vendorDir . '/thecodingmachine/safe/generated/sqlsrv.php',
'd3eb383ad0b8b962b29dc4afd29d6715' => $vendorDir . '/thecodingmachine/safe/generated/ssdeep.php',
'42a09bc448f441a0b9f9367ea975c0bf' => $vendorDir . '/thecodingmachine/safe/generated/ssh2.php',
'5a2984190663db4a2f4f6bdcdf8b59ea' => $vendorDir . '/thecodingmachine/safe/generated/stats.php',
'ef711077d356d1b33ca0b10b67b0be8f' => $vendorDir . '/thecodingmachine/safe/generated/stream.php',
'764b09f6df081cbb2807b97c6ace3866' => $vendorDir . '/thecodingmachine/safe/generated/strings.php',
'ef241678769fee4a44aaa288f3b78aa1' => $vendorDir . '/thecodingmachine/safe/generated/swoole.php',
'0efc8f6778cba932b9e2a89e28de2452' => $vendorDir . '/thecodingmachine/safe/generated/uodbc.php',
'd383d32907b98af53ee9208c62204fd0' => $vendorDir . '/thecodingmachine/safe/generated/uopz.php',
'2fd2e4060f7fe772660f002ce38f0b71' => $vendorDir . '/thecodingmachine/safe/generated/url.php',
'782249e03deebeaf57b9991ff5493aa0' => $vendorDir . '/thecodingmachine/safe/generated/var.php',
'344440cd1cd7200fdb4f12af0d3c587f' => $vendorDir . '/thecodingmachine/safe/generated/xdiff.php',
'3599f369219c658a5fb6c4fe66832f62' => $vendorDir . '/thecodingmachine/safe/generated/xml.php',
'7fcd313da9fae337051b091b3492c21b' => $vendorDir . '/thecodingmachine/safe/generated/xmlrpc.php',
'd668c74cfa92d893b582356733d9a80e' => $vendorDir . '/thecodingmachine/safe/generated/yaml.php',
'4af1dca6db8c527c6eed27bff85ff0e5' => $vendorDir . '/thecodingmachine/safe/generated/yaz.php',
'fe43ca06499ac37bc2dedd823af71eb5' => $vendorDir . '/thecodingmachine/safe/generated/zip.php',
'356736db98a6834f0a886b8d509b0ecd' => $vendorDir . '/thecodingmachine/safe/generated/zlib.php',
'72243e5536b63e298acb6476f01f1aff' => $vendorDir . '/thecodingmachine/safe/lib/special_cases.php',
'782b605f6bb82f1cd229995fb6f0c6bf' => $baseDir . '/lib/Constants.php',
'7f0f1b28d901698044d9d248797ab78a' => $baseDir . '/lib/CoreFunctions.php',
);

View file

@ -6,10 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'TheCodingMachine\\Safe\\PHPStan\\' => array($vendorDir . '/thecodingmachine/phpstan-safe-rule/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Contracts\\' => array($vendorDir . '/symfony/contracts'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Safe\\' => array($vendorDir . '/thecodingmachine/safe/lib', $vendorDir . '/thecodingmachine/safe/generated'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'PackageVersions\\' => array($vendorDir . '/ocramius/package-versions/src/PackageVersions'),

View file

@ -9,17 +9,109 @@ class ComposerStaticInit49e401a41abff8a9005dcbd044d35c5f
public static $files = array (
'a12da592622097d2b593a430e32e13fd' => __DIR__ . '/..' . '/nette/utils/src/loader.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'3f648889e687f31c52f949ba8a9d0873' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/apache.php',
'eab5d259bc3aff0bc10e38f403600cce' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/apc.php',
'eeb4581d958421a4244aaa4167c6a575' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/apcu.php',
'04cb0b3c1dac5b5ddb23c14e3d66dbe9' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/array.php',
'450b332a74a9a21e043c5e953485a791' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/bzip2.php',
'2c6d7e8bd2de9a272a9d4d43b0a4304a' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/classobj.php',
'0b8231c1ad0865447c988a4c16b4001f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/com.php',
'7643a71fe1c3256058c8fee234cb86e5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/cubrid.php',
'68e1365710575942efc1d55000032cee' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/curl.php',
'02fd26bca803106c5b942a7197c3ad8b' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/datetime.php',
'f4817dcbd956cd221b1c31f6fbd5749c' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/dir.php',
'51c3f2d10ca61a70dbcea0e38d8e902d' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/eio.php',
'1d34f34327ca3e81535963016e3be2c3' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/errorfunc.php',
'4fd0ba2d3717b0424d474bebfdafa2b4' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/exec.php',
'98f4dae054bc7fb19c13be14935cbdd3' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/fileinfo.php',
'5530ae063ba88323eaf0a07904efdf85' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/filesystem.php',
'633f4f134975d70e97bddad83348e91a' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/filter.php',
'fbd163fc68c5faf73d5ed4002ffd836d' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/fpm.php',
'21b511999d61411fab0692ff8795bbed' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ftp.php',
'85fbd73fc92365cd90526b0ea03cae3a' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/funchand.php',
'51df9c146e0b7dcbdf358d8abd24dbdc' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/gmp.php',
'93bb7fe678d7dcfb1322f8e3475a48b0' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/gnupg.php',
'c171ba99cf316379ff66468392bf4950' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/hash.php',
'5ab4aad4c28e468209fbfcceb2e5e6a5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ibase.php',
'4d57409c5e8e576b0c64c08d9d731cfb' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ibmDb2.php',
'eeb246d5403972a9d62106e4a4883496' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/iconv.php',
'c28a05f498c01b810a714f7214b7a8da' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/image.php',
'8063cd92acdf00fd978b5599eb7cc142' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/imap.php',
'8bd26dbe768e9c9599edad7b198e5446' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/info.php',
'0c577fe603b029d4b65c84376b15dbd5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ingres-ii.php',
'd4362910bde43c0f956b52527effd7d4' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/inotify.php',
'696ba49197d9b55f0428a12bb5a818e1' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/json.php',
'9818aaa99c8647c63f8ef62b7a368160' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ldap.php',
'39d49c88877eb176a0be4e407f3cc95f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/libevent.php',
'bcf523ff2a195eb08e0fbb668ed784d0' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/libxml.php',
'68be68a9a8b95bb56cab6109ff03bc88' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/lzf.php',
'bdca804bb0904ea9f53f328dfc0bb8a5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mailparse.php',
'b0a3fcac3eaf55445796d6af26b89366' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mbstring.php',
'98de16b8db03eb0cb4d318b4402215a6' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/misc.php',
'c112440003b56e243b192c11fa9d836e' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/msql.php',
'd12306fdf0bdb146582b277385a2ed7b' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mssql.php',
'7cefd81607cd21b8b3a15656eb6465f5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mysql.php',
'aaf438b080089c6d0686679cd34aa72e' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mysqli.php',
'df0ef890e9afbf95f3924feb1c7a89f3' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mysqlndMs.php',
'db595fee5972867e45c5327010d78735' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/mysqlndQc.php',
'cbac956836b72483dcff1ac39d5c0a0f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/network.php',
'6c8f89dfbdc117d7871f572269363f25' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/oci8.php',
'169a669966a45c06bf55ed029122729b' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/opcache.php',
'def61bf4fecd4d4bca7354919cd69302' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/openssl.php',
'26bb010649a6d32d4120181458aa6ef2' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/outcontrol.php',
'1212c201fe43c7492a085b2c71505e0f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/password.php',
'002ebcb842e2c0d5b7f67fe64cc93158' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/pcntl.php',
'86df38612982dade72c7085ce7eca81f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/pcre.php',
'1cacc3e65f82a473fbd5507c7ce4385d' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/pdf.php',
'1fc22f445c69ea8706e82fce301c0831' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/pgsql.php',
'c70b42561584f7144bff38cd63c4eef3' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/posix.php',
'9923214639c32ca5173db03a177d3b63' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ps.php',
'7e9c3f8eae2b5bf42205c4f1295cb7a7' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/pspell.php',
'91aa91f6245c349c2e2e88bd0025f199' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/readline.php',
'f053a3849e9e8383762b34b91db0320b' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/rrd.php',
'775b964f72f827a1bf87c65ab5b10800' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/sem.php',
'816428bd69c29ab5e1ed622af5dca0cd' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/session.php',
'5093e233bedbefaef0df262bfbab0a5c' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/shmop.php',
'01352920b0151f17e671266e44b52536' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/simplexml.php',
'b080617b1d949683c2e37f8f01dc0e15' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/sockets.php',
'2708aa182ddcfe6ce27c96acaaa40f69' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/sodium.php',
'f1b96cb260a5baeea9a7285cda82a1ec' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/solr.php',
'3fd8853757d0fe3557c179efb807afeb' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/spl.php',
'9312ce96a51c846913fcda5f186d58dd' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/sqlsrv.php',
'd3eb383ad0b8b962b29dc4afd29d6715' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ssdeep.php',
'42a09bc448f441a0b9f9367ea975c0bf' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/ssh2.php',
'5a2984190663db4a2f4f6bdcdf8b59ea' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/stats.php',
'ef711077d356d1b33ca0b10b67b0be8f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/stream.php',
'764b09f6df081cbb2807b97c6ace3866' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/strings.php',
'ef241678769fee4a44aaa288f3b78aa1' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/swoole.php',
'0efc8f6778cba932b9e2a89e28de2452' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/uodbc.php',
'd383d32907b98af53ee9208c62204fd0' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/uopz.php',
'2fd2e4060f7fe772660f002ce38f0b71' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/url.php',
'782249e03deebeaf57b9991ff5493aa0' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/var.php',
'344440cd1cd7200fdb4f12af0d3c587f' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/xdiff.php',
'3599f369219c658a5fb6c4fe66832f62' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/xml.php',
'7fcd313da9fae337051b091b3492c21b' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/xmlrpc.php',
'd668c74cfa92d893b582356733d9a80e' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/yaml.php',
'4af1dca6db8c527c6eed27bff85ff0e5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/yaz.php',
'fe43ca06499ac37bc2dedd823af71eb5' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/zip.php',
'356736db98a6834f0a886b8d509b0ecd' => __DIR__ . '/..' . '/thecodingmachine/safe/generated/zlib.php',
'72243e5536b63e298acb6476f01f1aff' => __DIR__ . '/..' . '/thecodingmachine/safe/lib/special_cases.php',
'782b605f6bb82f1cd229995fb6f0c6bf' => __DIR__ . '/../..' . '/lib/Constants.php',
'7f0f1b28d901698044d9d248797ab78a' => __DIR__ . '/../..' . '/lib/CoreFunctions.php',
);
public static $prefixLengthsPsr4 = array (
'T' =>
array (
'TheCodingMachine\\Safe\\PHPStan\\' => 30,
),
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Contracts\\' => 18,
'Symfony\\Component\\Finder\\' => 25,
'Symfony\\Component\\Console\\' => 26,
'Safe\\' => 5,
),
'P' =>
array (
@ -40,6 +132,10 @@ class ComposerStaticInit49e401a41abff8a9005dcbd044d35c5f
);
public static $prefixDirsPsr4 = array (
'TheCodingMachine\\Safe\\PHPStan\\' =>
array (
0 => __DIR__ . '/..' . '/thecodingmachine/phpstan-safe-rule/src',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
@ -56,6 +152,11 @@ class ComposerStaticInit49e401a41abff8a9005dcbd044d35c5f
array (
0 => __DIR__ . '/..' . '/symfony/console',
),
'Safe\\' =>
array (
0 => __DIR__ . '/..' . '/thecodingmachine/safe/lib',
1 => __DIR__ . '/..' . '/thecodingmachine/safe/generated',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',

View file

@ -1121,5 +1121,189 @@
"portable",
"shim"
]
},
{
"name": "thecodingmachine/phpstan-safe-rule",
"version": "v0.1.3",
"version_normalized": "0.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/phpstan-safe-rule.git",
"reference": "00f4845905feb5240ca62fb799e3c51ba85c9230"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/phpstan-safe-rule/zipball/00f4845905feb5240ca62fb799e3c51ba85c9230",
"reference": "00f4845905feb5240ca62fb799e3c51ba85c9230",
"shasum": ""
},
"require": {
"php": "^7.1",
"phpstan/phpstan": "^0.10 | ^0.11",
"thecodingmachine/safe": "^0.1.11"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^7.5.2",
"squizlabs/php_codesniffer": "^3.4"
},
"time": "2019-03-07T13:52:42+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"TheCodingMachine\\Safe\\PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "David Négrier",
"email": "d.negrier@thecodingmachine.com"
}
],
"description": "A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe"
},
{
"name": "thecodingmachine/safe",
"version": "v0.1.14",
"version_normalized": "0.1.14.0",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/safe.git",
"reference": "67b654c7effeda8db27c133e5f0cbb638e90d1e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/67b654c7effeda8db27c133e5f0cbb638e90d1e4",
"reference": "67b654c7effeda8db27c133e5f0cbb638e90d1e4",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpstan/phpstan": "^0.10.3",
"squizlabs/php_codesniffer": "^3.2",
"thecodingmachine/phpstan-strict-rules": "^0.10.3"
},
"time": "2019-03-07T11:09:21+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Safe\\": [
"lib/",
"generated/"
]
},
"files": [
"generated/apache.php",
"generated/apc.php",
"generated/apcu.php",
"generated/array.php",
"generated/bzip2.php",
"generated/classobj.php",
"generated/com.php",
"generated/cubrid.php",
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
"generated/fileinfo.php",
"generated/filesystem.php",
"generated/filter.php",
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
"generated/ibase.php",
"generated/ibmDb2.php",
"generated/iconv.php",
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/ingres-ii.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
"generated/libevent.php",
"generated/libxml.php",
"generated/lzf.php",
"generated/mailparse.php",
"generated/mbstring.php",
"generated/misc.php",
"generated/msql.php",
"generated/mssql.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/mysqlndMs.php",
"generated/mysqlndQc.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
"generated/openssl.php",
"generated/outcontrol.php",
"generated/password.php",
"generated/pcntl.php",
"generated/pcre.php",
"generated/pdf.php",
"generated/pgsql.php",
"generated/posix.php",
"generated/ps.php",
"generated/pspell.php",
"generated/readline.php",
"generated/rrd.php",
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/simplexml.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
"generated/ssdeep.php",
"generated/ssh2.php",
"generated/stats.php",
"generated/stream.php",
"generated/strings.php",
"generated/swoole.php",
"generated/uodbc.php",
"generated/uopz.php",
"generated/url.php",
"generated/var.php",
"generated/xdiff.php",
"generated/xml.php",
"generated/xmlrpc.php",
"generated/yaml.php",
"generated/yaz.php",
"generated/zip.php",
"generated/zlib.php",
"lib/special_cases.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP core functions that throw exceptions instead of returning FALSE on error"
}
]

View file

@ -14,6 +14,7 @@ final class Versions
{
public const ROOT_PACKAGE_NAME = '__root__';
public const VERSIONS = array (
'thecodingmachine/safe' => 'v0.1.14@67b654c7effeda8db27c133e5f0cbb638e90d1e4',
'composer/xdebug-handler' => '1.3.2@d17708133b6c276d6e42ef887a877866b909d892',
'jean85/pretty-package-versions' => '1.2@75c7effcf3f77501d0e0caa75111aff4daa0dd48',
'nette/bootstrap' => 'v2.4.6@268816e3f1bb7426c3a4ceec2bd38a036b532543',
@ -32,7 +33,8 @@ final class Versions
'symfony/contracts' => 'v1.0.2@1aa7ab2429c3d594dd70689604b5cf7421254cdf',
'symfony/finder' => 'v4.2.3@ef71816cbb264988bb57fe6a73f610888b9aa70c',
'symfony/polyfill-mbstring' => 'v1.10.0@c79c051f5b3a46be09205c73b80b346e4153e494',
'__root__' => 'dev-master@e198c4db65320cce173bdde14ef08da5beb5d6d8',
'thecodingmachine/phpstan-safe-rule' => 'v0.1.3@00f4845905feb5240ca62fb799e3c51ba85c9230',
'__root__' => 'dev-master@04a956886ab327ddbe5eec546b911b9e55a0e5ef',
);
private function __construct()

View file

@ -0,0 +1,32 @@
language: php
sudo: false
php:
- 7.1
- 7.2
- 7.3
env:
global:
# We need to prefer source to get PHPStan test directory. Otherwise, it is removed from ZIP
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress --optimize-autoloader --prefer-source"
- TASK_TESTS=1
- TASK_TESTS_COVERAGE=0
- TASK_CS=1
- TASK_SCA=0
matrix:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""
cache:
directories:
- "$HOME/.composer/cache"
before_install:
- travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
install:
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- composer info -D | sort
- mkdir tmp
script:
- vendor/bin/phpunit --verbose;
- composer phpstan
- composer cs-check
after_success:
- vendor/bin/coveralls -v

View file

@ -0,0 +1,16 @@
[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/phpstan-safe-rule/v/stable)](https://packagist.org/packages/thecodingmachine/phpstan-safe-rule)
[![Total Downloads](https://poser.pugx.org/thecodingmachine/phpstan-safe-rule/downloads)](https://packagist.org/packages/thecodingmachine/phpstan-safe-rule)
[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/phpstan-safe-rule/v/unstable)](https://packagist.org/packages/thecodingmachine/phpstan-safe-rule)
[![License](https://poser.pugx.org/thecodingmachine/phpstan-safe-rule/license)](https://packagist.org/packages/thecodingmachine/phpstan-safe-rule)
[![Build Status](https://travis-ci.org/thecodingmachine/phpstan-safe-rule.svg?branch=master)](https://travis-ci.org/thecodingmachine/phpstan-safe-rule)
[![Coverage Status](https://coveralls.io/repos/thecodingmachine/phpstan-safe-rule/badge.svg?branch=master&service=github)](https://coveralls.io/github/thecodingmachine/phpstan-safe-rule?branch=master)
PHPStan rules for thecodingmachine/safe
=======================================
The [thecodingmachine/safe](https://github.com/thecodingmachine/safe) package provides a set of core PHP functions rewritten to throw exceptions instead of returning `false` when an error is encountered.
This PHPStan rule will help you detect unsafe function call and will propose you to use the `thecodingmachine/safe` variant instead.
Please read [thecodingmachine/safe documentation](https://github.com/thecodingmachine/safe) for details about installation and usage.

View file

@ -0,0 +1,44 @@
{
"name": "thecodingmachine/phpstan-safe-rule",
"description": "A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "David Négrier",
"email": "d.negrier@thecodingmachine.com"
}
],
"require": {
"php": "^7.1",
"phpstan/phpstan": "^0.10 | ^0.11",
"thecodingmachine/safe": "^0.1.11"
},
"require-dev": {
"phpunit/phpunit": "^7.5.2",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.4"
},
"autoload": {
"psr-4": {
"TheCodingMachine\\Safe\\PHPStan\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"TheCodingMachine\\Safe\\PHPStan\\": "tests/"
}
},
"scripts": {
"phpstan": "phpstan analyse src -c phpstan.neon --level=7 --no-progress -vvv",
"cs-fix": "phpcbf",
"cs-check": "phpcs"
},
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

View file

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ruleset name="Expressive Skeleton coding standard">
<description>Expressive Skeleton coding standard</description>
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<!-- inherit rules from: -->
<rule ref="PSR2"/>
<!-- Paths to check -->
<file>src</file>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="300"/>
<property name="absoluteLineLimit" value="500"/>
</properties>
</rule>
</ruleset>

View file

@ -0,0 +1,9 @@
services:
-
class: TheCodingMachine\Safe\PHPStan\Rules\UseSafeFunctionsRule
tags:
- phpstan.rules.rule
-
class: TheCodingMachine\Safe\PHPStan\Type\Php\ReplaceSafeFunctionsDynamicReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension

View file

@ -0,0 +1,4 @@
parameters:
ignoreErrors:
includes:
- phpstan-safe-rule.neon

View file

@ -0,0 +1,36 @@
<phpunit
bootstrap="tests/bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite name="Test suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<logging>
<log
type="coverage-text"
target="php://stdout"
showUncoveredFiles="true"
showOnlySummary="true"
/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

View file

@ -0,0 +1,43 @@
<?php
namespace TheCodingMachine\Safe\PHPStan\Rules;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Rules\Rule;
use PHPStan\ShouldNotHappenException;
use TheCodingMachine\Safe\PHPStan\Utils\FunctionListLoader;
/**
* This rule checks that no superglobals are used in code.
*/
class UseSafeFunctionsRule implements Rule
{
public function getNodeType(): string
{
return Node\Expr\FuncCall::class;
}
/**
* @param Node\Expr\FuncCall $node
* @param \PHPStan\Analyser\Scope $scope
* @return string[]
*/
public function processNode(Node $node, Scope $scope): array
{
if (!$node->name instanceof Node\Name) {
return [];
}
$functionName = $node->name->toString();
$unsafeFunctions = FunctionListLoader::getFunctionList();
if (isset($unsafeFunctions[$functionName])) {
return ["Function $functionName is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\$functionName;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library."];
}
return [];
}
}

View file

@ -0,0 +1,79 @@
<?php declare(strict_types = 1);
namespace TheCodingMachine\Safe\PHPStan\Type\Php;
use PhpParser\Node\Expr\FuncCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\ArrayType;
use PHPStan\Type\DynamicFunctionReturnTypeExtension;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\TypeUtils;
class ReplaceSafeFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
/** @var array<string, int> */
private $functions = [
'Safe\preg_replace' => 2,
];
public function isFunctionSupported(FunctionReflection $functionReflection): bool
{
return array_key_exists($functionReflection->getName(), $this->functions);
}
public function getTypeFromFunctionCall(
FunctionReflection $functionReflection,
FuncCall $functionCall,
Scope $scope
): Type {
$type = $this->getPreliminarilyResolvedTypeFromFunctionCall($functionReflection, $functionCall, $scope);
$possibleTypes = ParametersAcceptorSelector::selectSingle($functionReflection->getVariants())->getReturnType();
if (TypeCombinator::containsNull($possibleTypes)) {
$type = TypeCombinator::addNull($type);
}
return $type;
}
private function getPreliminarilyResolvedTypeFromFunctionCall(
FunctionReflection $functionReflection,
FuncCall $functionCall,
Scope $scope
): Type {
$argumentPosition = $this->functions[$functionReflection->getName()];
if (count($functionCall->args) <= $argumentPosition) {
return ParametersAcceptorSelector::selectSingle($functionReflection->getVariants())->getReturnType();
}
$subjectArgumentType = $scope->getType($functionCall->args[$argumentPosition]->value);
$defaultReturnType = ParametersAcceptorSelector::selectSingle($functionReflection->getVariants())->getReturnType();
if ($subjectArgumentType instanceof MixedType) {
return TypeUtils::toBenevolentUnion($defaultReturnType);
}
$stringType = new StringType();
$arrayType = new ArrayType(new MixedType(), new MixedType());
$isStringSuperType = $stringType->isSuperTypeOf($subjectArgumentType);
$isArraySuperType = $arrayType->isSuperTypeOf($subjectArgumentType);
$compareSuperTypes = $isStringSuperType->compareTo($isArraySuperType);
if ($compareSuperTypes === $isStringSuperType) {
return $stringType;
} elseif ($compareSuperTypes === $isArraySuperType) {
if ($subjectArgumentType instanceof ArrayType) {
return $subjectArgumentType->generalizeValues();
}
return $subjectArgumentType;
}
return $defaultReturnType;
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace TheCodingMachine\Safe\PHPStan\Utils;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection;
class FunctionListLoader
{
private static $functions;
/**
* @return string[]
*/
public static function getFunctionList(): array
{
if (self::$functions === null) {
if (\file_exists(__DIR__.'/../../../safe/generated/functionsList.php')) {
$functions = require __DIR__.'/../../../safe/generated/functionsList.php';
} elseif (\file_exists(__DIR__.'/../../vendor/thecodingmachine/safe/generated/functionsList.php')) {
$functions = require __DIR__.'/../../vendor/thecodingmachine/safe/generated/functionsList.php';
} else {
throw new \RuntimeException('Could not find thecodingmachine/safe\'s functionsList.php file.');
}
// Let's index these functions by their name
self::$functions = \Safe\array_combine($functions, $functions);
}
return self::$functions;
}
}

View file

@ -0,0 +1,42 @@
<?php
namespace TheCodingMachine\Safe\PHPStan\Rules;
use PHPStan\Rules\FunctionCallParametersCheck;
use PHPStan\Rules\Methods\CallMethodsRule;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Testing\RuleTestCase;
use TheCodingMachine\Safe\PHPStan\Type\Php\ReplaceSafeFunctionsDynamicReturnTypeExtension;
class CallMethodRuleTest extends RuleTestCase
{
protected function getRule(): Rule
{
$broker = $this->createBroker();
$ruleLevelHelper = new RuleLevelHelper($broker, true, true, true);
return new CallMethodsRule(
$broker,
new FunctionCallParametersCheck($ruleLevelHelper, true, true),
$ruleLevelHelper,
true,
true
);
}
public function testSafePregReplace()
{
// FIXME: this rule actually runs code but will always return no error because the rule executed is not the correct one.
// This provides code coverage but assert is not ok.
$this->analyse([__DIR__ . '/data/safe_pregreplace.php'], []);
}
/**
* @return \PHPStan\Type\DynamicFunctionReturnTypeExtension[]
*/
public function getDynamicFunctionReturnTypeExtensions(): array
{
return [new ReplaceSafeFunctionsDynamicReturnTypeExtension()];
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace TheCodingMachine\Safe\PHPStan\Rules;
use PHPStan\Testing\RuleTestCase;
use TheCodingMachine\Safe\PHPStan\Type\Php\ReplaceSafeFunctionsDynamicReturnTypeExtension;
class UseSafeFunctionsRuleTest extends RuleTestCase
{
protected function getRule(): \PHPStan\Rules\Rule
{
return new UseSafeFunctionsRule();
}
public function testCatch()
{
$this->analyse([__DIR__ . '/data/fopen.php'], [
[
"Function fopen is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\fopen;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library.",
4,
],
]);
}
public function testNoCatchSafe()
{
$this->analyse([__DIR__ . '/data/safe_fopen.php'], []);
}
public function testExprCall()
{
$this->analyse([__DIR__ . '/data/undirect_call.php'], []);
}
}

View file

@ -0,0 +1,5 @@
<?php
function foo() {
$fp = fopen('foobar', 'r');
}

View file

@ -0,0 +1,6 @@
<?php
use function Safe\fopen;
function foo() {
$fp = fopen('foobar', 'r');
}

View file

@ -0,0 +1,7 @@
<?php
use function Safe\preg_replace;
$x = preg_replace('/foo/', 'bar', 'baz');
$y = stripos($x, 'foo');
$x = preg_replace(['/foo/'], ['bar'], ['baz']);

View file

@ -0,0 +1,5 @@
<?php
function foo() {
$toto = 'fopen';
$toto('foobar', 'r');
}

View file

@ -0,0 +1,15 @@
<?php
namespace TheCodingMachine\Safe\PHPStan\Utils;
use PHPUnit\Framework\TestCase;
class FunctionListLoaderTest extends TestCase
{
public function testGetFunctionList()
{
$functions = FunctionListLoader::getFunctionList();
$this->assertArrayHasKey('fopen', $functions);
}
}

View file

@ -0,0 +1,33 @@
<?php declare(strict_types=1);
use Nette\Configurator;
require_once __DIR__ . '/../vendor/autoload.php';
/*require_once __DIR__ . '/TestCase.php';
require_once __DIR__ . '/PHPStan/Rules/AbstractRuleTest.php';
require_once __DIR__ . '/PHPStan/Rules/AlwaysFailRule.php';
require_once __DIR__ . '/PHPStan/Rules/DummyRule.php';*/
/*
$rootDir = __DIR__ . '/..';
$tmpDir = $rootDir . '/tmp';
$confDir = $rootDir . '/vendor/phpstan/phpstan/conf';
$configurator = new Configurator();
$configurator->defaultExtensions = [];
$configurator->setDebugMode(true);
$configurator->setTempDirectory($tmpDir);
$configurator->addConfig($confDir . '/config.neon');
$configurator->addConfig($confDir . '/config.level5.neon');
$configurator->addParameters([
'rootDir' => $rootDir,
'tmpDir' => $tmpDir,
'currentWorkingDirectory' => $rootDir,
'cliArgumentsVariablesRegistered' => false,
]);
$container = $configurator->createContainer();
PHPStan\Testing\TestCase::setContainer($container);
PHPStan\Type\TypeCombinator::setUnionTypesEnabled(true);
require_once __DIR__ . '/phpstan-bootstrap.php';
*/

View file

@ -0,0 +1,4 @@
<?php declare(strict_types=1);
class_alias(\ReturnTypes\Foo::class, \ReturnTypes\FooAlias::class, true);
class_alias(\TestAccessProperties\FooAccessProperties::class, \TestAccessProperties\FooAccessPropertiesAlias::class, true);

View file

@ -0,0 +1,59 @@
language: php
matrix:
include:
- php: 7.3
env: PREFER_LOWEST=""
- php: 7.2
env: PREFER_LOWEST=""
- php: 7.1
env: PREFER_LOWEST=""
cache:
directories:
- generator/doc/doc-en
- vendor
- generator/vendor
- $HOME/.composer
before_script:
- cd generator && composer install --no-interaction && cd ..
- |
if [ ! -d "generator/doc/doc-en/en" ]; then
cd generator/doc
svn co https://svn.php.net/repository/phpdoc/modules/doc-en doc-en
cd ../..
else
cd generator/doc/doc-en
svn update
if [ $? -ne 0 ];
then
cd ..
rm -rf doc-en
svn co https://svn.php.net/repository/phpdoc/modules/doc-en doc-en
cd doc-en
fi
cd ../../..
fi
- composer update
script:
- cd generator && ./vendor/bin/phpunit && cd ..
- cd generator && composer cs-check && cd ..
- cd generator && composer phpstan && cd ..
- composer dump-autoload
- composer cs-check
- composer phpstan
# Now, let's regenerate all files and see if we obtain the same set of files as the ones commited:
- cd generator && ./safe.php generate && cd ..
- |
if output=$(git status --porcelain) && [ -z "$output" ]; then
# all is good
echo "Generated files are the same as committed file: OK"
else
# Uncommitted changes
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
exit 1;
fi
after_script:
- cd generator && travis_retry php vendor/bin/php-coveralls -v

View file

@ -0,0 +1,38 @@
# Contributing
Safe-PHP code is generated automatically from the PHP doc.
## How to install Safe-PHP development environment
The first step is to download the PHP documentation project locally.
You will need Subversion (svn) installed on your computer.
```bash
$ cd generator/doc
$ svn co https://svn.php.net/repository/phpdoc/modules/doc-en doc-en
$ cd ../..
```
At any point, if you want to update the documentation to the latest version, you can use:
```bash
$ cd generator/doc/doc-en
$ svn update
```
### Generating the functions
Generating the functions can be done with a simple command.
```bash
$ cd generator
$ php ./safe.php generate
```
### Submitting a PR
The continuous integration hooks will regenerate all the functions and check that the result is exactly what has been
committed. Therefore, before submitting a PR, please:
- Perform a "svn update"
- Regenerate the files using `php ./safe.php generate`

21
vendor/thecodingmachine/safe/LICENSE vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 TheCodingMachine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

174
vendor/thecodingmachine/safe/README.md vendored Normal file
View file

@ -0,0 +1,174 @@
[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/safe/v/stable.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![Total Downloads](https://poser.pugx.org/thecodingmachine/safe/downloads.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/safe/v/unstable.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![License](https://poser.pugx.org/thecodingmachine/safe/license.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![Build Status](https://travis-ci.org/thecodingmachine/safe.svg?branch=master)](https://travis-ci.org/thecodingmachine/safe)
[![Coverage Status](https://coveralls.io/repos/thecodingmachine/safe/badge.svg?branch=master&service=github)](https://coveralls.io/github/thecodingmachine/safe?branch=master)
Safe PHP
========
**Work in progress**
A set of core PHP functions rewritten to throw exceptions instead of returning `false` when an error is encountered.
## The problem
Most PHP core functions were written before exception handling was added to the language. Therefore, most PHP functions
do not throw exceptions. Instead, they return `false` in case of error.
But most of us are too lazy to check explicitly for every single return of every core PHP function.
```php
// This code is incorrect. Twice.
// "file_get_contents" can return false if the file does not exists
// "json_decode" can return false if the file content is not valid JSON
$content = file_get_contents('foobar.json');
$foobar = json_decode($content);
```
The correct version of this code would be:
```php
$content = file_get_contents('foobar.json');
if ($content === false) {
throw new FileLoadingException('Could not load file foobar.json');
}
$foobar = json_decode($content);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new FileLoadingException('foobar.json does not contain valid JSON: '.json_last_error_msg());
}
```
Obviously, while this snippet is correct, it is less easy to read.
## The solution
Enter *thecodingmachine/safe* aka Safe-PHP.
Safe-PHP redeclares all core PHP functions. The new PHP functions act exactly as the old ones, except they
throw exceptions properly when an error is encountered. The "safe" functions have the same name as the core PHP
functions, except they are in the `Safe` namespace.
```php
use function Safe\file_get_contents;
use function Safe\json_decode;
// This code is both safe and simple!
$content = file_get_contents('foobar.json');
$foobar = json_decode($content);
```
## PHPStan integration
> Yeah... but I must explicitly think about importing the "safe" variant of the function, for each and every file of my application.
> I'm sure I will forget some "use function" statements!
Fear not! thecodingmachine/safe comes with a PHPStan rule.
Never heard of [PHPStan](https://github.com/phpstan/phpstan) before?
Check it out, it's an amazing code analyzer for PHP.
Simply install the Safe rule in your PHPStan setup (explained in the "Installation" section) and PHPStan will let you know each time you are using an "unsafe" function.
The code below will trigger this warning:
```php
$content = file_get_contents('foobar.json');
```
> Function file_get_contents is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\file_get_contents;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library.
## Installation
Use composer to install Safe-PHP:
```bash
$ composer require thecodingmachine/safe
```
*Highly recommended*: install PHPStan and PHPStan extension:
```bash
$ composer require --dev thecodingmachine/phpstan-safe-rule
```
Now, edit your `phpstan.neon` file and add these rules:
```yml
includes:
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
```
## Automated refactoring
You have a large legacy codebase and want to use "Safe-PHP" functions throughout your project? PHPStan will help you
find these functions but changing the namespace of the functions one function at a time might be a tedious task.
Fortunately, Safe comes bundled with a "Rector" configuration file. [Rector](https://github.com/rectorphp/rector) is a command-line
tool that performs instant refactoring of your application.
First, you need to install Rector:
```bash
$ composer require --dev rector/rector ^0.3
```
Now, you simply need to run Rector with this command:
```bash
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate.yml
```
*Note:* do not forget to replace "src/" with the path to your source directory.
**Important:** the refactoring only performs a "dumb" replacement of functions. It will not modify the way
"false" return values are handled. So if your code was already performing error handling, you will have to deal
with it manually.
Especially, you should look for error handling that was already performed, like:
```php
if (!mkdir($dirPath)) {
// Do something on error
}
```
This code will be refactored by Rector to:
```php
if (!\Safe\mkdir($dirPath)) {
// Do something on error
}
```
You should then (manually) refactor it to:
```php
try {
\Safe\mkdir($dirPath));
} catch (\Safe\FilesystemException $e) {
// Do something on error
}
```
## Performance impact
Safe is loading 1000+ functions from ~85 files on each request. Yet, the performance impact of this loading is quite low.
In case you worry, using Safe will "cost" you ~700µs on each request. The [performance section](performance/README.md)
contains more information regarding the way we tested the performance impact of Safe.
## Work in progress
There are a number of pending issues [before releasing 1.0](https://github.com/thecodingmachine/safe/milestone/1)
## Learn more
Read [the release article on TheCodingMachine's blog](https://thecodingmachine.io/introducing-safe-php) if you want to
learn more about what triggered the development of Safe-PHP.
## Contributing
The files that contain all the functions are auto-generated from the PHP doc.
Read the [CONTRIBUTING.md](CONTRIBUTING.md) file to learn how to regenerate these files and to contribute to this library.

View file

@ -0,0 +1,120 @@
{
"name": "thecodingmachine/safe",
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"license": "MIT",
"autoload": {
"psr-4": {
"Safe\\": [
"lib/",
"generated/"
]
},
"files": [
"generated/apache.php",
"generated/apc.php",
"generated/apcu.php",
"generated/array.php",
"generated/bzip2.php",
"generated/classobj.php",
"generated/com.php",
"generated/cubrid.php",
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
"generated/fileinfo.php",
"generated/filesystem.php",
"generated/filter.php",
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
"generated/ibase.php",
"generated/ibmDb2.php",
"generated/iconv.php",
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/ingres-ii.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
"generated/libevent.php",
"generated/libxml.php",
"generated/lzf.php",
"generated/mailparse.php",
"generated/mbstring.php",
"generated/misc.php",
"generated/msql.php",
"generated/mssql.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/mysqlndMs.php",
"generated/mysqlndQc.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
"generated/openssl.php",
"generated/outcontrol.php",
"generated/password.php",
"generated/pcntl.php",
"generated/pcre.php",
"generated/pdf.php",
"generated/pgsql.php",
"generated/posix.php",
"generated/ps.php",
"generated/pspell.php",
"generated/readline.php",
"generated/rrd.php",
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/simplexml.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
"generated/ssdeep.php",
"generated/ssh2.php",
"generated/stats.php",
"generated/stream.php",
"generated/strings.php",
"generated/swoole.php",
"generated/uodbc.php",
"generated/uopz.php",
"generated/url.php",
"generated/var.php",
"generated/xdiff.php",
"generated/xml.php",
"generated/xmlrpc.php",
"generated/yaml.php",
"generated/yaz.php",
"generated/zip.php",
"generated/zlib.php",
"lib/special_cases.php"
]
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpstan/phpstan": "^0.10.3",
"thecodingmachine/phpstan-strict-rules": "^0.10.3",
"squizlabs/php_codesniffer": "^3.2"
},
"scripts": {
"phpstan": "phpstan analyse lib -c phpstan.neon --level=7 --no-progress -vvv",
"cs-fix": "phpcbf",
"cs-check": "phpcs"
},
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
}
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ApacheException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ApcException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ApcuException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ArrayException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class Bzip2Exception extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ClassobjException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ComException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class CubridException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class DatetimeException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class DirException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class EioException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ErrorfuncException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ExecException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FileinfoException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FilesystemException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FilterException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FpmException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FtpException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class FunchandException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class GmpException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class GnupgException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class HashException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class IbaseException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class IbmDb2Exception extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class IconvException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ImageException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ImapException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class InfoException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class IngresiiException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class InotifyException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class LdapException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class LibeventException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class LibxmlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class LzfException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MailparseException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MbstringException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MiscException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MsqlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MssqlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MysqlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MysqliException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MysqlndMsException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class MysqlndQcException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class NetworkException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class Oci8Exception extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class OpcacheException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class OpensslException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class OutcontrolException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PasswordException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PcntlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PdfException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PgsqlException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PosixException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PsException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class PspellException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ReadlineException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class RrdException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class SemException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class SessionException extends AbstractSafeException
{
}

View file

@ -0,0 +1,6 @@
<?php
namespace Safe\Exceptions;
class ShmopException extends AbstractSafeException
{
}

Some files were not shown because too many files have changed in this diff Show more