Skip to content

Rector does not process files without extensions, even when specifically pointed to one #9079

@FlyveHest

Description

@FlyveHest

Bug Report

Subject Details
Rector version 2.0.10

I have multiple libraries that use vendor/bin scripts, and all of those scripts does not have a .php extension.

Rector does not check these files, even when specifically pointed at the file via the process command.

Minimal PHP Code Causing Issue

Create a PHP file called bin/test.php, containing this:

<?php declare(strict_types=1);
  class test {
    public function test(string $test = null) {
      echo $test;
    }
  }

Run rector, ./vendor/bin/rector --dry-run --debug process bin/test.php, rector lists the file and reports a ExplicitNullableParamTypeRector as expected.

[file] .../test.php

1 file with changes
===================

1) bin/test.php:1

    ---------- begin diff ----------
@@ @@
 <?php declare(strict_types=1);
   class test {
-    public function test(string $test = null) {
+    public function __construct(?string $test = null) {
       echo $test;
     }
   }
    ----------- end diff -----------

Applied rules:
 * ExplicitNullableParamTypeRector

Rename the file to test and run rector again, ./vendor/bin/rector --dry-run --debug process bin/test, this time rector just finishes, having processed no files.

[OK] Rector is done!

Expected Behaviour

I can understand that it makes sense to skip files without extensions in a large codebase, but it would be nice if it could scan a file when explicitly told to, instead of skipping it based on a filename extension rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions