Skip to content

Commit

Permalink
boolean -> bool
Browse files Browse the repository at this point in the history
  • Loading branch information
gudmdharalds committed Feb 16, 2022
1 parent 8b16a30 commit 335deb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ap-hashes-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* @param array $options Options needed.
* @param string $file_path Path to file.
*
* @return boolean|null Either true or false when able to ask DB, else null.
* @return bool|null Either true or false when able to ask DB, else null.
*/
function vipgoci_ap_hashes_api_file_approved(
array $options,
string $file_path
) :boolean|null {
) :bool|null {
vipgoci_runtime_measure( VIPGOCI_RUNTIME_START, 'hashes_api_scan_file' );

/*
Expand Down

3 comments on commit 335deb5

@FernandoWL
Copy link

@FernandoWL FernandoWL commented on 335deb5 Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gudmdharalds hope you are doing great! Currently I am using the VIP Code Review Bot and I am getting this error message "Parse error: syntax error, unexpected '|', expecting '{' in vip-go-ci/ap-hashes-api.php on line 23" I Think you could use this approach https://www.php.net/manual/en/migration71.new-features.php You could use something like : ?bool instead of :bool|null What do you think about it? Thanks a lot.

@gudmdharalds
Copy link
Contributor Author

@gudmdharalds gudmdharalds commented on 335deb5 Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @FernandoWL!

I'm well thanks, I hope you are too.

Thank you for using the VIP Code Analysis Bot! I hope it proves useful for what you do.

The syntax error you are seeing is because vip-go-ci now uses syntax that is only compatible with PHP 8.0 and later versions. We made the decision to move to this syntax so that we could use strict type definitions across the code to increase reliability and security. There is unfortunately no backwards compatible syntax for some of the definitions we are using. We evaluated the option of maintaining compatibility, but in light of the fact that PHP 7.4 is only supported for critical security issues for a few more months, this did not seem worth the effort.

However, you can still use the Bot by:

  • Switching to PHP 8.0 or PHP 8.1. We recommend using PHP 8.1. If you switch to this version, you can still continue to lint PHP code for older PHP versions, such as PHP 7.3 or PHP 7.4, as we now support linting versions dynamically. PHPCS can too continue to use PHP 7.4 along with the SVG scanner.
  • You can continue to use PHP 7.4 (or PHP 7.3) if you use version 1.1.3 of vip-go-ci. This is the last version that supports these two versions of PHP (7.4/7.3).

I'm sorry that we cannot maintain a version that is compatible with older versions of PHP. We want to make use of new features of the language to increase reliability and unfortunately a compromise was not possible at this time.

I hope that one of the two options above are available to you.

Thanks!

@FernandoWL
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gudmdharalds Thank you very much for your clear and concise answer, I will take it into consideration to continue using the VIP BOT.

Please sign in to comment.