1 | <?php |
||
2 | /** |
||
3 | * @package Composer |
||
4 | * @category modules |
||
5 | * @author Nazar Mokrynskyi <[email protected]> |
||
6 | * @license 0BSD |
||
7 | */ |
||
8 | namespace cs\modules\Composer; |
||
9 | use |
||
10 | cs\Event, |
||
11 | Symfony\Component\Console\Formatter\OutputFormatterInterface, |
||
0 ignored issues
–
show
|
|||
12 | Symfony\Component\Console\Output\Output as Symfony_output; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Output\Output was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
13 | |||
14 | /** |
||
15 | * Provides next events: |
||
16 | * Composer/update_progress |
||
17 | * [ |
||
18 | * 'message' => $message, //Current message targeted for output |
||
19 | * 'buffer' => $this->buffer //Total output |
||
20 | * ] |
||
21 | */ |
||
22 | class Output extends Symfony_output { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $buffer = ''; |
||
27 | /** |
||
28 | * @var resource |
||
29 | */ |
||
30 | protected $stream; |
||
31 | public function __construct ($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null) { |
||
32 | $this->stream = fopen(STORAGE.'/Composer/last_execution.log', 'w'); |
||
0 ignored issues
–
show
It seems like
fopen(cs\modules\Compose...st_execution.log', 'w') can also be of type false . However, the property $stream is declared as type resource . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
![]() |
|||
33 | parent::__construct($verbosity, $decorated, $formatter); |
||
34 | } |
||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function get_buffer () { |
||
39 | return $this->buffer; |
||
40 | } |
||
41 | /** |
||
42 | * @param string $message |
||
43 | * @param bool $newline |
||
44 | */ |
||
45 | protected function doWrite ($message, $newline) { |
||
46 | if ($newline) { |
||
47 | $message .= "\n"; |
||
48 | } |
||
49 | fwrite($this->stream, $message); |
||
50 | $this->buffer .= $message; |
||
51 | Event::instance()->fire( |
||
52 | 'Composer/update_progress', |
||
53 | [ |
||
54 | 'message' => $message, |
||
55 | 'buffer' => $this->buffer |
||
56 | ] |
||
57 | ); |
||
58 | } |
||
59 | public function __destruct () { |
||
60 | fclose($this->stream); |
||
61 | } |
||
62 | } |
||
63 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths