Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.0: NewClasses: add yet more new classes #1246

Merged
merged 3 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,14 @@ class NewClassesSniff extends AbstractNewFeatureSniff
],
/*
See: https://bugs.php.net/bug.php?id=79625
'OCI-Collection' => array(
'OCI-Collection' => [
'4.4' => false,
'5.0' => true,
),
'OCI-Lob' => array(
],
'OCI-Lob' => [
'4.4' => false,
'5.0' => true,
),
],
*/

'libXMLError' => [
Expand Down Expand Up @@ -747,10 +747,22 @@ class NewClassesSniff extends AbstractNewFeatureSniff
'7.4' => false,
'8.0' => true,
],
'ReflectionUnionType' => [
'7.4' => false,
'8.0' => true,
],
'WeakMap' => [
'7.4' => false,
'8.0' => true,
],
'OCICollection' => [
'7.4' => false,
'8.0' => true,
],
'OCILob' => [
'7.4' => false,
'8.0' => true,
],
];

/**
Expand Down Expand Up @@ -958,6 +970,10 @@ class NewClassesSniff extends AbstractNewFeatureSniff
'extension' => 'ffi',
],

'UnhandledMatchError' => [
'7.4' => false,
'8.0' => true,
],
'ValueError' => [
'7.4' => false,
'8.0' => true,
Expand Down
11 changes: 11 additions & 0 deletions PHPCompatibility/Sniffs/Classes/RemovedClassesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ class RemovedClassesSniff extends AbstractRemovedFeatureSniff
'8.0' => true,
'extension' => 'xmlrpc',
],
/*
See: https://bugs.php.net/bug.php?id=79625
'OCI-Collection' => [
'8.0' => true,
'alternative' => 'OCICollection',
],
'OCI-Lob' => [
'8.0' => true,
'alternative' => 'OCILob',
],
*/
];

/**
Expand Down
30 changes: 15 additions & 15 deletions PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -2991,35 +2991,35 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
],
'ocicloselob' => [
'5.4' => false,
'alternative' => 'OCI-Lob::close()',
'alternative' => 'OCI-Lob::close() / OCILob::close() (PHP 8+)',
],
'ocicollappend' => [
'5.4' => false,
'alternative' => 'OCI-Collection::append()',
'alternative' => 'OCI-Collection::append() / OCICollection::append() (PHP 8+)',
],
'ocicollassign' => [
'5.4' => false,
'alternative' => 'OCI-Collection::assign()',
'alternative' => 'OCI-Collection::assign() / OCICollection::assign() (PHP 8+)',
],
'ocicollassignelem' => [
'5.4' => false,
'alternative' => 'OCI-Collection::assignElem()',
'alternative' => 'OCI-Collection::assignElem() / OCICollection::assignElem() (PHP 8+)',
],
'ocicollgetelem' => [
'5.4' => false,
'alternative' => 'OCI-Collection::getElem()',
'alternative' => 'OCI-Collection::getElem() / OCICollection::getElem() (PHP 8+)',
],
'ocicollmax' => [
'5.4' => false,
'alternative' => 'OCI-Collection::max()',
'alternative' => 'OCI-Collection::max() / OCICollection::max() (PHP 8+)',
],
'ocicollsize' => [
'5.4' => false,
'alternative' => 'OCI-Collection::size()',
'alternative' => 'OCI-Collection::size() / OCICollection::size() (PHP 8+)',
],
'ocicolltrim' => [
'5.4' => false,
'alternative' => 'OCI-Collection::trim()',
'alternative' => 'OCI-Collection::trim() / OCICollection::trim() (PHP 8+)',
],
'ocicolumnisnull' => [
'5.4' => false,
Expand Down Expand Up @@ -3079,15 +3079,15 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
],
'ocifreecollection' => [
'5.4' => false,
'alternative' => 'OCI-Collection::free()',
'alternative' => 'OCI-Collection::free() / OCICollection::free() (PHP 8+)',
],
'ocifreecursor' => [
'5.4' => false,
'alternative' => 'oci_free_statement()',
],
'ocifreedesc' => [
'5.4' => false,
'alternative' => 'OCI-Lob::free()',
'alternative' => 'OCI-Lob::free() / OCILob::free() (PHP 8+)',
],
'ocifreestatement' => [
'5.4' => false,
Expand All @@ -3100,7 +3100,7 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
],
'ociloadlob' => [
'5.4' => false,
'alternative' => 'OCI-Lob::load()',
'alternative' => 'OCI-Lob::load() / OCILob::load() (PHP 8+)',
],
'ocilogoff' => [
'5.4' => false,
Expand Down Expand Up @@ -3152,11 +3152,11 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
],
'ocisavelob' => [
'5.4' => false,
'alternative' => 'OCI-Lob::save()',
'alternative' => 'OCI-Lob::save() / OCILob::save() (PHP 8+)',
],
'ocisavelobfile' => [
'5.4' => false,
'alternative' => 'OCI-Lob::import()',
'alternative' => 'OCI-Lob::import() / OCILob::import() (PHP 8+)',
],
'ociserverversion' => [
'5.4' => false,
Expand All @@ -3172,11 +3172,11 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
],
'ociwritelobtofile' => [
'5.4' => false,
'alternative' => 'OCI-Lob::export()',
'alternative' => 'OCI-Lob::export() / OCILob::export() (PHP 8+)',
],
'ociwritetemporarylob' => [
'5.4' => false,
'alternative' => 'OCI-Lob::writeTemporary()',
'alternative' => 'OCI-Lob::writeTemporary() / OCILob::writeTemporary() (PHP 8+)',
],
'mysqli_get_cache_stats' => [
'5.4' => true,
Expand Down
9 changes: 9 additions & 0 deletions PHPCompatibility/Tests/Classes/NewClassesUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,12 @@ try {
throw new ValueError('Unknown type');
} catch (\ValueError $e) {
}

$type = new ReflectionUnionType();

$oci8 = new OCICollection();
$closure = function(OCILob $lob) {};

try {
} catch (UnhandledMatchError $e) {
}
8 changes: 6 additions & 2 deletions PHPCompatibility/Tests/Classes/NewClassesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public function dataNewClass()
['mysqli_driver', '4.4', [401], '5.0'],
['mysqli_warning', '4.4', [402], '5.0'],
// See: https://bugs.php.net/bug.php?id=79625
//array('OCI-Collection', '4.4', array(404), '5.0'),
//array('OCI-Lob', '4.4', array(405), '5.0'),
//['OCI-Collection', '4.4', [404], '5.0'],
//['OCI-Lob', '4.4', [405], '5.0'],

['libXMLError', '5.0', [61, 101, 141], '5.1'],
['PDO', '5.0', [314], '5.1'],
Expand Down Expand Up @@ -211,6 +211,9 @@ public function dataNewClass()
['WeakReference', '7.3', [345], '7.4'],
['PhpToken', '7.4', [415], '8.0'],
['WeakMap', '7.4', [412], '8.0'],
['ReflectionUnionType', '7.4', [422], '8.0'],
['OCICollection', '7.4', [424], '8.0'],
['OCILob', '7.4', [425], '8.0'],

['DATETIME', '5.1', [146], '5.2'],
['datetime', '5.1', [147, 320], '5.2'],
Expand Down Expand Up @@ -255,6 +258,7 @@ public function dataNewClass()
['JsonException', '7.2', [250, 339], '7.3'],
['FFI\Exception', '7.3', [349], '7.4'],
['FFI\ParserException', '7.3', [349], '7.4'],
['UnhandledMatchError', '7.4', [428], '8.0'],
['ValueError', '7.4', [418, 419], '8.0'],
];
}
Expand Down
30 changes: 15 additions & 15 deletions PHPCompatibility/Tests/FunctionUse/RemovedFunctionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ public function dataDeprecatedFunctionWithAlternative()
return [
['ocibindbyname', '5.4', 'oci_bind_by_name()', [41], '5.3'],
['ocicancel', '5.4', 'oci_cancel()', [42], '5.3'],
['ocicloselob', '5.4', 'OCI-Lob::close()', [43], '5.3'],
['ocicollappend', '5.4', 'OCI-Collection::append()', [44], '5.3'],
['ocicollassign', '5.4', 'OCI-Collection::assign()', [45], '5.3'],
['ocicollassignelem', '5.4', 'OCI-Collection::assignElem()', [46], '5.3'],
['ocicollgetelem', '5.4', 'OCI-Collection::getElem()', [47], '5.3'],
['ocicollmax', '5.4', 'OCI-Collection::max()', [48], '5.3'],
['ocicollsize', '5.4', 'OCI-Collection::size()', [49], '5.3'],
['ocicolltrim', '5.4', 'OCI-Collection::trim()', [50], '5.3'],
['ocicloselob', '5.4', 'OCI-Lob::close() / OCILob::close() (PHP 8+)', [43], '5.3'],
['ocicollappend', '5.4', 'OCI-Collection::append() / OCICollection::append() (PHP 8+)', [44], '5.3'],
['ocicollassign', '5.4', 'OCI-Collection::assign() / OCICollection::assign() (PHP 8+)', [45], '5.3'],
['ocicollassignelem', '5.4', 'OCI-Collection::assignElem() / OCICollection::assignElem() (PHP 8+)', [46], '5.3'],
['ocicollgetelem', '5.4', 'OCI-Collection::getElem() / OCICollection::getElem() (PHP 8+)', [47], '5.3'],
['ocicollmax', '5.4', 'OCI-Collection::max() / OCICollection::max() (PHP 8+)', [48], '5.3'],
['ocicollsize', '5.4', 'OCI-Collection::size() / OCICollection::size() (PHP 8+)', [49], '5.3'],
['ocicolltrim', '5.4', 'OCI-Collection::trim() / OCICollection::trim() (PHP 8+)', [50], '5.3'],
['ocicolumnisnull', '5.4', 'oci_field_is_null()', [51], '5.3'],
['ocicolumnname', '5.4', 'oci_field_name()', [52], '5.3'],
['ocicolumnprecision', '5.4', 'oci_field_precision()', [53], '5.3'],
Expand All @@ -138,11 +138,11 @@ public function dataDeprecatedFunctionWithAlternative()
['ociexecute', '5.4', 'oci_execute()', [61], '5.3'],
['ocifetch', '5.4', 'oci_fetch()', [62], '5.3'],
['ocifetchstatement', '5.4', 'oci_fetch_all()', [64], '5.3'],
['ocifreecollection', '5.4', 'OCI-Collection::free()', [65], '5.3'],
['ocifreecollection', '5.4', 'OCI-Collection::free() / OCICollection::free() (PHP 8+)', [65], '5.3'],
['ocifreecursor', '5.4', 'oci_free_statement()', [66], '5.3'],
['ocifreedesc', '5.4', 'OCI-Lob::free()', [67], '5.3'],
['ocifreedesc', '5.4', 'OCI-Lob::free() / OCILob::free() (PHP 8+)', [67], '5.3'],
['ocifreestatement', '5.4', 'oci_free_statement()', [68], '5.3'],
['ociloadlob', '5.4', 'OCI-Lob::load()', [70], '5.3'],
['ociloadlob', '5.4', 'OCI-Lob::load() / OCILob::load() (PHP 8+)', [70], '5.3'],
['ocilogoff', '5.4', 'oci_close()', [71], '5.3'],
['ocilogon', '5.4', 'oci_connect()', [72], '5.3'],
['ocinewcollection', '5.4', 'oci_new_collection()', [73], '5.3'],
Expand All @@ -155,13 +155,13 @@ public function dataDeprecatedFunctionWithAlternative()
['ociresult', '5.4', 'oci_result()', [80], '5.3'],
['ocirollback', '5.4', 'oci_rollback()', [81], '5.3'],
['ocirowcount', '5.4', 'oci_num_rows()', [82], '5.3'],
['ocisavelob', '5.4', 'OCI-Lob::save()', [83], '5.3'],
['ocisavelobfile', '5.4', 'OCI-Lob::import()', [84], '5.3'],
['ocisavelob', '5.4', 'OCI-Lob::save() / OCILob::save() (PHP 8+)', [83], '5.3'],
['ocisavelobfile', '5.4', 'OCI-Lob::import() / OCILob::import() (PHP 8+)', [84], '5.3'],
['ociserverversion', '5.4', 'oci_server_version()', [85], '5.3'],
['ocisetprefetch', '5.4', 'oci_set_prefetch()', [86], '5.3'],
['ocistatementtype', '5.4', 'oci_statement_type()', [87], '5.3'],
['ociwritelobtofile', '5.4', 'OCI-Lob::export()', [88], '5.3'],
['ociwritetemporarylob', '5.4', 'OCI-Lob::writeTemporary()', [89], '5.3'],
['ociwritelobtofile', '5.4', 'OCI-Lob::export() / OCILob::export() (PHP 8+)', [88], '5.3'],
['ociwritetemporarylob', '5.4', 'OCI-Lob::writeTemporary() / OCILob::writeTemporary() (PHP 8+)', [89], '5.3'],

['__autoload', '7.2', 'SPL autoload', [589], '7.1'],
['is_real', '7.4', 'is_float()', [239], '7.3'],
Expand Down