New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] Shortcut debug:form for partial type name #29452

Merged
merged 1 commit into from Dec 10, 2018

Conversation

Projects
None yet
7 participants
@ro0NL
Contributor

ro0NL commented Dec 4, 2018

Q A
Branch? master
Bug fix? yes-ish
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

When running debug:form we must specify the short type class case-sensitive. As the current autoloader doesnt check for insensitive names.

I propose this shortcut to quickly enable

debug:form url
debug:form urltype

instead of forcing

debug:form UrlType
@yceruto

This comment has been minimized.

Contributor

yceruto commented Dec 4, 2018

👍 for the shortcut.

I'd like also type mydatetype instead of MyDateType.

@ro0NL

This comment has been minimized.

Contributor

ro0NL commented Dec 4, 2018

i dont think we can conventionally change mydate to MyDate

@yceruto

This comment has been minimized.

Contributor

yceruto commented Dec 4, 2018

right, but we can change MyDate to mydate :)

@nicolas-grekas nicolas-grekas added this to the next milestone Dec 6, 2018

@nicolas-grekas nicolas-grekas removed the Bug label Dec 6, 2018

@stof

This comment has been minimized.

Member

stof commented Dec 7, 2018

@yceruto but that replacement is not the one you were asking for, as the input you asked for is mydate

@msvrtan

This comment has been minimized.

msvrtan commented Dec 8, 2018

In order to test your branch out, I rebased it locally with current master (and there were around 3k commits difference) and I have a bug to report:

On symfony 4.2 based skeleton project, when I run php bin/console debug:form urltype I get

2018-12-08T11:32:46+00:00 [error] Error thrown while running command "debug:form urltype -vvv". Message: "Case mismatch between loaded and declared class names: "Symfony\Component\Form\Extension\Core\Type\urltype" vs "Symfony\Component\Form\Extension\Core\Type\UrlType"."
2018-12-08T11:32:46+00:00 [debug] Command "debug:form urltype -vvv" exited with code "1"

In DebugClassLoader.php line 185:

  [RuntimeException]
  Case mismatch between loaded and declared class names: "Symfony\Component\Form\Extension\Core\Type\urltype" vs "Symfony\Component\Form\Extension\Core\Type\UrlType".


Exception trace:
 () at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:185
 Symfony\Component\Debug\DebugClassLoader->checkClass() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:161
 Symfony\Component\Debug\DebugClassLoader->loadClass() at n/a:n/a
 spl_autoload_call() at n/a:n/a
 class_exists() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Form/Command/DebugCommand.php:159
 Symfony\Component\Form\Command\DebugCommand->getFqcnTypeClass() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Form/Command/DebugCommand.php:119
 Symfony\Component\Form\Command\DebugCommand->execute() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:919
 Symfony\Component\Console\Application->doRunCommand() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:89
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:262
 Symfony\Component\Console\Application->doRun() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:75
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:145
 Symfony\Component\Console\Application->run() at /work/noob/learning/symfonyconhackday/pr29452/bin/console:40

Same thing happens with php bin/console debug:form urlType -vvv

2018-12-08T11:33:35+00:00 [error] Error thrown while running command "debug:form urlType -vvv". Message: "Case mismatch between loaded and declared class names: "Symfony\Component\Form\Extension\Core\Type\urlType" vs "Symfony\Component\Form\Extension\Core\Type\UrlType"."
2018-12-08T11:33:35+00:00 [debug] Command "debug:form urlType -vvv" exited with code "1"

In DebugClassLoader.php line 185:

  [RuntimeException]
  Case mismatch between loaded and declared class names: "Symfony\Component\Form\Extension\Core\Type\urlType" vs "Symfony\Component\Form\Extension\Core\Type\UrlType".


Exception trace:
 () at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:185
 Symfony\Component\Debug\DebugClassLoader->checkClass() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:161
 Symfony\Component\Debug\DebugClassLoader->loadClass() at n/a:n/a
 spl_autoload_call() at n/a:n/a
 class_exists() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Form/Command/DebugCommand.php:159
 Symfony\Component\Form\Command\DebugCommand->getFqcnTypeClass() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Form/Command/DebugCommand.php:119
 Symfony\Component\Form\Command\DebugCommand->execute() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:919
 Symfony\Component\Console\Application->doRunCommand() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:89
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:262
 Symfony\Component\Console\Application->doRun() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:75
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /work/noob/learning/symfonyconhackday/symfony/src/Symfony/Component/Console/Application.php:145
 Symfony\Component\Console\Application->run() at /work/noob/learning/symfonyconhackday/pr29452/bin/console:40


while the php bin/console debug:form url does work as expected.

IMO issue is not in your changes in the code but as you have based it on an older master or tag, there are additional changes needed.

@ro0NL ro0NL force-pushed the ro0NL:form-debug branch from c17b026 to a28e3b6 Dec 8, 2018

@ro0NL

This comment has been minimized.

Contributor

ro0NL commented Dec 8, 2018

Hi @msvrtan ive rebased on latest master. On my machine everything is working as expected;

debug:form urltype

Symfony\Component\Form\Extension\Core\Type\UrlType (Block prefix: "url")
========================================================================


debug:form urltype --no-debug

Symfony\Component\Form\Extension\Core\Type\UrlType (Block prefix: "url")
========================================================================
@fabpot

fabpot approved these changes Dec 10, 2018

@fabpot

This comment has been minimized.

Member

fabpot commented Dec 10, 2018

Thank you @ro0NL.

@fabpot fabpot merged commit a28e3b6 into symfony:master Dec 10, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Dec 10, 2018

feature #29452 [Form] Shortcut debug:form for partial type name (ro0NL)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] Shortcut debug:form for partial type name

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

When running `debug:form` we must specify the short type class case-sensitive. As the current autoloader doesnt check for insensitive names.

I propose this shortcut to quickly enable

```
debug:form url
debug:form urltype
```

instead of forcing

```
debug:form UrlType
```

Commits
-------

a28e3b6 [Form] Shortcut debug:form for partial type name

@ro0NL ro0NL deleted the ro0NL:form-debug branch Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment