Skip to content

Commit

Permalink
Fix PHP5.3 compatibility
Browse files Browse the repository at this point in the history
Ah, those ugly workarounds...
Fixes #208
  • Loading branch information
matthiasmullie committed Oct 25, 2017
1 parent f091f3b commit 73d5304
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/JS.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ public function execute($path = null)

/**
* Strip comments from source code.
*
* Public method so it can be accessed from inside the closure in
* extractRegex. Once PHP5.3 compatibility is dropped, we can make this
* method protected again.
*/
protected function stripComments()
public function stripComments()
{
// single-line comments
$this->registerPattern('/\/\/.*$/m', '');
Expand Down Expand Up @@ -605,4 +609,26 @@ protected function shortenBools($content)

return $content;
}

/**
* Protected method in parent made public, so it can be accessed from inside
* the closure in extractRegex. Once PHP5.3 compatibility is dropped, we can
* remove this.
*
* {@inheritdoc}
*/
public function extractStrings($chars = '\'"', $placeholderPrefix = '') {
parent::extractStrings($chars, $placeholderPrefix);
}

/**
* Protected method in parent made public, so it can be accessed from inside
* the closure in extractRegex. Once PHP5.3 compatibility is dropped, we can
* remove this.
*
* {@inheritdoc}
*/
public function replace($content) {
return parent::replace($content);
}
}

0 comments on commit 73d5304

Please sign in to comment.