# モダンPHP (8.1+) (Symfony) > Enums、readonly プロパティ、attributes、プロモートされたプロパティ、named arguments、union types、厳格な型付け、match 式 - 20 面接問題 - Junior - [面接問題: Symfony](https://sharpskill.dev/ja/technologies/symfony/interview-questions.md) ## 1. PHP 8.1+ で列挙型 (enum) を宣言する正しい構文はどれですか? **回答** PHP 8.1+ では、列挙型は enum キーワードに続けて名前と可能なケースを波括弧内に記述して宣言します。enum は有限の値の集合を持つ型を定義でき、型安全性を向上させ、コードをより表現力豊かにします。backed enum には string または int の値を関連付けられます。 ## 2. PHP 8.1以降の backed enum とは何ですか? **回答** backed enum とは、各 case がスカラー値(string または int)に関連付けられた列挙型です。この値によってシリアライズやデータベースへの保存が可能になります。構文では、enum 名の後にコロンを置いて backing の型を指定し、各 case には等号で値を割り当てます。 ## 3. PHP 8.1以降で readonly プロパティを宣言するにはどうしますか? **回答** readonly 修飾子はプロパティの型の前に置きます。readonly プロパティは、宣言時かコンストラクタのいずれかで一度だけ初期化できます。一度設定すると値は変更できなくなり、そのプロパティの不変性が保証されます。 ## さらに17問利用可能 - PHP 8.1以降における readonly プロパティの主な制約は何ですか? - PHP 8.0以降の constructor property promotion とは何ですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のSymfony面接トピック - [Symfony の基礎](https://sharpskill.dev/ja/technologies/symfony/interview-questions/symfony-basics.md): 25問, Junior - [Routing & Controllers](https://sharpskill.dev/ja/technologies/symfony/interview-questions/routing-controllers.md): 20問, Junior - [Twig & Templates](https://sharpskill.dev/ja/technologies/symfony/interview-questions/twig-templates.md): 20問, Junior - [Doctrine ORM の基礎](https://sharpskill.dev/ja/technologies/symfony/interview-questions/doctrine-orm-basics.md): 25問, Junior - [Symfony フォーム](https://sharpskill.dev/ja/technologies/symfony/interview-questions/forms.md): 22問, Junior - [データバリデーション](https://sharpskill.dev/ja/technologies/symfony/interview-questions/validation.md): 18問, Junior - [Dependency Injection & Services](https://sharpskill.dev/ja/technologies/symfony/interview-questions/dependency-injection.md): 24問, Mid-Level - [Security & Authentication](https://sharpskill.dev/ja/technologies/symfony/interview-questions/security-authentication.md): 26問, Mid-Level - [Doctrine 上級](https://sharpskill.dev/ja/technologies/symfony/interview-questions/doctrine-advanced.md): 24問, Mid-Level - [API Platform](https://sharpskill.dev/ja/technologies/symfony/interview-questions/api-platform.md): 22問, Mid-Level - [Serializer Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/serializer.md): 20問, Mid-Level - [Events & Event Subscribers](https://sharpskill.dev/ja/technologies/symfony/interview-questions/events-subscribers.md): 20問, Mid-Level - [Console & Commands](https://sharpskill.dev/ja/technologies/symfony/interview-questions/console-commands.md): 18問, Mid-Level - [Messenger Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/messenger.md): 22問, Mid-Level - [HTTP Client](https://sharpskill.dev/ja/technologies/symfony/interview-questions/http-client.md): 18問, Mid-Level - [キャッシュとパフォーマンス](https://sharpskill.dev/ja/technologies/symfony/interview-questions/cache.md): 20問, Mid-Level - [Workflow Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/workflow.md): 18問, Mid-Level - [Testing Symfony](https://sharpskill.dev/ja/technologies/symfony/interview-questions/testing.md): 22問, Mid-Level - [Mailer Component](https://sharpskill.dev/ja/technologies/symfony/interview-questions/mailer.md): 16問, Mid-Level - [翻訳と i18n](https://sharpskill.dev/ja/technologies/symfony/interview-questions/translations.md): 16問, Mid-Level - [EasyAdmin Bundle](https://sharpskill.dev/ja/technologies/symfony/interview-questions/easyadmin.md): 18問, Mid-Level - [Symfony アーキテクチャ](https://sharpskill.dev/ja/technologies/symfony/interview-questions/architecture-patterns.md): 24問, Senior - [パフォーマンスと最適化](https://sharpskill.dev/ja/technologies/symfony/interview-questions/performance-optimization.md): 22問, Senior - [高度なセキュリティ](https://sharpskill.dev/ja/technologies/symfony/interview-questions/security-advanced.md): 22問, Senior - [カスタムバンドル](https://sharpskill.dev/ja/technologies/symfony/interview-questions/custom-bundles.md): 20問, Senior - [Symfony によるマイクロサービス](https://sharpskill.dev/ja/technologies/symfony/interview-questions/microservices.md): 22問, Senior - [Real-time & WebSockets](https://sharpskill.dev/ja/technologies/symfony/interview-questions/real-time.md): 18問, Senior - [Deployment & DevOps](https://sharpskill.dev/ja/technologies/symfony/interview-questions/deployment-devops.md): 20問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/symfony/interview-questions/php-modern-features