Code/PHP

[php] 버전업 마이그레이션 7.4 -> 8.0

codens 2021. 3. 9. 05:19

 

    - Migrating from PHP 7.4.x to PHP 8.0.x 

https://www.php.net/manual/en/migration80.php




//--------------------------------------------

< 하위 비호환 변화 >

https://www.php.net/manual/en/migration80.incompatible.php





//--------------------------------------------

< php v8.0 에서 삭제 예정 기능 (Deprecated Features ) >

https://www.php.net/manual/en/migration80.deprecated.php



// 사용자 정의 비교 callback을 지원하는 정렬 함수(usort, uasort, uksort)의 callback 함수 리턴값이 bool값(true, false)이면 안됨

    -> 정수를 반환해야 함

// 삭제 예정

usort($array, fn($a, $b) => $a > $b); // 부등호를 사용했다면 

// 권장

usort($array, fn($a, $b) => $a <=> $b);// 우주선 연산자(spaceship operator )로 변경

    - 우주선 연산자( <=> ) 는 v7.0부터 사용가능




//---------

get_defined_functions(false) 은 효과없음, 항상 disabled functions은 포함 안함

 

enchant_* 관련 삭제된 함수

enchant_broker_set_dict_path() , enchant_broker_get_dict_path() 

enchant_broker_free() , enchant_broker_free_dict() 

 

enchant_dict_add_to_personal() ->  use enchant_dict_add() 

enchant_dict_is_in_session() ->  enchant_dict_is_added() 



libxml_disable_entity_loader() 삭제

 

ReflectionType 

ReflectionFunction::isDisabled() 

ReflectionParameter::getClass(), ReflectionParameter::isArray(),  ReflectionParameter::isCallable()  ->  ReflectionParameter::getType()



//--------------------------------

< 라라벨에서 php v8.0지원 >

https://blog.laravel.com/laravel-php-8-support - Lavavel 6 - 8까지 php 8을 공식 지원

 

-   composer.json 파일 수정

    PHP to php:^8.0

    Faker to fakerphp/faker:^1.9.1

    PHPUnit to phpunit/phpunit:^9.3

 

> composer update



반응형