Use phpstan-deprecation-rules instead (#13582)
* Replace deprecated functions * Use phpstan-deprecation-rules instead
This commit is contained in:
parent
9d2633bf09
commit
29bdfe40a3
|
@ -75,7 +75,7 @@ class FilePermissionsException extends \Exception implements UpgradeableExceptio
|
|||
$content = str_replace('!!!!CONTENT!!!!', '<p>' . implode('</p><p>', $commands) . '</p>', $template);
|
||||
$content = str_replace('!!!!LOG_FILE!!!!', $log_file, $content);
|
||||
|
||||
return SymfonyResponse::create($content);
|
||||
return new SymfonyResponse($content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
"nunomaduro/collision": "^5.0",
|
||||
"nunomaduro/larastan": "^1.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.0",
|
||||
"phpstan/phpstan-mockery": "^1.0",
|
||||
"phpunit/phpunit": "^9.3.3",
|
||||
"spaze/phpstan-disallowed-calls": "^2.0",
|
||||
"staudenmeir/dusk-updater": "^1.1"
|
||||
},
|
||||
"suggest": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "643563ebf8b7fae69a556ac42e20bbf8",
|
||||
"content-hash": "15408329c31958767d7e83c43760020d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amenadiel/jpgraph",
|
||||
|
@ -10367,6 +10367,56 @@
|
|||
],
|
||||
"time": "2021-11-02T10:25:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-deprecation-rules",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
|
||||
"reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682",
|
||||
"reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"phpstan/phpstan": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"rules.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.0.0"
|
||||
},
|
||||
"time": "2021-09-23T11:02:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-mockery",
|
||||
"version": "1.0.0",
|
||||
|
@ -12015,63 +12065,6 @@
|
|||
},
|
||||
"time": "2021-08-19T21:01:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spaze/phpstan-disallowed-calls",
|
||||
"version": "v2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spaze/phpstan-disallowed-calls.git",
|
||||
"reference": "ff9fa0a0202badc83894168442ca8d323d408d61"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/ff9fa0a0202badc83894168442ca8d323d408d61",
|
||||
"reference": "ff9fa0a0202badc83894168442ca8d323d408d61",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"phpstan/phpstan": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nette/neon": "^3.2",
|
||||
"nikic/php-parser": "^4.13",
|
||||
"php-parallel-lint/php-console-highlighter": "^0.5.0",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpunit/phpunit": "^7.0 || ^9.4.2",
|
||||
"spaze/coding-standard": "^0.0"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spaze\\PHPStan\\Rules\\Disallowed\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michal Špaček",
|
||||
"email": "mail@michalspacek.cz",
|
||||
"homepage": "https://www.michalspacek.cz"
|
||||
}
|
||||
],
|
||||
"description": "Disallowed method and function calls plug-in for PHPStan",
|
||||
"support": {
|
||||
"issues": "https://github.com/spaze/phpstan-disallowed-calls/issues",
|
||||
"source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v2.0.0"
|
||||
},
|
||||
"time": "2021-11-01T07:25:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "staudenmeir/dusk-updater",
|
||||
"version": "v1.2.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* dbFacile - A Database API that should have existed from the start
|
||||
* Version 0.4.3
|
||||
*
|
||||
|
@ -15,6 +15,9 @@
|
|||
* 1. Connect to MySQL as you normally would ... this code uses an existing connection
|
||||
* 2. Use dbFacile as you normally would, without the object context
|
||||
* 3. Oh, and dbFetchAll() is now dbFetchRows()
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
|
@ -22,6 +25,10 @@ use LibreNMS\DB\Eloquent;
|
|||
use LibreNMS\Exceptions\DatabaseConnectException;
|
||||
use LibreNMS\Util\Laravel;
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbIsConnected()
|
||||
{
|
||||
return Eloquent::isConnected();
|
||||
|
@ -40,6 +47,9 @@ function dbIsConnected()
|
|||
* @return \Illuminate\Database\Connection
|
||||
*
|
||||
* @throws DatabaseConnectException
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbConnect($db_host = null, $db_user = '', $db_pass = '', $db_name = '', $db_port = null, $db_socket = null)
|
||||
{
|
||||
|
@ -85,6 +95,9 @@ function dbConnect($db_host = null, $db_user = '', $db_pass = '', $db_name = '',
|
|||
* @param string $sql
|
||||
* @param array $parameters
|
||||
* @return bool if query was successful or not
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#building-queries
|
||||
* @see https://laravel.com/docs/eloquent#building-queries
|
||||
*/
|
||||
function dbQuery($sql, $parameters = [])
|
||||
{
|
||||
|
@ -106,6 +119,9 @@ function dbQuery($sql, $parameters = [])
|
|||
* @param array $data
|
||||
* @param string $table
|
||||
* @return null|int
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
* @see https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
*/
|
||||
function dbInsert($data, $table)
|
||||
{
|
||||
|
@ -132,6 +148,9 @@ function dbInsert($data, $table)
|
|||
* @param array $data
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
* @see https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
*/
|
||||
function dbBulkInsert($data, $table)
|
||||
{
|
||||
|
@ -173,6 +192,9 @@ function dbBulkInsert($data, $table)
|
|||
* @param string $where
|
||||
* @param array $parameters
|
||||
* @return bool|int
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
* @see https://laravel.com/docs/eloquent#inserting-and-updating-models
|
||||
*/
|
||||
function dbUpdate($data, $table, $where = null, $parameters = [])
|
||||
{
|
||||
|
@ -211,6 +233,10 @@ function dbUpdate($data, $table, $where = null, $parameters = [])
|
|||
return false;
|
||||
}//end dbUpdate()
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#deleting-models
|
||||
* @see https://laravel.com/docs/eloquent#deleting-models
|
||||
*/
|
||||
function dbDelete($table, $where = null, $parameters = [])
|
||||
{
|
||||
$sql = 'DELETE FROM `' . $table . '`';
|
||||
|
@ -234,6 +260,9 @@ function dbDelete($table, $where = null, $parameters = [])
|
|||
* @param string $target_table The table to delete entries from
|
||||
* @param array $parents an array of parent tables to check.
|
||||
* @return bool|int
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent#deleting-models
|
||||
* @see https://laravel.com/docs/eloquent#deleting-models
|
||||
*/
|
||||
function dbDeleteOrphans($target_table, $parents)
|
||||
{
|
||||
|
@ -273,11 +302,13 @@ function dbDeleteOrphans($target_table, $parents)
|
|||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Fetches all of the rows (associatively) from the last performed query.
|
||||
* Most other retrieval functions build off this
|
||||
* */
|
||||
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbFetchRows($sql, $parameters = [])
|
||||
{
|
||||
global $PDO_FETCH_ASSOC;
|
||||
|
@ -296,11 +327,13 @@ function dbFetchRows($sql, $parameters = [])
|
|||
return [];
|
||||
}//end dbFetchRows()
|
||||
|
||||
/*
|
||||
/**
|
||||
* This is intended to be the method used for large result sets.
|
||||
* It is intended to return an iterator, and act upon buffered data.
|
||||
* */
|
||||
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbFetch($sql, $parameters = [])
|
||||
{
|
||||
return dbFetchRows($sql, $parameters);
|
||||
|
@ -316,11 +349,13 @@ function dbFetch($sql, $parameters = [])
|
|||
*/
|
||||
}//end dbFetch()
|
||||
|
||||
/*
|
||||
/**
|
||||
* Like fetch(), accepts any number of arguments
|
||||
* The first argument is an sprintf-ready query stringTypes
|
||||
* */
|
||||
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbFetchRow($sql = null, $parameters = [])
|
||||
{
|
||||
global $PDO_FETCH_ASSOC;
|
||||
|
@ -339,10 +374,12 @@ function dbFetchRow($sql = null, $parameters = [])
|
|||
return [];
|
||||
}//end dbFetchRow()
|
||||
|
||||
/*
|
||||
/**
|
||||
* Fetches the first call from the first row returned by the query
|
||||
* */
|
||||
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbFetchCell($sql, $parameters = [])
|
||||
{
|
||||
global $PDO_FETCH_ASSOC;
|
||||
|
@ -363,11 +400,13 @@ function dbFetchCell($sql, $parameters = [])
|
|||
return null;
|
||||
}//end dbFetchCell()
|
||||
|
||||
/*
|
||||
/**
|
||||
* This method is quite different from fetchCell(), actually
|
||||
* It fetches one cell from each row and places all the values in 1 array
|
||||
* */
|
||||
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbFetchColumn($sql, $parameters = [])
|
||||
{
|
||||
global $PDO_FETCH_ASSOC;
|
||||
|
@ -391,12 +430,14 @@ function dbFetchColumn($sql, $parameters = [])
|
|||
return [];
|
||||
}//end dbFetchColumn()
|
||||
|
||||
/*
|
||||
/**
|
||||
* Should be passed a query that fetches two fields
|
||||
* The first will become the array key
|
||||
* The second the key's value
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
|
||||
function dbFetchKeyValue($sql, $parameters = [])
|
||||
{
|
||||
$data = [];
|
||||
|
@ -421,6 +462,9 @@ function dbFetchKeyValue($sql, $parameters = [])
|
|||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbArrayToRaw($data)
|
||||
{
|
||||
|
@ -433,6 +477,10 @@ function dbArrayToRaw($data)
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbHandleException(QueryException $exception)
|
||||
{
|
||||
$message = $exception->getMessage();
|
||||
|
@ -467,6 +515,9 @@ function dbHandleException(QueryException $exception)
|
|||
*
|
||||
* @param array $values
|
||||
* @return array
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbPlaceHolders(&$values)
|
||||
{
|
||||
|
@ -486,16 +537,28 @@ function dbPlaceHolders(&$values)
|
|||
return $data;
|
||||
}//end dbPlaceHolders()
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbBeginTransaction()
|
||||
{
|
||||
Eloquent::DB()->beginTransaction();
|
||||
}//end dbBeginTransaction()
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbCommitTransaction()
|
||||
{
|
||||
Eloquent::DB()->commit();
|
||||
}//end dbCommitTransaction()
|
||||
|
||||
/**
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbRollbackTransaction()
|
||||
{
|
||||
Eloquent::DB()->rollBack();
|
||||
|
@ -507,6 +570,9 @@ function dbRollbackTransaction()
|
|||
*
|
||||
* @param $count
|
||||
* @return string placholder list
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbGenPlaceholders($count)
|
||||
{
|
||||
|
@ -522,6 +588,9 @@ function dbGenPlaceholders($count)
|
|||
* @param string $list_column related column names
|
||||
* @param array $list list of related ids
|
||||
* @return array [$inserted, $deleted]
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbSyncRelationship($table, $target_column = null, $target = null, $list_column = null, $list = null)
|
||||
{
|
||||
|
@ -552,6 +621,9 @@ function dbSyncRelationship($table, $target_column = null, $target = null, $list
|
|||
* @param string $table
|
||||
* @param array $relationships array of relationship pairs with columns as keys and ids as values
|
||||
* @return array [$inserted, $deleted]
|
||||
*
|
||||
* @deprecated Please use Eloquent instead; https://laravel.com/docs/eloquent
|
||||
* @see https://laravel.com/docs/eloquent
|
||||
*/
|
||||
function dbSyncRelationships($table, $relationships = [])
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,9 @@
|
|||
includes:
|
||||
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
|
||||
- phpstan-baseline-deprecated.neon
|
||||
- vendor/spaze/phpstan-disallowed-calls/extension.neon
|
||||
|
||||
parameters:
|
||||
phpVersion: 70300
|
||||
|
||||
customRulesetUsed: true
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
|
@ -25,8 +26,3 @@ parameters:
|
|||
- routes
|
||||
- sql-schema
|
||||
- tests
|
||||
|
||||
disallowedFunctionCalls:
|
||||
-
|
||||
function: 'db*()'
|
||||
message: 'use Eloquent instead; https://laravel.com/docs/8.x/eloquent'
|
||||
|
|
|
@ -114,7 +114,7 @@ class SchemaTest extends TestCase
|
|||
// use a Mock so we don't have to rely on the schema being stable.
|
||||
|
||||
$schema = $this->getMockBuilder(Schema::class)
|
||||
->setMethods(['getSchema'])
|
||||
->onlyMethods(['getSchema'])
|
||||
->getMock();
|
||||
|
||||
$schema->method('getSchema')->willReturn($this->mock_schema);
|
||||
|
|
Loading…
Reference in New Issue