mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Wrap CallbackFilterIterator in a condition check
Wrap the CallbackFilterIterator backport class in a conditional check for PHP runtimes that include the class natively. This really should only be needed for linting as the class is loaded via an autoloader and thus should not be loaded if the runtime already has it available. Bug: T124828 Change-Id: I39d27385186d4693a8babdd2b818e6b4bc16255a
This commit is contained in:
parent
e28a912c3b
commit
3f7436c959
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"parallel-lint . --exclude vendor --exclude includes/iterator/CallbackFilterIterator.php",
|
||||
"parallel-lint . --exclude vendor",
|
||||
"phpcs"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
// T124828: conditional is a linter compatibility hack
|
||||
if ( !class_exists( 'CallbackFilterIterator' ) ) {
|
||||
/**
|
||||
* This class is implemented as part of SPL starting at PHP5.4. This
|
||||
* re-implementation provides backwards compatibility to mediawiki
|
||||
* running on PHP5.3.
|
||||
*/
|
||||
class CallbackFilterIterator extends FilterIterator {
|
||||
class CallbackFilterIterator extends FilterIterator {
|
||||
protected $callback;
|
||||
|
||||
public function __construct( Iterator $iterator, $callback ) {
|
||||
|
@ -21,4 +23,5 @@ class CallbackFilterIterator extends FilterIterator {
|
|||
$this->getInnerIterator()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue