Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\PHPStanStaticTypeMapper\TypeMapper;

use PhpParser\Node;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand Down Expand Up @@ -38,7 +37,7 @@ public function mapToPHPStanPhpDocTypeNode(Type $type, TypeKind $typeKind): Type
/**
* @param HasOffsetType $type
*/
public function mapToPhpParserNode(Type $type, TypeKind $typeKind): ?Node
public function mapToPhpParserNode(Type $type, TypeKind $typeKind): never
Copy link
Copy Markdown
Contributor

@staabm staabm Dec 4, 2021

Choose a reason for hiding this comment

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

Is this legal, since the return type of ?Node was part of TypeMapperInterface contract/interface?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It seems cause error on scoping https://github.com/rectorphp/rector-src/runs/4418027866?check_suite_focus=true#step:23:7

Run cd remote-repository && bin/rector list --ansi && cd ..
  cd remote-repository && bin/rector list --ansi && cd ..
  shell: /usr/bin/bash -e {0}
  env:
    COMPOSER_ROOT_VERSION: dev-main
PHP Fatal error:  Declaration of Rector\PHPStanStaticTypeMapper\TypeMapper\HasOffsetTypeMapper::mapToPhpParserNode($type, $typeKind) must be compatible with Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface::mapToPhpParserNode($type, $typeKind): ?PhpParser\Node in /home/runner/work/rector-src/rector-src/remote-repository/packages/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php on line 17
Fatal error: Declaration of Rector\PHPStanStaticTypeMapper\TypeMapper\HasOffsetTypeMapper::mapToPhpParserNode($type, $typeKind) must be compatible with Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface::mapToPhpParserNode($type, $typeKind): ?PhpParser\Node in /home/runner/work/rector-src/rector-src/remote-repository/packages/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php on line 17
Error: Process completed with exit code 255

I will check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed at #1390

{
throw new ShouldNotHappenException();
}
Expand Down
4 changes: 1 addition & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand Down Expand Up @@ -83,8 +82,7 @@
MyCLabsClassToEnumRector::class,
SpatieEnumClassToEnumRector::class,

// temporary skip non finalize public class constant rector
ReturnNeverTypeRector::class,
// temporary skip non return never type rector
MyCLabsMethodCallToEnumConstRector::class,
Php81ResourceReturnToObjectRector::class,

Expand Down