You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a syntax error in the file adding a , after the function parenthesis, that line should look like this: public function number(),
Start the web server via: symfony server:start and navigate to the homepage.
You'll see a Loader exception, not a parse/syntax error.
Possible Solution
Not sure. Is this expected? It's a bit misleading.
Additional context
Stack traces
Symfony\Component\Config\Exception\LoaderLoadException:
Expected to find class "App\Controller\LuckyController" in file "/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/src/Controller/LuckyController.php" while importing services from resource "../src/*", but it was not found! Check the namespace prefix used with the resource in /Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml (which is loaded in resource "/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml").
at /Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/FileLoader.php:180
at Symfony\Component\Config\Loader\FileLoader->doImport('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml', null, false, null)
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/FileLoader.php:104)
at Symfony\Component\Config\Loader\FileLoader->import('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/FileLoader.php:66)
at Symfony\Component\DependencyInjection\Loader\FileLoader->import('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php:27)
at Symfony\Component\DependencyInjection\Loader\GlobFileLoader->load('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/{services}.{php,xml,yaml,yml}', 'glob')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/DelegatingLoader.php:40)
at Symfony\Component\Config\Loader\DelegatingLoader->load('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/{services}.{php,xml,yaml,yml}', 'glob')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/src/Kernel.php:42)
at App\Kernel->configureContainer(object(ContainerBuilder), object(DelegatingLoader))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:81)
at App\Kernel->Symfony\Bundle\FrameworkBundle\Kernel\{closure}(object(ContainerBuilder))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/ClosureLoader.php:38)
at Symfony\Component\DependencyInjection\Loader\ClosureLoader->load(object(Closure), null)
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/DelegatingLoader.php:40)
at Symfony\Component\Config\Loader\DelegatingLoader->load(object(Closure))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:84)
at App\Kernel->registerContainerConfiguration(object(DelegatingLoader))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:727)
at Symfony\Component\HttpKernel\Kernel->buildContainer()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:625)
at Symfony\Component\HttpKernel\Kernel->initializeContainer()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:136)
at Symfony\Component\HttpKernel\Kernel->boot()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:196)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/public/index.php:25)
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException:
Expected to find class "App\Controller\LuckyController" in file "/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/src/Controller/LuckyController.php" while importing services from resource "../src/*", but it was not found! Check the namespace prefix used with the resource.
at /Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/FileLoader.php:208
at Symfony\Component\DependencyInjection\Loader\FileLoader->findClasses('App\\', '../src/*', array('../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/FileLoader.php:101)
at Symfony\Component\DependencyInjection\Loader\FileLoader->registerClasses(object(Definition), 'App\\', '../src/*', '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:611)
at Symfony\Component\DependencyInjection\Loader\YamlFileLoader->parseDefinition('App\\', array('resource' => '../src/*', 'exclude' => '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'), '/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml', array('autowire' => true, 'autoconfigure' => true))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:233)
at Symfony\Component\DependencyInjection\Loader\YamlFileLoader->parseDefinitions(array('parameters' => null, 'services' => array('App\' => array('resource' => '../src/*', 'exclude' => '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'), 'App\Controller\' => array('resource' => '../src/Controller', 'tags' => array('controller.service_arguments')))), '/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:153)
at Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml', null)
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/FileLoader.php:165)
at Symfony\Component\Config\Loader\FileLoader->doImport('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml', null, false, null)
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/FileLoader.php:104)
at Symfony\Component\Config\Loader\FileLoader->import('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/FileLoader.php:66)
at Symfony\Component\DependencyInjection\Loader\FileLoader->import('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/services.yaml')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/GlobFileLoader.php:27)
at Symfony\Component\DependencyInjection\Loader\GlobFileLoader->load('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/{services}.{php,xml,yaml,yml}', 'glob')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/DelegatingLoader.php:40)
at Symfony\Component\Config\Loader\DelegatingLoader->load('/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/config/{services}.{php,xml,yaml,yml}', 'glob')
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/src/Kernel.php:42)
at App\Kernel->configureContainer(object(ContainerBuilder), object(DelegatingLoader))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:81)
at App\Kernel->Symfony\Bundle\FrameworkBundle\Kernel\{closure}(object(ContainerBuilder))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/dependency-injection/Loader/ClosureLoader.php:38)
at Symfony\Component\DependencyInjection\Loader\ClosureLoader->load(object(Closure), null)
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/config/Loader/DelegatingLoader.php:40)
at Symfony\Component\Config\Loader\DelegatingLoader->load(object(Closure))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/framework-bundle/Kernel/MicroKernelTrait.php:84)
at App\Kernel->registerContainerConfiguration(object(DelegatingLoader))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:727)
at Symfony\Component\HttpKernel\Kernel->buildContainer()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:625)
at Symfony\Component\HttpKernel\Kernel->initializeContainer()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:136)
at Symfony\Component\HttpKernel\Kernel->boot()
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/vendor/symfony/http-kernel/Kernel.php:196)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(/Users/pablocubico/dev/personal/hessyRoot/syntaxdemo/public/index.php:25)
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected: 4.4.*
Description
PHP syntax/parse errors are obscured by framework messages (i.e.: you can't see what the actual error was).
How to reproduce
composer create-project symfony/website-skeleton:^4.4 syntaxdemo
as shown in the setup guide (see: https://symfony.com/doc/4.4/setup.html )src/Controller
calledLuckyController.php
as shown in the next tutorial (https://symfony.com/doc/4.4/page_creation.html):,
after the function parenthesis, that line should look like this:public function number(),
symfony server:start
and navigate to the homepage.Possible Solution
Not sure. Is this expected? It's a bit misleading.
Additional context
Stack traces
The text was updated successfully, but these errors were encountered: