Project

General

Profile

Actions

Task #61788

closed

Use fully class name resolution in PHP 5.5

Added by Xavier Perseguers about 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Code Cleanup
Target version:
-
Start date:
2014-09-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7.0
PHP Version:
5.5
Tags:
Complexity:
Sprint Focus:

Description

Since PHP 5.5 is a requirement, calls to GeneralUtility::makeInstance should use the ::class construct instead of a string.

rewrite.php

<?php
$fileName = $argv[1];
$contents = file_get_contents($fileName);

$contents = preg_replace_callback(
    "/::makeInstance\\('([^']+)'/",
    function ($matches) {
        return '::makeInstance(\\' . str_replace('\\\\', '\\', $matches[1]) . '::class';
    },
    $contents
);

file_put_contents($fileName, $contents);

Command

$ for f in $(grep -sr "::makeInstance(" * | cut -d: -f1 | egrep ".php$" | grep -v "rewrite.php" | sort -u); do php rewrite.php $f; done

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #61969: Adjust TRAVIS settings to new requirements for version 7ClosedMarkus Klein2014-09-30

Actions
Actions

Also available in: Atom PDF