1 | <?php declare(strict_types=1); |
||
17 | class Application |
||
18 | { |
||
19 | /** @var Container $container */ |
||
20 | private $container; |
||
21 | |||
22 | /** @var string $configFolder */ |
||
23 | private $configFolder = 'config'; |
||
24 | |||
25 | /** @var string $environment */ |
||
26 | private $environment = 'production'; |
||
27 | |||
28 | /** |
||
29 | * There be nay feckin wi' constructors on board this ship |
||
30 | * There be nay copyin' o' th'ship either |
||
31 | * This ship is a singleton! |
||
32 | */ |
||
33 | private function __construct(){} |
||
35 | |||
36 | |||
37 | /** |
||
38 | * Ahoy! There nay be boardin without yer configuration |
||
39 | * |
||
40 | * @param array $config |
||
|
|||
41 | * @return Application |
||
42 | */ |
||
43 | 10 | public static function ahoy() |
|
60 | |||
61 | /** |
||
62 | * Use this to bootstrap Bone without dispatching any request |
||
63 | * i.e. for when using the framework in a CLI application |
||
64 | */ |
||
65 | 8 | public function bootstrap(): Container |
|
77 | |||
78 | |||
79 | /** |
||
80 | * |
||
81 | * T' the high seas! Garrr! |
||
82 | * |
||
83 | * @return bool |
||
84 | * @throws \Exception |
||
85 | */ |
||
86 | 8 | public function setSail() |
|
87 | { |
||
88 | // load in the config and set up the dependency injection container |
||
89 | 8 | $this->bootstrap(); |
|
90 | 8 | $request = ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES); |
|
91 | /** @var RequestHandlerInterface $stack */ |
||
92 | 8 | $stack = $this->container->get(Stack::class); |
|
93 | |||
94 | try { |
||
95 | 8 | $response = $stack->handle($request); |
|
96 | 5 | } catch (NotFoundException $e) { |
|
97 | $response = new RedirectResponse($e->getMessage()); |
||
98 | if ($e->getRequest()->getMethod() !== 'GET') { |
||
99 | $response = $stack->handle($request); |
||
100 | } |
||
101 | } |
||
102 | |||
103 | 3 | (new SapiEmitter)->emit($response); |
|
104 | |||
105 | 3 | return true; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return Container |
||
110 | */ |
||
111 | 1 | public function getContainer(): Container |
|
115 | |||
116 | /** |
||
117 | * @param string $configFolder |
||
118 | */ |
||
119 | 8 | public function setConfigFolder(string $configFolder) |
|
123 | |||
124 | /** |
||
125 | * @param string $environment |
||
126 | */ |
||
127 | 1 | public function setEnvironment(string $environment) |
|
131 | } |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.