FriendsOfSymfony1 / symfony1

[DEPRECATED -- Use Symfony instead] Fork of symfony 1.4 with DIC, form enhancements, latest Swiftmailer, better performance, composer compatible and PHP 8 support
https://symfony.com/legacy
MIT License
337 stars 175 forks source link

[cs] introduce modern string functions #366

Open connorhu opened 3 months ago

connorhu commented 3 months ago

This PR is introduce the str_starts_with str_ends_with str_contains functions where is possible. It improves code readability and also php8 or above cause an improvement in performance.

Mostly automated fixes are done using Rector and php-cs-fixer. Relevant rector rules:

For php 7.4 symfony/polyfill-php80 provides backwards compatibility.

Template for rector:

<?php

use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([
        __DIR__.'/lib',
        __DIR__.'/test',
    ]);
    $rectorConfig->skip([
        __DIR__.'/lib/*/skeleton/*',
    ]);
connorhu commented 3 months ago

A skeleton jumped out of the closet. The problem is that the current codebase doesn't recognize and use the composer autoloader, everyone has to load it themselves (see migration wiki).

connorhu commented 3 months ago

I am not sure.

Indeed adding new dependency that requires the use of composer is a BC break.

As composer is not yet required.

Yes, this is a valid point. This is indeed a BC break in the sense that there was no composer req. before (although we support it). I don't see this as a problem in the sense that composer is no cutting edge today and this change is more about bringing practices that have become standard.

On the other hand, due to limited maintenance resources, I would also remove PEAR and the now-defunct symfony plugin installer.