Frage 1
Frage
What are valid PHP namespaces for TYPO3 extensions? (2)
Frage 2
Frage
What are “return type declarations”? (2)
Antworten
-
They declare the type of an extension, e.g. “frontend plugin” or “backend module”.
-
They specify how many methods a PHP class may contain.
-
They specify the maximum time allowed to return an object.
-
They specify the type of the value that is returned from a function or method.
-
Return values can be marked as “nullable” by prefixing the type name with a question mark since PHP version 7.1.
Frage 3
Frage
What does the “strict mode” do in PHP and how do you enable it? (2)
Antworten
-
The strict mode ensures that a variable passed to a function must exactly be of the declared type.
-
The strict mode allows developers to restrict access to class properties.
-
With the strict mode enabled, class names must be written in lowerCamelCase.
-
The strict mode can be enabled and disabled in the TYPO3 Install Tool as required.
-
The strict mode can be enabled by adding the line declare(strict_types = 1); at the top of
the PHP file.
Frage 4
Frage
Which statements about the PHP strict mode in TYPO3 extensions are correct? (3)
Antworten
-
The PHP strict mode must not be used in any TYPO3 extension files at all (TYPO3 v9 LTS does not support this feature).
-
The PHP strict mode must not be enabled in the file ext_tables.php.
-
The PHP strict mode must not be enabled in the file ext_localconf.php.
-
The PHP strict mode must not be enabled in any TCA files under Configuration/TCA/.
-
If the PHP strict mode is enabled in controller classes, the output of the action methods is not cached.
Frage 5
Frage
Which standards should be followed when you develop TYPO3 extensions or contribute to the TYPO3 core? (3)
Antworten
-
PHP coding guidelines, following the PSR-2 standard.
-
Style Guide for PHP Code (PEP-8).
-
Specific guidelines apply to PHP file and directory names.
-
The X-Mas Standard Policy applies to XLIFF language files.
-
The Airbnb JavaScript Style Guide should be used for JavaScript files.
-
TYPO3 is open-source software and therefore no coding guidelines exist.
Frage 6
Frage
Which coding rules apply in TYPO3 according to the PSR standard? (2)
Antworten
-
Opening curly braces for classes must go on the same line.
-
Opening curly braces for classes must go on the next line.
-
Opening curly braces for if-statements must go on the same line.
-
Opening curly braces for if-statements must go on the next line.
-
TYPO3 does not adhere to any coding guidelines.
Frage 7
Frage
Which coding rules apply in TYPO3 according to the PSR standard? (3)
Antworten
-
The maximum length of a line must not exceed 80 characters.
-
Code must use four spaces for indenting, not tabs.
-
A PHP file must not contain the closing PHP tag ?> at the end.
-
Spaces are not allowed at the end of lines.
-
Spaces are not allowed after a comma.
Frage 8
Frage
What issues in the following code violate the official TYPO3 coding guidelines? (2)
Antworten
-
The namespace declaration must not start with a backslash \.
-
The opening curly bracket for PHP classes must go on the next line.
-
The opening curly bracket for methods must be on the same line as the method definition.
-
The comments with the annotation must start with /* rather than /**.
Frage 9
Frage
What issues in the following code violate the official TYPO3 coding guidelines? (2)
Antworten
-
The fully qualified class name (FQCN) must always be used.
-
Property names must be written in lowerCamelCase.
-
There must not be a return type hint “string”.
-
There must not be a closing ?> tag.
Frage 10
Frage
Which coding rules apply to JavaScript files in TYPO3 projects? (2)
Antworten
-
JavaScript files of the TYPO3 core must be located under typo3conf/assets/javascript/.
-
JavaScript files in extensions should be located under Resources/Public/JavaScript/.
-
TABs should be used for line indenting.
-
Strings should always use double-quotes (").
-
File endings of JavaScript files should be .js.
Frage 11
Frage
Which statements about semantic versioning are correct? (2)
Antworten
-
A versioning scheme following semantic versioning has exactly two numbers separated by
dots, e.g. 1.2.
-
A versioning scheme following semantic versioning has exactly three numbers separated by dots, e.g. 1.2.3.
-
A versioning scheme following semantic versioning has exactly four numbers separated by dots, e.g. 1.2.3.4.
-
The last number represents “patch” versions when developers make backwards-compatible bug fixes.
-
The first number indicates if a release is a long-term support release (LTS).
Frage 12
Frage
Which statements about semantic versioning are correct? (2)
Antworten
-
Semantic versioning dictates that LTS-releases are marked appropriately, e.g. 1.2.3-lts.
-
When developers fix a bug and release a backwards-compatible version, the patch number of the version should be increased.
-
Semantic versioning is part of the PSR-2 coding standard.
-
Semantic versioning introduces conventions about breaking changes and aim to make upgrade dependencies safe.
Frage 13
Frage
Which statements about the composer.json file of a TYPO3 extension are correct? (2)
Antworten
-
The property type must be set to typo3-cms-extension.
-
The property type must be set to plugin, if the extension provides a frontend plugin.
-
The extension version is required and must be set with the property version.
-
PHP classes should be auto-loaded with the appropriate namespace and path information.
Frage 14
Frage
How do you make sure that a Composer package with a specific version does not get updated when you run the composer update command? (1)
Antworten
-
By adding a file DO_NOT_UPDATE to the extension directory.
-
By adding the Composer namespace of the extension to the update-lock property in the composer.json file.
-
By setting the exact version number with composer require.
-
This is not possible, because composer update always forces updates.
Frage 15
Frage
How do you install version 9.10.2 of the extension “Extension Builder” as an additional extension in an existing TYPO3 instance using Composer, assuming you have not added this package as a requirement yet? (1)
Note: the Composer namespace of the extension reads “friendsoftypo3/extension-builder”.
Antworten
-
composer install friendsoftypo3/extension-builder:9.10.2
-
composer install friendsoftypo3/extension-builder --version 9.10.2
-
composer require friendsoftypo3/extension-builder/9.10.2
-
composer require friendsoftypo3/extension-builder:9.10.2
-
composer require --version=9.10.2 --vendor=friendsoftypo3 extension-builder
Frage 16
Frage
What needs to be configured to auto-load PHP classes of a TYPO3 extension in a Composer-based setup? (1)
Antworten
-
The PSR-4 autoload information needs to be added to the file ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['autoload'][$_EXTKEY] = [
"psr-4" => [
"Vendor\\MyExtension\\": "Classes/"
]
];
-
The PSR-4 autoload information needs to be added to the file composer.json:
"autoload": {
"psr-4": {
"Vendor\\MyExtension\\": "Classes/"
}
}
-
A configuration file autoload.yaml in the typo3conf/ directory.
-
A configuration file autoload.php in the typo3temp/ directory.
Frage 17
Frage
You want to update a Composer package that uses semantic versioning. Which version constraint do you use to get bug fixes only? (2)
Antworten
-
=1.2.3
-
^1.2.3
-
~1.2.3
-
1.2.*
-
=bugfix
Frage 18
Frage
You want to update a Composer package that uses semantic versioning. Which version constraint do you use if you want non-breaking updates only? (1)
Antworten
-
=1.2.3
-
^1.2.3
-
~1.2.3
-
*1.2.3
Frage 19
Frage
Which statements about importing class names with the help of the use-statement are correct? (3)
Antworten
-
They should be used in TCA files located at Configuration/TCA/.
-
They must not be used in the ext_tables.php file.
-
They must not be used in the ext_localconf.php file.
-
They can not be used for type annotations of Extbase model properties.
-
Importing class names require PHP version 7.2 at least.
-
Importing class names only work, if this feature is enabled in the Install Tool.
Frage 20
Frage
Where can you import class names with the help of the use-statement? (2)
Antworten
-
In repository class definitions, when extending the class TYPO3\CMS\Extbase\Persistence\Repository.
-
In ext_localconf.php files of extensions.
-
In type annotations of Extbase controller action arguments.
-
Importing class names is not supported by TYPO3 and Extbase at all.
Frage 21
Frage
Which of the following DocBlock and inline comments are valid by convention? (2)
Antworten
-
/**
* @param $blog \Vendor\MyExtension\Domain\Model\Blog
*/
-
/**
* @param \Vendor\MyExtension\Domain\Model\Blog $blog
*/
-
/** @var $blog \Vendor\MyExtension\Domain\Model\Blog */
-
// @var $blog \Vendor\MyExtension\Domain\Model\Blog