remove &$var reference notations in phpdoc

this isn't required by the spec and PHPStan chokes on it. I was previously having it ignore these errors, but it turns out that PHPStan is not making use of extended typeinfo provided if it can't parse the tag, which is problematic on level 6 and also a problem for array-of-type. Therefore, we are going to have to take the hit.
This commit is contained in:
Dylan K. Taylor 2020-01-11 21:20:55 +00:00
parent 0a39e580e9
commit 8794292788
11 changed files with 36 additions and 40 deletions

View File

@ -472,9 +472,9 @@ class MemoryManager{
/**
* @param mixed $from
* @param mixed &$data
* @param object[] &$objects
* @param int[] &$refCounts
* @param mixed $data reference parameter
* @param object[] $objects reference parameter
* @param int[] $refCounts reference parameter
* @param int $recursion
* @param int $maxNesting
* @param int $maxStringSize

View File

@ -226,8 +226,8 @@ class SimpleCommandMap implements CommandMap{
* This method is intended to provide capability for handling commands with spaces in their name.
* The referenced parameters will be modified accordingly depending on the resulting matched command.
*
* @param string &$commandName
* @param string[] &$args
* @param string $commandName reference parameter
* @param string[] $args reference parameter
*
* @return Command|null
*/

View File

@ -1778,7 +1778,7 @@ class Level implements ChunkManager, Metadatable{
* It'll try to lower the durability if Item is a tool, and set it to Air if broken.
*
* @param Vector3 $vector
* @param Item &$item (if null, can break anything)
* @param Item $item reference parameter (if null, can break anything)
* @param Player $player
* @param bool $createParticles
*

View File

@ -331,8 +331,8 @@ class McRegion extends BaseLevelProvider{
/**
* @param int $chunkX
* @param int $chunkZ
* @param int &$regionX
* @param int &$regionZ
* @param int $regionX reference parameter
* @param int $regionZ reference parameter
*/
public static function getRegionIndex(int $chunkX, int $chunkZ, &$regionX, &$regionZ){
$regionX = $chunkX >> 5;

View File

@ -244,8 +244,8 @@ class RegionLoader{
/**
* @param int $offset
* @param int &$x
* @param int &$z
* @param int $x reference parameter
* @param int $z reference parameter
*/
protected static function getChunkCoords(int $offset, ?int &$x, ?int &$z) : void{
$x = $offset & 0x1f;

View File

@ -457,9 +457,9 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Reads an block position with unsigned Y coordinate.
*
* @param int &$x
* @param int &$y
* @param int &$z
* @param int $x reference parameter
* @param int $y reference parameter
* @param int $z reference parameter
*/
public function getBlockPosition(&$x, &$y, &$z) : void{
$x = $this->getVarInt();
@ -483,9 +483,9 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Reads a block position with a signed Y coordinate.
*
* @param int &$x
* @param int &$y
* @param int &$z
* @param int $x reference parameter
* @param int $y reference parameter
* @param int $z reference parameter
*/
public function getSignedBlockPosition(&$x, &$y, &$z) : void{
$x = $this->getVarInt();

View File

@ -106,10 +106,10 @@ class Config{
];
/**
* @param string $file Path of the file to be loaded
* @param int $type Config type to load, -1 by default (detect)
* @param array $default Array with the default values that will be written to the file if it did not exist
* @param null &$correct Sets correct to true if everything has been loaded correctly
* @param string $file Path of the file to be loaded
* @param int $type Config type to load, -1 by default (detect)
* @param array $default Array with the default values that will be written to the file if it did not exist
* @param null $correct reference parameter, Sets correct to true if everything has been loaded correctly
*/
public function __construct(string $file, int $type = Config::DETECT, array $default = [], &$correct = null){
$this->load($file, $type, $default);
@ -507,7 +507,7 @@ class Config{
/**
* @param array $default
* @param array &$data
* @param array $data reference parameter
*
* @return int
*/

View File

@ -37,7 +37,7 @@ final class Git{
* Returns the git hash of the currently checked out head of the given repository, or null on failure.
*
* @param string $dir
* @param bool &$dirty Output, set to whether the repo has local changes
* @param bool $dirty reference parameter, set to whether the repo has local changes
*
* @return string|null
*/

View File

@ -138,9 +138,9 @@ class Internet{
* @param string $page
* @param int $timeout default 10
* @param array $extraHeaders
* @param string &$err Will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] &$headers
* @param int &$httpCode
* @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] $headers reference parameter
* @param int $httpCode reference parameter
*
* @return bool|mixed false if an error occurred, mixed data if successful.
*/
@ -162,9 +162,9 @@ class Internet{
* @param array|string $args
* @param int $timeout
* @param array $extraHeaders
* @param string &$err Will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] &$headers
* @param int &$httpCode
* @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] $headers reference parameter
* @param int $httpCode reference parameter
*
* @return bool|mixed false if an error occurred, mixed data if successful.
*/

View File

@ -451,9 +451,9 @@ class Utils{
* @param string $page
* @param int $timeout default 10
* @param array $extraHeaders
* @param string &$err Will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] &$headers
* @param int &$httpCode
* @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] $headers reference parameter
* @param int $httpCode reference parameter
*
* @return bool|mixed false if an error occurred, mixed data if successful.
*/
@ -469,9 +469,9 @@ class Utils{
* @param array|string $args
* @param int $timeout
* @param array $extraHeaders
* @param string &$err Will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] &$headers
* @param int &$httpCode
* @param string $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @param array[] $headers reference parameter
* @param int $httpCode reference parameter
*
* @return bool|mixed false if an error occurred, mixed data if successful.
*/
@ -519,8 +519,8 @@ class Utils{
/**
* @param string $command Command to execute
* @param string|null &$stdout Reference parameter to write stdout to
* @param string|null &$stderr Reference parameter to write stderr to
* @param string|null $stdout Reference parameter to write stdout to
* @param string|null $stderr Reference parameter to write stderr to
*
* @return int process exit code
*/

View File

@ -1,9 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^PHPDoc tag @param has invalid value \\(.+\\)\\: Unexpected token \"&\", expected variable at offset \\d+$#"
path: ../../../src
-
message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#"
path: ../../../src