Are you doing things in the right order?

Response:

Check that the sequence in which processing is being performed is the correct sequence. Maybe you’ve got some code back to front.

if ( is_numeric( $matches ) ) {
  $matches = null;
  $this->limit = $matches;
}

Reference:

Related questions: