@@ -216,11 +216,11 @@ public function createLM( $text, $maxNgrams ) {
216216 }
217217 if ( $ this ->minFreq ) {
218218 $ min = $ this ->minFreq ;
219- $ ngram = array_filter ( $ ngram , function ( $ v ) use ( $ min ) {
219+ $ ngram = array_filter ( $ ngram , static function ( $ v ) use ( $ min ) {
220220 return $ v > $ min ;
221221 } );
222222 }
223- uksort ( $ ngram , function ( $ k1 , $ k2 ) use ( $ ngram ) {
223+ uksort ( $ ngram , static function ( $ k1 , $ k2 ) use ( $ ngram ) {
224224 if ( $ ngram [$ k1 ] == $ ngram [$ k2 ] ) {
225225 return strcmp ( $ k1 , $ k2 );
226226 }
@@ -254,7 +254,7 @@ public function writeLanguageFile( $ngrams, $outfile ) {
254254 fwrite ( $ out , '<?php $ngrams = ' . var_export ( $ ngrams , true ) . "; \n" );
255255 // write reduced array as "$ranks"
256256 $ rank = 1 ;
257- $ ranks = array_map ( function ( $ x ) use ( &$ rank ) {
257+ $ ranks = array_map ( static function ( $ x ) use ( &$ rank ) {
258258 return $ rank ++;
259259 }, $ ngrams );
260260 fwrite ( $ out , '$ranks = ' . var_export ( $ ranks , true ) . "; \n" );
@@ -307,7 +307,7 @@ public function classify( $text, $candidates = null ) {
307307
308308 // ignore any item that scores higher than best * resultsRatio
309309 $ max = reset ( $ results ) * $ this ->resultsRatio ;
310- $ results = array_filter ( $ results , function ( $ res ) use ( $ max ) {
310+ $ results = array_filter ( $ results , static function ( $ res ) use ( $ max ) {
311311 return $ res <= $ max ;
312312 } );
313313
@@ -319,7 +319,7 @@ public function classify( $text, $candidates = null ) {
319319
320320 // filter max proportion of max score after ambiguity check; reuse $max variable
321321 $ max = count ( $ inputgrams ) * $ this ->maxNgrams * $ this ->maxProportion ;
322- $ results = array_filter ( $ results , function ( $ res ) use ( $ max ) {
322+ $ results = array_filter ( $ results , static function ( $ res ) use ( $ max ) {
323323 return $ res <= $ max ;
324324 } );
325325
0 commit comments