diff --git a/core/lib/Drupal/Component/Utility/Html.php b/core/lib/Drupal/Component/Utility/Html.php
index 5456cfaaf32..9505d23c5b3 100644
--- a/core/lib/Drupal/Component/Utility/Html.php
+++ b/core/lib/Drupal/Component/Utility/Html.php
@@ -449,10 +449,11 @@ public static function escape($text) {
    *   The updated (X)HTML snippet.
    */
   public static function transformRootRelativeUrlsToAbsolute($html, $scheme_and_host) {
-    assert('empty(array_diff(array_keys(parse_url($scheme_and_host)), ["scheme", "host", "port"]))', '$scheme_and_host contains scheme, host and port at most.');
-    assert('isset(parse_url($scheme_and_host)["scheme"])', '$scheme_and_host is absolute and hence has a scheme.');
-    assert('isset(parse_url($scheme_and_host)["host"])', '$base_url is absolute and hence has a host.');
-
+    if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 || assert_options(ASSERT_ACTIVE)) {
+      assert(empty(array_diff(array_keys(parse_url($scheme_and_host)), ["scheme", "host", "port"])), '$scheme_and_host contains scheme, host and port at most.');
+      assert(isset(parse_url($scheme_and_host)["scheme"]), '$scheme_and_host is absolute and hence has a scheme.');
+      assert(isset(parse_url($scheme_and_host)["host"]), '$base_url is absolute and hence has a host.');
+    }
     $html_dom = Html::load($html);
     $xpath = new \DOMXpath($html_dom);
 
diff --git a/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php
index d87872a0a34..4d1115bcfe6 100644
--- a/core/lib/Drupal/Core/Access/AccessResult.php
+++ b/core/lib/Drupal/Core/Access/AccessResult.php
@@ -39,7 +39,7 @@
    *   isNeutral() will be TRUE.
    */
   public static function neutral($reason = NULL) {
-    assert('is_string($reason) || is_null($reason)');
+    assert(is_string($reason) || is_null($reason));
     return new AccessResultNeutral($reason);
   }
 
@@ -64,7 +64,7 @@ public static function allowed() {
    *   isForbidden() will be TRUE.
    */
   public static function forbidden($reason = NULL) {
-    assert('is_string($reason) || is_null($reason)');
+    assert(is_string($reason) || is_null($reason));
     return new AccessResultForbidden($reason);
   }
 
diff --git a/core/lib/Drupal/Core/Cache/ApcuBackend.php b/core/lib/Drupal/Core/Cache/ApcuBackend.php
index 5338a747af9..b13f729a590 100644
--- a/core/lib/Drupal/Core/Cache/ApcuBackend.php
+++ b/core/lib/Drupal/Core/Cache/ApcuBackend.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Core\Cache;
 
+use Drupal\Component\Assertion\Inspector;
+
 /**
  * Stores cache items in the Alternative PHP Cache User Cache (APCu).
  */
@@ -161,7 +163,10 @@ protected function prepareItem($cache, $allow_invalid) {
    * {@inheritdoc}
    */
   public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) {
-    assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)', 'Cache tags must be strings.');
+    if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 || assert_options(ASSERT_ACTIVE)) {
+      assert(Inspector::assertAllStrings($tags), 'Cache tags must be strings.');
+    }
+
     $tags = array_unique($tags);
     $cache = new \stdClass();
     $cache->cid = $cid;
diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php
index d905132894e..6edfb1096a7 100644
--- a/core/lib/Drupal/Core/Cache/Cache.php
+++ b/core/lib/Drupal/Core/Cache/Cache.php
@@ -3,6 +3,7 @@
 namespace Drupal\Core\Cache;
 
 use Drupal\Core\Database\Query\SelectInterface;
+use Drupal\Component\Assertion\Inspector;
 
 /**
  * Helper methods for cache.
@@ -29,7 +30,9 @@ class Cache {
    */
   public static function mergeContexts(array $a = [], array $b = []) {
     $cache_contexts = array_unique(array_merge($a, $b));
-    assert('\Drupal::service(\'cache_contexts_manager\')->assertValidTokens($cache_contexts)');
+    if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 || assert_options(ASSERT_ACTIVE)) {
+      assert(\Drupal::service('cache_contexts_manager')->assertValidTokens($cache_contexts));
+    }
     sort($cache_contexts);
     return $cache_contexts;
   }
@@ -54,7 +57,9 @@ public static function mergeContexts(array $a = [], array $b = []) {
    *   The merged array of cache tags.
    */
   public static function mergeTags(array $a = [], array $b = []) {
-    assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($a) && \Drupal\Component\Assertion\Inspector::assertAllStrings($b)', 'Cache tags must be valid strings');
+    if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 || assert_options(ASSERT_ACTIVE)) {
+      assert(Inspector::assertAllStrings($a) && Inspector::assertAllStrings($b), 'Cache tags must be valid strings');
+    }
 
     $cache_tags = array_unique(array_merge($a, $b));
     sort($cache_tags);
