Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
fixtures: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Dec 13, 2020
1 parent a103bff commit 13fac42
Showing 1 changed file with 0 additions and 271 deletions.
271 changes: 0 additions & 271 deletions src/DataFixtures/QuestionFixtures.yaml
Original file line number Diff line number Diff line change
@@ -1,274 +1,3 @@
#questions:
# 1:
# person: Fred
# difficulty: 3
# label: Namespaces and extended classes
# description: |
# ### What will be displayed? 🤔
#
# ```php
# <?php
#
# namespace \Foo \Bar;
#
# class A {
# static public function show() {
# echo static::class;
# }
# }
#
# class B extends A {}
#
# B::show();
# ?>
# ```
#
# answers:
# - label: >
# Fatal error: Uncaught Error: Undefined constant 'Foo\Bar'
# score: 1.0
# - label: >
# Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR)'
# score: 0.0
# - label: Foo\Bar\A
# score: 0.0
# - label: Foo\Bar\B
# score: 0.0
#
# answer_explanations: >
# PHP namespaces can contain space characters, but they can\'t begin with a backslash.
# Try [here](https://3v4l.org/pQOMe).
#
# > Notice: As I am writing this quiz (2020-07-31), there is a slight difference between all versions and PHP 8.0.0alpha3:
# > With this last version, the exception message "Foo\Bar" is wrapped by double quotes instead of single quotes for other versions (\'Foo\Bar\'). 🤔
#
# Read the namespaces documentation on php.net: [Defining namespaces](https://www.php.net/manual/en/language.namespaces.definition.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/1286207302018699264
# created_at: '2020-07-23'
#
# 2:
# person: Fred
# difficulty: 3
# label: Generator
# description: |
# ### What will be displayed? (PHP version >= 7.4)? 🤔
#
# ```php
# <?php
#
# function generator() {
# yield '1' => 4;
# yield '0' => 2;
# }
#
# $array = [... generator()];
#
# echo implode('', $array);
# ```
#
# answers:
# - label: '42'
# score: 0.0
# - label: '24'
# score: 0.0
# - label: "Parse error: syntax error, unexpected '...' (T_ELLIPSIS)"
# score: 0.0
# - label: 'Fatal error: Uncaught Error: Cannot unpack Traversable with string keys'
# score: 1.0
#
# answer_explanations: |
# PHP 7.4 unpack a Traversable by keeping the iteration order, but it fails when the keys are strings, even if those strings are numeric.
#
# The right answer was "Fatal error: Uncaught Error: Cannot unpack Traversable with string keys".
#
# Try [here](https://3v4l.org/qKGPt).
#
# Read the generators documentation on php.net: [Generator syntax](https://www.php.net/manual/en/language.generators.syntax.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/1285134865176956929
# created_at: '2020-07-20'
#
# 3:
# person: Fred
# difficulty: 3
# label: property_exists ?
# description: |
# ### What will be displayed? (PHP version >= 7.4)? 🤔
#
# ```php
# <?php
# declare(strict_types=0);
# class A {
# public function get(string $name, $default) {
# if (property_exists($this, $name)) {
# return $this->{$name};
# }
#
# return $default;
# }
# }
#
# class B extends A {
# private $foo = 42;
# }
#
# var_dump((new B)->get('foo', null));
#
# ```
#
#
# answers:
# - label: 'int(42)'
# score: 0.0
# - label: 'NULL'
# score: 0.0
# - label: 'Fatal error: Uncaught Error: Cannot access private property B::\$foo'
# score: 1.0
# - label: "Parse error: syntax error, unexpected '{'"
# score: 0.0
#
# answer_explanations: |
# PHP function `property_exists` will find the private property, but you cannot access to it.
#
# The right answer was "`Fatal error: Uncaught Error: Cannot access private property B::\$foo`"
#
# Try [here](https://3v4l.org/1Qe3c).
#
# Read the property_exists documentation on php.net: [ property_exists ](https://www.php.net/manual/en/function.property-exists.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/1283314819228225537
# created_at: '2020-07-15'
#
# 4:
# person: Fred
# difficulty: 3
# label: label
# description: |
# ### What will be displayed? 🤔
#
# ```php
# <?php
# declare(strict_types=1);
#
# $generator = (function() {
# yield 42;
# });
#
# array_walk($generator, function (int $value) {
# var_dump($value);
# });
#
# ```
#
# answers:
# - label: '[nothing]'
# score: 1.0
# - label: 'int(42)'
# score: 0.0
# - label: 'string(2) "42"'
# score: 0.0
# - label: 'Fatal Error (type error)'
# score: 0.0
#
# answer_explanations: |
# All PHP functions prefixed by "array_" expect an array, and not a traversable/iterator.
#
# The result is "[nothing]". Try [here]([https://3v4l.org/kKt77]).
#
# > Note: If the values had been in an array it would have been "int(42)" because internal array functions do not follow strict typing.
#
# Read the array functions documentation on php.net: [ Array Functions ](https://www.php.net/manual/en/ref.array.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/1295648502370926593
# created_at: '2020-08-18'
#
# 5:
# person: Fred
# difficulty: 3
# label: label
# description: |
# ### What will be displayed? 🤔
#
# ```php
# <?php
#
# $array = [];
# foreach (['a', '42'] as $key) {
# $array[$key] = $key;
# }
#
# $merge = array_merge($array, []);
# echo $merge[0] ?? 'null';
# ```
#
# answers:
# - label: 'null'
# score: 0.0
# - label: 'a'
# score: 0.0
# - label: '42'
# score: 1.0
# - label: '[nothing]'
# score: 0.0
#
# answer_explanations: |
# When you use the PHP function <code>array_merge</code>, all values in the input arrays with numeric keys will be renumbered with incrementing keys starting from zero.
#
# The right answer was "42".
#
# Try [here](https://3v4l.org/lb1YD).
#
# Read the array_merge function documentation on php.net: [array_merge](https://www.php.net/manual/en/function.array-merge.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/1297796014338973697
# created_at: '2020-08-24'

#
# 5:
# id: 5
# person_id: 1
# difficulty: 3
# label: What will be displayed?
# answer_explanations: >
# When you use the PHP function <code>array_merge</code>, all values in the input arrays with numeric keys will be renumbered
# with incrementing keys starting from zero. The right answer was "42" (C).
# live_snippet_url: https://3v4l.org/lb1YD
# sourceUrl: https://twitter.com/FredBouchery/status/1297796014338973697
# differences_output_notes: null
# created_at: '2020-08-24'

# 3:
# person: Fred
# difficulty: 3
# label: label
# description: |
# What will be displayed ?
#
# ```php
# ```
#
# answers:
# - label: ''
# score: 1.0
# - label: ''
# score: 0.0
# - label: ''
# score: 0.0
# - label: ''
# score: 0.0
#
# answer_explanations: |
# explaination

# Try here: [ https://3v4l.org/xxxx ]
#
# Read the generators documentation on php.net: [ Generator syntax ](https://www.php.net/manual/en/language.generators.syntax.php)
#
# sourceUrl: https://twitter.com/FredBouchery/status/xxxxx
# created_at: '2020-07-23'

#
# 6:
# id: 6
# person_id: 1
Expand Down

0 comments on commit 13fac42

Please sign in to comment.