Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.5k stars 453 forks source link

PHP beautifier stopped working #294

Closed elder0010 closed 9 years ago

elder0010 commented 9 years ago

Hi, the beautifier for php has just stopped working :\ i see no errors, and the code gets no more beautified.

i double checked the paths, and they are correct!

    "beautifier_path": "/Users/elder/pear/bin/php_beautifier",
    "cs_fixer_path": "/usr/local/bin/",

here is the full debug info

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Thu Apr 30 2015 09:27:35 GMT+0200 (CEST).


Platform: darwin

Versions

Atom Version: 0.194.0

Atom Beautify Version: 0.24.1

Original file to be beautified

Original File Path: /Users/elder/phpprojects/vagrant-lamp/public/local.dev/ivf/application/models/services/transaction_service.php

Original File Grammar: PHP

Original File Contents:

<?php
class transaction_service extends service_base {
    function __construct() {
        parent::__construct();
        $this->load->model('transaction_model', 'transaction_model');
        $this->load->model('transaction_has_straws_model','transaction_has_straws_model');
        $this->load->model('transaction_has_strain_model','transaction_has_strain_model');
        $this->load->model('transaction_has_male_model','transaction_has_male_model');
    }

    public function transaction($id,$with_ivf=false){

        try{
            $transaction = $this->transaction_model->get_by_id($id);

            if(empty($transaction)){
                throw new Exception("Transaction non trovata");
            }

            //Aggiungo l'user..
            $user = $this->users_model->get_by_field('id',$transaction->users_id);

            if(empty($user)){
                $transaction->user = 'N/A';
            }else{
                unset($user->password);
                $transaction->user = $user;
            }

            $transaction->straws = $this->transaction_has_straws_model->get_by_id_transaction($id);
            $transaction->males = $this->transaction_has_male_model->get_by_id_transaction($id);
            $transaction->ivf = $this->ivf_model->get_by_id_transaction($id);

            $transaction->identified_females = array();
            $transaction->unidentified_females = array();

            //Completo la lista degli ivf aggiungendoci females e males
            if(!empty($transaction->ivf)){
                foreach($transaction->ivf as $ivf){
                    $ivf->identified_females = $this->ivf_has_female_model->get_by_id_ivf($ivf->id);
                    $ivf->unidentified_females = $this->unidentified_female_model->get_by_id_ivf($ivf->id);

                    //L'array di comodo per le females viene popolato qua
                    if(!empty($ivf->identified_females)){
                        $transaction->identified_females[] = $ivf->identified_females;
                    }
                    if(!empty($ivf->unidentified_females)){
                        $transaction->unidentified_females[] = $ivf->unidentified_females;
                    }
                }
            }

            $transaction->id_straws_list = array();

            //Mi preparo un array di comodo per gli straws id
            if(!empty($transaction->straws)){
                $transaction->step_0_strain = $transaction->straws[0]->strain_id; //prendo l'id_strain del primo straw
                foreach($transaction->straws as $s){
                    $transaction->id_straws_list[] = $s->id_emma;
                }
            }else{
                $transaction->step_0_strain = false;
            }

            //Stessa storia per i males
            if(!empty($transaction->males)){
                $transaction->step_1_strain = $transaction->males[0]->strain_id; //prendo l'id_strain del primo male
                foreach($transaction->males as $m){
                    $transaction->id_males_list[] = $m->animal_id;
                }
            }else{
                $transaction->step_1_strain = false;
            }

            //E per le females
            if(!empty($transaction->identified_females)){
                $transaction->step_2_strain = $transaction->identified_females[0]->strain_id; //prendo l'id_strain della prima identified
                foreach($transaction->identified_females as $f){
                    $transaction->id_identified_females_list[] = $f->animal_id;
                }
            }else{
                $transaction->step_2_strain = false;
            }

            if(!empty($transaction->unidentified_females)){
                        foreach($transaction->unidentified_females as $f){
                    $transaction->id_unidentified_females_list[] = $f->strain_background_id.' '.$f->source;
                }
            }

            return $transaction;
        }catch(Exception $e){
            throw $e;
        }
    }

    function update(){
        try{
            echo '<pre>';
            print_r($_POST);

            $id_transaction = $this->input->post('transaction_id');

            if(!is_numeric($id_transaction)){
                throw new Exception("Transaction id non numerico!");
            }

            $this->db->trans_begin();

            //Per prima cosa allineo gli straws e males: si puo' deletare senza problemi
            //e reinserire
            $this->transaction_has_straws_model->delete_by_id_transaction($id_transaction);
            $this->transaction_has_male_model->delete_by_id_transaction($id_transaction);
            $this->transaction_has_strain_model->delete_by_id_transaction($id_transaction);

            //reinserisco dati step 0 e 1
            //Inserisco la relazione con straw
            $strains_inseriti = $this->ivf_service->insert_straws_for_transaction($id_transaction);

            //Inserisco la relazione con i males (step 1)
            $strains_inseriti = $this->ivf_service->insert_males_for_transaction($id_transaction,$strains_inseriti);

            //Adesso preparo un array degli id ivf da updatare
            $ivf_da_updatare = $this->_get_ivf_to_update_from_post();

                echo 'IVF DA UPDATARE';
            print_r($ivf_da_updatare);

            //Questi devono essere inseriti ex novo
            $ivf_list = $this->ivf_service->arrange_ivf_array_from_post($id_transaction);

            echo 'IVF DA POST';
            print_r($ivf_list);

            if ($this->db->trans_status() === FALSE) {
                $this->db->trans_rollback();
            } else {
                $this->db->trans_commit();
            }

        }catch(Exception $e){
            $this->db->trans_rollback();
            echo $e->getMessage();
            die();
            throw $e;
        }
    }

    private function _get_ivf_to_update_from_post(){
        $id_ivf_list = array();

        foreach($_POST as $k=>$v){
            if(strstr($k,'ivf-edit')){
                echo 'BINGO';
                var_dump($k);
                $id_ivf = explode('-',$_POST[$k]);
                $id_ivf_list[] = end($id_ivf);
            }
        }
        return $id_ivf_list;
    }
}

Beautification options

Editor Options: Options from Atom Editor settings

{
    "indent_size": 4,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options: Options from Atom Beautify package settings

{
    "php": {
        "beautifier_path": "/Users/elder/pear/bin/php_beautifier",
        "cs_fixer_path": "/usr/local/bin/",
        "fixers": "",
        "level": ""
    },
    "js": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "css": {
        "indent_size": 4,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "html": {
        "htmlbeautifier_path": "",
        "indent_inner_html": false,
        "indent_size": 4,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 4,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "sql": {
        "indent_size": 4,
        "keywords": "upper",
        "identifiers": "lower",
        "sqlformat_path": ""
    },
    "markdown": {
        "pandoc_path": "",
        "yaml_front_matter": true
    },
    "perl": {
        "perltidy_path": "perltidy",
        "perltidy_profile": ""
    },
    "python": {
        "autopep8_path": "",
        "max_line_length": 79,
        "indent_size": 4,
        "ignore": [
            "E24"
        ]
    },
    "ruby": {
        "rbeautify_path": ""
    },
    "c": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cpp": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "objectivec": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cs": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "d": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "java": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "pawn": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "vala": {
        "uncrustifyPath": "",
        "configPath": ""
    }
}

Home Options: Options from /Users/elder/.jsbeautifyrc

{}

EditorConfig Options: Options from EditorConfig file

{}

Project Options: Options from .jsbeautifyrc files starting from directory /Users/elder/phpprojects/vagrant-lamp/public/local.dev/ivf/application/models/services and going up to root

[
    {},
    {},
    {},
    {},
    {},
    {},
    {},
    {},
    {},
    {}
]

Logs

Error logs: Not yet supported

Glavin001 commented 9 years ago

I just published a new release to v0.25.0

This is a very big release with lots of internal changes and (hopefully) no breaking changes. Please let me know if you are experiencing any unusual behaviour / breaking changes after updating. Thank you.

This may even resolve your issue. If not, now we can continue debugging from here and the internal code for Atom Beautify should be much easier to debug :+1:.

Glavin001 commented 9 years ago

This may be the same bug found in #293. Please update and let me know if this needs to be reopened. Thanks.

fabiofdsantos commented 9 years ago

Still not working..

v0.26.0

Glavin001 commented 9 years ago

Link to old working version: https://github.com/Glavin001/atom-beautify/blob/v0.24.1/lib/langs/php-beautify.coffee#L12-L36


There was a few typos. I have tests now that run and pass locally. Working on getting Travis CI setup again for PHP beautification tests. There are a couple issues that had stopped me from enabling PHP-CS-Fixer tests:

Once I can get PHP to run on Travis CI then I will have tests that will confirm I no longer break PHP beautification again.

Glavin001 commented 9 years ago

Published patch to v0.26.2

Let me know if that works for you.

fabiofdsantos commented 9 years ago

@Glavin001 it works now with v0.26.2 :+1:

Glavin001 commented 9 years ago

Excellent. Thanks for letting me know.