got an error when i use "new \SQLite3(xxx)"
when i use sqlite3 in the format of "\SQLite3",php-compatibility display an error said "Extension 'sqlite' is removed since PHP 5.4".
Can you provide a code sample ?
Regarding solution direction - maybe the sniff should check the value for being exactly the same as the deprecated extension òr the same + _ ?
I'd need to check whether all deprecated extensions use an underscore as a separator to be sure whether this would be a viable solution.
<?php
namespace Mynamespace;
class MyClass {
public function __construct() {
$db = new \SQLite3('test.db');
}
}
and then i get an error said 8 | ERROR | Extension 'sqlite' is removed since PHP 5.4.
if i change the $db = new \SQLite3('test.db'); to $db = new SQLite3('test.db');, the error will gone.
I'm looking into this, but it may still be a little while before I have time to finish the work needed for this.
Related #209, #582
Here's more code that triggers this bogus notice:
new Db\Sqlite();
new Db\Sqlite3();
so apparently it doesn't even check user classes from different namespaces.
This sniff is far too overzealous, simply doing string matches for function names or class names that contain the name of the extension. It's annoying to have to disable it manually.
Still, to do so in a custom phpcs.xml or similar:
<!-- Ruleset includes -->
<rule ref="PHPCompatibility">
<!-- This sniff is very overzealous and inaccurate, so we'll disable it -->
<exclude name="PHPCompatibility.Extensions.RemovedExtensions"/>
</rule>
Looking forward to all the work in #1022 getting a release.
Well, we're still working on PHPCompatibility 10.0.0, but all the prep work for #1022 has already been done. Fingers crossed we'll have a (huge) release in about a month or so.