Tool to remove code based on specific comments.

Overview

PHP-DEL

Unit Test Latest Stable Version PHP Version Require License

Tool to remove code based on specific comments.

Configuration

Create php-del.json in the root directory of the project

{
  "dirs": [
    "src"
  ],
  "extensions": [
    "php"
  ]
}

dirs

Specify the directory to be searched for files.

extensions(Optional: Default php)

Specify the extension to be searched.

Usage

Add a comment with a flag for code like the following

public function code() {
    /** php-del start flag-a */
    $something = 1;
    /** php-del end flag-a */
}

You can use the composer command to erase the target code by specifying a flag.

/vendor/bin/php-del flag-a

Deletion result

public function code() {
}

Codes not covered

The ignore comment can be added to remove it from the deletion list.

public function code() {
    /** php-del start flag-a */
    $something = 1;
    /** php-del ignore start */
    $ignore = 2;
    /** php-del ignore end */
    /** php-del end flag-a */
}

Deletion result

public function code() {
    $ignore = 2;
}
Comments
  • php-del line で指定されている行が削除されない

    php-del line で指定されている行が削除されない

    root@f850d068851d:/var/www/html# vendor/bin/php-del
    Finding flag...
    Please choice me one of the following flag: (press <Enter> to select)
    ❯ ○ 2021_12_13_searchable_capital_investment (2)
    End php-del
    

    上記の通り認識はされているが、実際に削除はされない。

    opened by yamotuki 1
  • フラグ管理機能

    フラグ管理機能

    ~~php-del.jsonで次のように定義~~

    {
      "flags": [
        "flag-a",
        "flag-b"
      ]
    }
    

    ~~コマンド実行時にオプションでフラグを渡さない場合はこのリストから選択できるようにする 実行後は自動的にphp-del.jsonから対象のフラグを消す~~

    opened by kubotak-is 1
  • 期待通りの挙動にならないケース

    期待通りの挙動にならないケース

    以下のケースが行ごと消える

    'scheme' => /** php-del start flag */ \Flag::isA() ? /** php-del ignore start */$this->display()/** php-del ignore end */ : null/** php-del end flag */,
    
    opened by kubotak-is 0
  • コメントの範囲を誤認するパターン

    コメントの範囲を誤認するパターン

    コメントが連続する場合のような以下のパターン

    // php-del start flag
    ...something
    // php-del end flag
    // FYI hoge
    

    結果

    / FYI hoge
    

    試してないが多分以下のパターンも死ぬ

    // php-del start flag_1
    ...something
    // php-del end flag_1
    // php-del start flag_2
    ...something
    // php-del end flag_2
    

    イ㌔

    opened by kubotak-is 0
  • コメントのある行ごと消しちゃうと都合が悪い場合がある

    コメントのある行ごと消しちゃうと都合が悪い場合がある

    次のようなコードがあった場合

    if ($a && $b/** php-del start flag */ && $flag/** php-del end flag */) {
      // something
    }
    

    削除結果は次のようになる

    ) {
      // something
    }
    

    🤔

    こういうケースでは挟んだ箇所のみ消すようにしたい

    opened by kubotak-is 0
  • 曖昧なコメントでも対象になるようにしたい

    曖昧なコメントでも対象になるようにしたい

    以下のような曖昧なコメントでも対応できるようにしたい

    ~~スペースが複数ある~~

    /** php-del  start  flag  */
    

    ~~ダブルスラッシュのコメント~~

    // php-del start flag
    

    ~~複数行コメント~~

    /**
     * php-del start flag
     */
    

    他のコメントと混ざってるケース

    /**
     * FYI comment
     * php-del start flag
     */
    
    opened by kubotak-is 1
Releases(0.7.1)
Library allows to detect emoji, remove emoji, encode emoji and decode emoji in string.

It allows to detect emoji, remove emoji, encode emoji and decode emoji in string. Installation composer require anisimov/emoji How to use Encode and

Aleksey Anisimov 9 Nov 8, 2022
PHP Simple M3U Parser, it clean the playlist and remove duplicate

SimpleM3UParser PHP Simple M3U Playlist Parser, it clean, remove duplicate, and group the playlist. Usage see example.php <?php require_once "M3UPars

erwin solihin 3 May 30, 2022
StickWithIt is an online food ordering website created using PHP. You can view and purchase various items as well as remove items from the cart.

StickWithIt (App Name) StickWithIt is an online food ordering website created using PHP. The database used here is MYSQL database. The tool used here

Jenil Gajjar 1 May 11, 2022
This plugin help us to remove the unused file or directories in vendor

Composer Ignore Plugin This plugin help us to remove the unused file or directories in vendor. Installation Both global or local install can work well

__FresHmaN 21 Oct 21, 2021
A few Fat-Free specific extensions for Tracy Debugger to help debug your code quickly.

Fat-Free Tracy Extensions This is a set of extensions to make working with Fat-Free a little richer. F3 - Analyze all hive variables. Database - Analy

Austin 6 Nov 17, 2022
Create a web service for discussion and comments of articles.

Test technique But Créer un service web de discussion et de commentaires d’articles. Fonctionnalités Les fonctionnalités attendus sont les suivantes :

Mathieu Ledru 1 Feb 8, 2022
Flarum Post Comments - A Flarum extension.

Flarum Post Comments A Flarum extension. Make sure to comment on the answers and list the comments below the answers. Installation Install with compos

Selçuk Kılıç 2 Sep 22, 2022
Webman quickly creates a verification code tool similar to Google verification code

webman-captcha-grid webman quickly creates a verification code tool similar to Google verification code webman 快速创建一个类似于 Google 点图验证码的本地验证码扩展 介绍 webma

听风吹雨 6 Dec 5, 2022
Magento specific extension for phpstan

bitexpert/phpstan-magento This package provides some additional features for PHPStan to make it work for Magento 2 projects. Installation The preferre

bitExpert AG 92 Dec 7, 2022
Magento 2 specific tasks for Capistrano 3

Capistrano::Magento2 A Capistrano extension for Magento 2 deployments. Takes care of specific Magento 2 requirements and adds tasks specific to the Ma

David Alger 223 Dec 2, 2022
An object store for specific objects.

Object Storage A simple object storage class that will only allow "supported" objects. class MyObjectStorage extends Herrera\Util\ObjectStorage {

KHerGe - Archived Projects 17 Jan 31, 2020
A simple way to know if you are on the list of major security breaches like "HIBP", but it is specific for Iran.

Leakfa.com A simple way to know if you are on the list of major security breaches like "HIBP", but it is specific for Iran. Service content This produ

Leakfa 100 Nov 20, 2022
A PocketMine-MP Plugin that allow you to change your nickname to specific colors

General Home A PocketMine-MP Plugin that allow you to change your display nametag to specific colors Made By BabosApple And Updated To PM4 By ZhorifCr

ZhorifCraft451 0 Feb 22, 2022
Json-normalizer: Provides generic and vendor-specific normalizers for normalizing JSON documents

json-normalizer Provides generic and vendor-specific normalizers for normalizing JSON documents. Installation Run $ composer require ergebnis/json-nor

null 64 Dec 31, 2022
This plugin can be embedded in PHP application to give the web application specific routes/href

Routes Plugin PHP This plugin can be embedded in PHP application to give the web application specific routes/href location and for entering specific/l

Ifechukwudeni Oweh 7 Jul 17, 2022
A PocketMine-MP plugin that allows you to mute players permanently and for a specific time.

BetterMute - v1.1.1 A PocketMine-MP plugin that allows you to mute players permanently and for a specific time. Features easy mute players permanent o

supercrafter333 7 Dec 21, 2022
QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific.

QuidPHP/Main is a PHP library that provides a set of base objects and collections that can be extended to build something more specific. It is part of the QuidPHP package and can also be used standalone.

QuidPHP 4 Jul 2, 2022
A plugin to make life easier for users who need to edit specific functions of a world and also create, rename and delete worlds quickly using commands or the world management menu.

A plugin to make life easier for users who need to edit specific functions of a world and also create, rename and delete worlds quickly using commands or the world management menu.

ImperaZim 0 Nov 6, 2022
Package to send customer specific prices to Magento from a Laravel application using a configurable source.

Laravel Magento Customer Prices This package provides a way to add customer specific prices to Magento from a Laravel app. By default, it uses the Mag

JustBetter 14 Nov 4, 2022